You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(command-code): reuse normalized tools for text recovery - #8950
Reuse each Command Code tool's outbound input schema when preparing its text-call recovery entry. A catalog with two declarations now calls the normalizer twice. Previously it called it four times.
Keep the declared schema for recovered argument validation and preserve freeform tool handling. The provider contract describes how the outbound and recovery views are built.
Verification
bun test tests/providers/command-code-tool-schema.test.ts tests/providers/command-code-provider.test.ts passed 93 tests. The new regression counts normalizer invocations on two ordinary tool declarations. Existing cases exercise the wire payload, text-call recovery and declared-schema validation.
bun run typecheck, bun run structure:check, bun run privacy:scan and git diff --check passed. The local run focused on the affected adapter. The full repository suite was not run locally.
Checklist
Scope stays focused and avoids unrelated cleanup.
Docs or release notes were updated when needed.
Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.
Summary by CodeRabbit
Bug Fixes
Improved consistency when preparing tool schemas for requests and processing tool-call recovery. Schema validation continues to use the declared tool schema.
Documentation
Clarified how schema normalization is handled for Command Code tool declarations and text-call recovery.
Tests
Added coverage verifying that each tool schema is normalized once and included in the request.
No actionable comments were generated in the recent review.
Walkthrough
Command Code now prepares tool declarations once per request. It uses normalized schemas for wire declarations and non-freeform recovery, while retaining original declared schemas for validation. A test checks normalization counts, and the provider documentation describes the updated behavior.
Changes: Command Code schema preparation
Layer / File(s)
Summary
Prepare and verify tool declarations src/adapters/command-code.ts, tests/providers/command-code-tool-schema.test.ts, structure/providers-and-adapters.md
prepareTools normalizes each tool’s parameters and returns wire definitions with a declared-tool map. Non-freeform recovery schemas remove $defs and definitions; validation retains the original schema, and freeform tools retain their original schema. Request construction sends the prepared wire definitions and stores the declared-tool map. The test checks that two tools appear in the wire schemas and that normalization runs twice. The documentation describes this behavior.
lidge-jun/opencodex#8873: It changes Command Code schema normalization, which this PR reuses for text-call recovery.
lidge-jun/opencodex#8591: It introduces the Anthropic schema normalizer that this PR uses for tool preparation and recovery.
Merge Risk: Minimal · up to fe6e5
This change avoids redundant tool-schema normalization in Command Code requests and keeps recovery validation and freeform handling intact. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "perf(command-code): reuse normalized tools for text recovery" matches the main change. The adapter now reuses each tool's normalized schema for text-call recovery instead of normalizing aga…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "perf(command-code): reuse normalized tools for text recovery" matches the main change. The adapter now reuses each tool's normalized schema for text-call recovery instead of normalizing again, and the PR objectives report normalizer calls drop from four to two for two declarations. The title is concise and specific. It names the scope (command-code), the change type (perf), and the core idea. The docs and test changes support the same change.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 1b5f65f and fe6e5d4.
Files selected for processing: 3
src/adapters/command-code.ts
structure/providers-and-adapters.md
tests/providers/command-code-tool-schema.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Checks on this head: all completed checks pass (ci aggregate, gates/test changed where selected, CodeRabbit, enforce-target, hygiene); none pending or failing.
Review: terra review APPROVE-WITH-NITS, no correctness defect; command-code tests 93 pass, typecheck exit 0; the new call-count test fails on origin/dev src/adapters/command-code.ts (31 pass / 1 fail) and passes on this head (32 pass).
Review threads: 0 unresolved.
Scope: perf, no behavior change; no auth, workflow, release, dependency or provider-preset surface.
This is maintainer integration, not an independent approval.
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
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
Verification
bun test tests/providers/command-code-tool-schema.test.ts tests/providers/command-code-provider.test.tspassed 93 tests. The new regression counts normalizer invocations on two ordinary tool declarations. Existing cases exercise the wire payload, text-call recovery and declared-schema validation.bun run typecheck,bun run structure:check,bun run privacy:scanandgit diff --checkpassed. The local run focused on the affected adapter. The full repository suite was not run locally.Checklist
Summary by CodeRabbit