Repository navigation
feat(harness): serde and schemars derives on ClaudeAgentSdkConfig and RequiredOutput - #617
Open
CodeGhost21 wants to merge 2 commits into
Open
CodeGhost21 wants to merge 2 commits into
CodeGhost21 wants to merge 2 commits into
Conversation
…equiredOutput Hosts mirrored these types field-for-field only because the upstream structs could not be read from a config file or described in a config schema. ClaudeAgentSdkConfig now derives Serialize, Deserialize and JsonSchema with per-field defaults matching Default; RequiredOutput gains JsonSchema and container-level #[serde(default)], so a missing block_key reads as the inert blank key instead of a parse error. The attributes match OpenHuman's mirrors exactly. New tests embed those mirrors verbatim and assert identical parsed values, TOML and JSON bytes and JSON schema for representative config sections. Refs senamakel#94 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00. Or wait 59 minutes for your next included review. View limit details
|
CodeGhost21
marked this pull request as ready for review
November 16, 2026 14:12
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
Serialize,DeserializeandJsonSchematoproviders::claude_agent_sdk::ClaudeAgentSdkConfig, andJsonSchemaplus a container-level#[serde(default)]toconfig::RequiredOutput, so hosts can embed them in their own config instead of keeping field-for-field mirrors.OpenHuman mirrors both types:
config/schema/claude_agent_sdk.rs, andRequiredOutputContractinconfig/schema/agent.rs, converted inagent/tinyagents/config.rs. It does this only because the upstream types couldn't be (de)serialized or put into a schema. With this PR, OpenHuman can delete the mirrors and theFromconversions without changing users' config files (host adoption: senamakel/openhuman#357).Fixes senamakel#94. Part of tinyhumansai/openhuman#7390 (phase 3 tracker senamakel/openhuman#391).
API Or Behavior Changes
ClaudeAgentSdkConfig: gainsSerialize, Deserialize, JsonSchema.enabled = false,binary = "claude",default_model = "claude-sonnet-4-6",max_budget_usd = None). They come from private default fns thatDefaultalso uses.RequiredOutput: gainsJsonSchemaand a container#[serde(default)], which replaces the field-level one onrequired_keys.RequiredOutputwith noblock_keyused to be a parse error. It now reads as the inert blank key, the same as OpenHuman's mirror. Nothing in this workspace relied on the error. This is noted in the changelog.tinyagents-harnessalready depends onschemars1.2 unconditionally and already derivesJsonSchemaonRunMode.Cargo.lockis unchanged.Parity with OpenHuman's mirrors (tests embed the mirrors verbatim as the reference):
enabled/binary/default_modelfalse/"claude"/"claude-sonnet-4-6"max_budget_usdNonenull; TOML omits)block_key/required_keys""/[]The schemas are equal once the type-level
titleanddescriptionare removed. One difference for the adopting host: the$defsname becomesRequiredOutputinstead ofRequiredOutputContract.Tests
11 new tests in
providers/claude_agent_sdk/mod_serde_tests.rs(6) andconfig/types_serde_tests.rs(5). For 5 TOML fixtures each (full, partial, single field, empty section, absent section), they check:toml::to_stringandserde_json::to_stringoutput;schema_for!output.Commands run locally:
cargo fmt --check(cargo fmt --all -- --check)cargo clippy --all-targets -- -D warnings(--workspace)cargo clippy --all-targets --all-features -- -D warnings(--workspace)cargo build --all-targets(cargo check -p tinyagents-harness --all-targets, plus--features json-schema, and--no-default-featureslib)cargo build --all-targets --all-features: left to CIcargo test:-p tinyagents-harness --lib serde_tests: 11/11, default features and--all-features.--lib: 3337 passed, 9 failed. All 9 are inproviders::claude_code::driver::tests, which this PR doesn't touch; the local sandbox kills thefake-claudefixture'scatcalls (Killed: 9).cargo test --all-features: left to CIRUSTDOCFLAGS="-D warnings" cargo doc -p tinyagents-harness --no-deps --all-featuresUnrelated note:
cargo check -p tinyagents-harness --no-default-features --all-targetsfails onmain, becauseobservability/turn_observer_tests.rsimportsobservability::langfusewithout thelangfusefeature.Documentation
crates/tinyagents-harness/src/config/README.mdandproviders/claude_agent_sdk/README.mdare updated.CHANGELOG.mdhas a new "Unreleased" entry that includes theRequiredOutputbehaviour change.Release note: OpenHuman needs a tag that contains this before it can bump the gitlink and delete its mirrors. No cargo feature needs enabling.
🤖 Generated with Claude Code