feat(harness): normalize recoverable tool arguments#71
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds ChangesTool argument recovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AgentLoop
participant admit_tool_call
participant normalize_tool_arguments
participant SchemaValidation
participant RegisteredTool
AgentLoop->>admit_tool_call: submit tool call
admit_tool_call->>normalize_tool_arguments: normalize malformed arguments
normalize_tool_arguments-->>admit_tool_call: normalized or original arguments
admit_tool_call->>SchemaValidation: validate against captured schema
SchemaValidation-->>admit_tool_call: validation result
admit_tool_call->>RegisteredTool: invoke valid arguments
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2307b665f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 105892bc0e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
tinyagents/src/harness/agent_loop/tools.rs
Line 256 in f33dd5b
When normalization decodes a stringified object but the decoded object still fails validation, for example "{\"query\":42}" for a string query, call.arguments has already been overwritten before this event is emitted. AgentEvent::InvalidToolArgs documents that it preserves the raw model-supplied arguments for replay/analysis, but this now records the normalized object instead; keep a pre-normalization snapshot and emit that on validation failures.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/harness/agent_loop/test.rs`:
- Around line 1112-1113: Extend the assertions in the relevant test around
run.final_response and calls to verify that the emitted tool result preserves
the original JSON string "hello" unchanged. Keep the existing execution-count
assertion, and inspect the captured tool result using the test’s existing
result-access mechanism rather than relying only on schema validation.
In `@src/harness/agent_loop/tools.rs`:
- Around line 481-490: Update the object-capability detection in the schema
normalization flow around accepts_object so schemas whose enum contains object
values are recognized as object-capable. Inspect the enum array and treat it as
accepting objects when any enum entry is an object, preserving the existing
type, properties, and required checks and allowing validate_schema_value to
normalize matching stringified objects.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c6e12bd4-0496-4c11-9f6c-da32b75e25d2
📒 Files selected for processing (5)
docs/modules/harness/tool.mdsrc/harness/agent_loop/test.rssrc/harness/agent_loop/tools.rssrc/harness/runtime/types.rssrc/harness/tool/mod.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c13ec1035
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a4ccc1f95
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5262493eb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02d7425ff2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
NormalizeThenReturnToolErrorinvalid-argument policy{}only for schemas without required fieldsThis moves provider-neutral argument recovery into the harness admission boundary, where it runs before schema validation and before tool execution.
Validation
cargo fmt --checkcargo test normalized_ --libcargo test normalization_preserves_required_field_validation_errors --libSummary by CodeRabbit
New Features
Bug Fixes
Documentation