Skip to content

feat(harness): serde and schemars derives on ClaudeAgentSdkConfig and RequiredOutput - #617

Open
CodeGhost21 wants to merge 2 commits into
tinyhumansai:mainfrom
CodeGhost21:feat/94-config-serde-derives
Open

CodeGhost21 wants to merge 2 commits into
tinyhumansai:mainfrom
CodeGhost21:feat/94-config-serde-derives

Conversation

@CodeGhost21

Copy link
Copy Markdown
Member

Summary

Adds Serialize, Deserialize and JsonSchema to providers::claude_agent_sdk::ClaudeAgentSdkConfig, and JsonSchema plus a container-level #[serde(default)] to config::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, and RequiredOutputContract in config/schema/agent.rs, converted in agent/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 the From conversions 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: gains Serialize, Deserialize, JsonSchema.
    • Field defaults match OpenHuman (enabled = false, binary = "claude", default_model = "claude-sonnet-4-6", max_budget_usd = None). They come from private default fns that Default also uses.
    • Field docs use OpenHuman's wording, so schema descriptions match.
  • RequiredOutput: gains JsonSchema and a container #[serde(default)], which replaces the field-level one on required_keys.
  • Behaviour change: a RequiredOutput with no block_key used 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.
  • No new dependency or cargo feature: tinyagents-harness already depends on schemars 1.2 unconditionally and already derives JsonSchema on RunMode. Cargo.lock is unchanged.

Parity with OpenHuman's mirrors (tests embed the mirrors verbatim as the reference):

Field Wire name Default Skipped on output?
enabled / binary / default_model same false / "claude" / "claude-sonnet-4-6" never
max_budget_usd same None never (JSON null; TOML omits)
block_key / required_keys same "" / [] never

The schemas are equal once the type-level title and description are removed. One difference for the adopting host: the $defs name becomes RequiredOutput instead of RequiredOutputContract.

Tests

11 new tests in providers/claude_agent_sdk/mod_serde_tests.rs (6) and config/types_serde_tests.rs (5). For 5 TOML fixtures each (full, partial, single field, empty section, absent section), they check:

  • the same parsed values as OpenHuman's mirror;
  • identical toml::to_string and serde_json::to_string output;
  • a TOML round trip;
  • an equal 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-features lib)
  • cargo build --all-targets --all-features: left to CI
  • cargo test:
    • -p tinyagents-harness --lib serde_tests: 11/11, default features and --all-features.
    • Full --lib: 3337 passed, 9 failed. All 9 are in providers::claude_code::driver::tests, which this PR doesn't touch; the local sandbox kills the fake-claude fixture's cat calls (Killed: 9).
  • cargo test --all-features: left to CI
  • RUSTDOCFLAGS="-D warnings" cargo doc -p tinyagents-harness --no-deps --all-features

Unrelated note: cargo check -p tinyagents-harness --no-default-features --all-targets fails on main, because observability/turn_observer_tests.rs imports observability::langfuse without the langfuse feature.

Documentation

  • crates/tinyagents-harness/src/config/README.md and providers/claude_agent_sdk/README.md are updated.
  • CHANGELOG.md has a new "Unreleased" entry that includes the RequiredOutput behaviour 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

CodeGhost21 and others added 2 commits November 16, 2026 19:35
…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>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 8 billable files and costs up to $2.00.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 94db8e17-78bb-4591-88b9-e0e0e6daa9bd
Commits

Reviewing files that changed from the base of the PR and between 28cf21e and bb7be73.

Files selected for processing: 8

  • CHANGELOG.md
  • crates/tinyagents-harness/src/config/README.md
  • crates/tinyagents-harness/src/config/mod.rs
  • crates/tinyagents-harness/src/config/types.rs
  • crates/tinyagents-harness/src/config/types_serde_tests.rs
  • crates/tinyagents-harness/src/providers/claude_agent_sdk/README.md
  • crates/tinyagents-harness/src/providers/claude_agent_sdk/mod.rs
  • crates/tinyagents-harness/src/providers/claude_agent_sdk/mod_serde_tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@CodeGhost21
CodeGhost21 marked this pull request as ready for review November 16, 2026 14:12

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[core-shrink] upstream: serde + schemars derives on ClaudeAgentSdkConfig and RequiredOutput

1 participant