Repository navigation
fix(review): flatten gentle_review root schema for Claude Agent SDK (#1698) - #1710
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe Changesgentle_review schema compatibility
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The schema change addresses provider compatibility while retaining the checked input protections. No identified issue blocks merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The broader input schema still routes through operation-specific validation and existing consent and authorization controls. No security bypass was identified. Actual provider registration and native persistence behavior were not verified end to end. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
danielgap
left a comment
There was a problem hiding this comment.
Reviewed from the facade/schema side — the diagnosis matches what I can verify, and the trade is the right one.
Root cause check: REVIEW_CONTROLLER_PARAMETERS carried a root-level anyOf with per-operation branches (#1678). Anthropic's tool input_schema only allows combinators nested inside properties, and a root union makes Claude Code / Agent SDK silently drop the whole tool — worse than a validation error, since the review lifecycle becomes unreachable with no diagnostic. Removing the root union while keeping constraint enforcement in parseReviewControllerParameters and the facade branches is correct: the schema loosens (objects now pass schema validation for non-START/ASSESS operations), but the facade still rejects them fail-closed with zero native dispatch — the updated tests pin exactly that.
Verified locally (PR head merged with current origin/main — clean textual merge):
tests/review-json-arguments.test.ts8/8,tests/review-controller-native-routing.test.ts96/96, typecheck 186 recorded / no regressions, full suite PASS.- RED confirmed: restoring main's declaration makes the new "no root-level union combinators" test fail exactly as the PR describes (root
anyOf, 2 branches). - The
select-intended-untrackedexclusion in the updated test is legitimate: that operation goes through its own selection parser, which rejects an unexpectedinputkey with its own fail-closed error — same closure, different message. - The retained
inputunion ([...REVIEW_JSON_ARGUMENT.anyOf, { type: "null" }]) sits nested inside the property — the spec-valid spot.
One suggestion (non-blocking): schema-level rejection is gone, so runtime branches are now the only guard; if a future operation is added without one, only the test catches it. A one-line comment at the input property pointing to review-json-arguments.test.ts as the guard would help the next editor — the test is the real net either way.
Ready from my side once #1698 gets its triage.
Fixes #1698
Problem
Under Claude Agent SDK providers (such as
pi-claude-bridgeand Claude Code), thegentle_reviewtool is silently dropped upon session initialization. The sibling review tools (gentle_review_capture,gentle_review_capture_group,gentle_review_scope) remain present. Withoutgentle_review, the review lifecycle (inspect, START, consent, etc.) becomes completely unreachable.Root cause:
REVIEW_CONTROLLER_PARAMETERSinextensions/gentle-ai.tswas declared with a top-levelanyOfto differentiatestart/assessoperations from string-only operations (#1678). The Anthropic Tool Definition specification strictly forbids root-levelanyOf,oneOf, andallOfcombinators in toolinput_schema(only nested combinators insideproperties.<prop>are supported). Claude Agent SDK / Claude Code strictly rejects the tool definition and drops the tool from the available catalog.Change
extensions/gentle-ai.ts, flattenREVIEW_CONTROLLER_PARAMETERSby removing the root-levelanyOfcombinator. The root schema is now a cleantype: "object".properties.inputwith nestedanyOf: [REVIEW_JSON_STRING, { type: "object" }, { type: "null" }], which is valid across Anthropic and other providers and retainsnullfor downstream fail-closed validation.parseReviewControllerParametersalready enforces that non-START/ASSESS operations reject objects withReview controller input must be a stringand zero native calls.tests/review-json-arguments.test.tsasserting that all registered review tools declare clean object schemas with no root-levelanyOf/oneOf/allOf.tests/review-json-arguments.test.tsto verify that object inputs for non-START/ASSESS operations are rejected fail-closed at the controller facade boundary without dispatching to native CLI.Verification
registered review schemas have plain object parameters with no root-level union combinators (#1698)failed against basemainwithgentle_review parameters must not have root-level anyOf(actual: 2 branches).tests/review-json-arguments.test.ts.node --experimental-strip-types --test tests/review-controller-native-routing.test.ts(96/96 passed).pnpm run typecheckclean (186 recorded baseline diagnostics, 0 regressions, 12 improved).node scripts/verify-package-files.mjsclean (155 files, 69 exact byte-pinned artifacts verified).Summary by CodeRabbit