fix(agents): project nullable tool schemas for providers#88880
fix(agents): project nullable tool schemas for providers#88880vincentkoc wants to merge 6 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 1, 2026, 1:38 AM ET / 05:38 UTC. Summary PR surface: Source +93, Tests -126. Total -33 across 12 files. Reproducibility: yes. From source, current main returns raw nullable anyOf/const schemas through the Codex dynamic-tool projection path, and the plain JSON-schema union coercer can coerce null through an earlier non-null branch; I did not run tests in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this shape if maintainers accept the provider-schema tradeoff: keep raw runtime validation nullable, project only the provider-facing schema, and let CI verify the current merge result. Do we have a high-confidence way to reproduce the issue? Yes. From source, current main returns raw nullable anyOf/const schemas through the Codex dynamic-tool projection path, and the plain JSON-schema union coercer can coerce null through an earlier non-null branch; I did not run tests in this read-only review. Is this the best way to solve the issue? Yes. Centralizing the provider projection in projectRuntimeToolInputSchema while keeping raw validation separate is the narrowest maintainable fix; duplicating cron-specific or Codex-specific schema rewrites would be more drift-prone. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 6173a4babb99. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +93, Tests -126. Total -33 across 12 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
15c66cf to
c54a143
Compare
c54a143 to
ef6bc22
Compare
c6aaf80 to
a23ee0b
Compare
a23ee0b to
4caf7f9
Compare
4caf7f9 to
8aeaadf
Compare
Summary
nullclear sentinels during raw argument validation before provider projectionstringVerification
Reviewed/proved local head:
8aeaadf963aReviewed/proved base:
db4990d2605Current note:
origin/mainadvanced again after the final review; GitHub CI/mergeability should arbitrate the pushed branch against the newest base.node scripts/run-vitest.mjs packages/llm-core/src/validation.test.ts src/agents/tool-schema-projection.test.ts src/agents/tools/cron-tool.schema.test.ts src/agents/tools/cron-tool.test.ts --reporter=dot- passed 3 shards / 118 testsnode --import tsx scripts/generate-prompt-snapshots.ts --check- passed,Prompt snapshots are current (7 files).node_modules/.bin/oxfmt --check --threads=1 packages/llm-core/src/validation.test.ts packages/llm-core/src/validation.ts src/agents/tool-schema-projection.test.ts src/agents/tool-schema-projection.ts src/agents/tools/cron-tool.schema.test.ts src/agents/tools/cron-tool.test.ts- passednode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.json packages/llm-core/src/validation.test.ts packages/llm-core/src/validation.ts src/agents/tool-schema-projection.test.ts src/agents/tool-schema-projection.ts src/agents/tools/cron-tool.schema.test.ts src/agents/tools/cron-tool.test.ts- passedgit diff --check origin/main...HEAD- passed on the reviewed base.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt 'Review the pruned provider/runtime tool schema projection hardening branch after rebasing onto latest main. Focus only on actionable regressions in provider-facing schema projection, raw validation preservation, non-null union preservation, and prompt snapshot correctness. Do not inspect external repositories unless essential.'- clean, no accepted/actionable findings,overall: patch is correct (0.76)Real behavior proof
Behavior addressed: Provider-facing runtime tool schema projection no longer leaks nullable OpenAPI-incompatible shapes for covered runtime schemas, while raw validation still accepts explicit null clear sentinels and mixed non-null unions remain represented as unions.
Real environment tested: Local OpenClaw Codex/gwt worktree on macOS with shared repo
node_modules, using the repo Vitest wrapper plus snapshot, format, lint, diff, scrub, and autoreview gates.Exact steps or command run after this patch: The focused Vitest, prompt snapshot, oxfmt, oxlint, diff-check, private-name scrub, and autoreview commands listed above were run after the final rebase.
Evidence after fix: Focused tests passed 3 shards / 118 tests; prompt snapshots were current; oxfmt, oxlint, and diff-check passed; autoreview reported no accepted/actionable findings.
Observed result after fix: Nullable provider schema branches are projected to provider-compatible schemas, unsupported dynamic keywords are still reported from raw schemas, explicit null clear values validate correctly, and mixed non-null unions are preserved instead of narrowed.
What was not tested: A live provider turn or full
pnpm check:changedwas not run for this narrow PR; GitHub CI is expected to cover the pushed branch against the latest movingmain.