fix(agents): tolerate provider tool schema hook failures#88977
fix(agents): tolerate provider tool schema hook failures#88977vincentkoc wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 29, 2026, 6:07 PM ET / 22:07 UTC. Summary PR surface: Source +93, Tests +270. Total +363 across 14 files. Reproducibility: yes. by source inspection: current main directly invokes provider normalize and inspect hooks from runtime projection helpers, so a throwing hook propagates. I did not run a live third-party provider plugin repro in this read-only review. Review metrics: 1 noteworthy metric.
Stored data model 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 one refreshed canonical provider hook containment branch that keeps doctor/check validation strict, uses total redacted warning logs, covers assistant and Codex entrypoints, and has broad current-main proof. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: current main directly invokes provider normalize and inspect hooks from runtime projection helpers, so a throwing hook propagates. I did not run a live third-party provider plugin repro in this read-only review. Is this the best way to solve the issue? Unclear until maintainers choose the canonical branch. This PR's strict-default plus assistant-only warn mode is a maintainable shape, but the dirty overlap with the sibling branch must be resolved first. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 843ad143647e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +93, Tests +270. Total +363 across 14 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
Review history (1 earlier review cycle)
|
|
Closing this fuzz-only hardening PR. The only failing state is a synthetic fixture using hostile in-process objects, throwing getters or callbacks, or similarly malformed metadata; there is no linked production report or supported external contract requiring that state. This adds broad fail-soft behavior and substantial regression surface across consumers. If a real plugin or provider demonstrates the failure, please open a focused issue with the observed payload and stack so validation can live at the single owning registration/parsing boundary. Thanks for exploring it. |
Summary
normalizeToolSchemasandinspectToolSchemasstrict by default for doctor/check validationVerification
node scripts/run-vitest.mjs src/infra/errors.test.ts src/agents/embedded-agent-runner/tool-schema-runtime.test.ts src/agents/runtime-plan/tools.test.ts extensions/codex/src/app-server/dynamic-tool-build.test.ts src/agents/embedded-agent-runner/compact.hooks.test.ts --reporter=dotnode scripts/run-vitest.mjs src/flows/doctor-core-checks.runtime-errors.test.ts src/commands/doctor/shared/active-tool-schema-warnings.test.ts src/agents/embedded-agent-runner/run/attempt.spawn-workspace.context-engine.test.ts --reporter=dotnode_modules/.bin/oxfmt --check --threads=1 src/infra/errors.ts src/infra/errors.test.ts src/agents/embedded-agent-runner/tool-schema-runtime.ts src/agents/embedded-agent-runner/tool-schema-runtime.test.ts src/agents/runtime-plan/tools.ts src/agents/runtime-plan/tools.test.ts src/agents/runtime-plan/build.ts src/agents/runtime-plan/types.ts src/agents/embedded-agent-runner/run/attempt.ts extensions/codex/src/app-server/dynamic-tool-build.ts extensions/codex/src/app-server/dynamic-tool-build.test.ts src/agents/embedded-agent-runner/compact.ts src/agents/embedded-agent-runner/compact.hooks.test.ts src/agents/embedded-agent-runner/compact.hooks.harness.tsOPENCLAW_OXLINT_SKIP_LOCK=1 node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.json src/infra/errors.ts src/infra/errors.test.ts src/agents/embedded-agent-runner/tool-schema-runtime.ts src/agents/embedded-agent-runner/tool-schema-runtime.test.ts src/agents/runtime-plan/tools.ts src/agents/runtime-plan/tools.test.ts src/agents/runtime-plan/build.ts src/agents/runtime-plan/types.ts src/agents/embedded-agent-runner/run/attempt.ts extensions/codex/src/app-server/dynamic-tool-build.ts extensions/codex/src/app-server/dynamic-tool-build.test.ts src/agents/embedded-agent-runner/compact.ts src/agents/embedded-agent-runner/compact.hooks.test.ts src/agents/embedded-agent-runner/compact.hooks.harness.tsgit diff --check origin/main...HEAD.agents/skills/autoreview/scripts/autoreview --mode local --prompt "..."Real behavior proof
Behavior addressed: assistant-visible tool projection no longer aborts when a provider tool-schema hook throws; doctor/check paths still surface the failure because strict behavior remains the default.
Real environment tested: local Codex worktree with Node/Vitest routed through
scripts/run-vitest.mjs; broad remote proof attempted through AWS Crabbox and Blacksmith Testbox.Exact steps or command run after this patch: focused Vitest commands, oxfmt, oxlint,
git diff --check origin/main...HEAD, private-name scrub, local autoreview, and remotenode scripts/crabbox-wrapper.mjs run --provider aws --idle-timeout 90m --ttl 240m --timing-json --shell -- "corepack pnpm check:changed".Evidence after fix: focused tests passed 146 tests across 3 routed shards and 67 tests across 3 routed shards; formatter/lint/diff/scrub passed; final autoreview reported no accepted/actionable findings with
overall: patch is correct (0.87).Observed result after fix: warn-mode paths keep the current runtime tools and log sanitized hook failures, including non-Error and hostile thrown values; strict callers still throw for doctor/check visibility.
What was not tested: remote
check:changeddid not run because AWS Crabbox allocation failed twice withactive lease limit exceeded: 9/8, and Blacksmith Testbox failed withnot authenticated -- run 'blacksmith auth login' first.