Repository navigation
refactor(agents): retire legacy tool execution argument decoding - #140280
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 1:18 PM ET / 17:18 UTC. ClawSweeper reviewWhat this changesThe PR removes legacy tool-call argument decoding and adds coverage for cancellation, update forwarding, execution ordering, and session completion. Merge readiness✅ Ready for maintainer review The cleanup remains useful and introduces no identified correctness blocker. Current callers support the canonical argument order, and the updated maintainer disposition addresses the previous review concern while preserving the separate live-failure investigation. Priority: P3 Review scores
Verification
How this fits togetherThe agent tool adapter connects session dispatch to built-in and client-hosted tools. It carries arguments, cancellation, and progress callbacks through policy hooks before returning results or delegating execution to the client. flowchart TD
A[Session tool call] --> B[Tool definition wrapper]
B --> C[Canonical argument adapter]
C --> D[Policy hooks and preparation]
D --> E{Execution destination}
E --> F[Built-in tool]
E --> G[Client delegation]
F --> H[Progress and session results]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -54, Tests +366. Total +312 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one typed tool-execution convention while preserving cancellation, callbacks, policy preparation, and client ordering; retain the diagnostics investigation as separate work. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR preserves existing behavior rather than repairing a reproduced defect; the separate live failure still has no established cause. Is this the best way to solve the issue? Yes. Directly using the existing typed signature removes redundant decoding without changing supported callers or adding a competing execution path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8476b288c17f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* origin/main: (25 commits) docs(releases): keep the release-notes nav group to version routes (#140353) fix(ui): hide trust wrappers in imported chat history fix(subagents): subagent list building decodes unrelated saved prompts in large session stores (#139540) test(process): share relay startup fixtures (#140345) refactor(doctor): inline GitHub skill discovery inputs (#140343) refactor(ui): share channel status type definitions (#140331) refactor: simplify queue state and infrastructure dispatch (#140311) fix: require saved agent turns before update verification succeeds (#140274) fix(update): keep the service profile when switching to Git (#140263) fix(ui): prevent image avatars overlapping mobile chat (#140341) fix(test): accept release subpages in docs route shape (#140337) refactor(plugins): share uninstall mutation ownership (#140322) refactor(agents): use canonical tool execution arguments (#140280) perf(cli): keep inference metadata and domain help lazy (#140327) refactor(plugins): simplify self-hosted setup results (#140332) refactor(config): reuse parent lookup for unset operations (#140326) fix(plugins): preserve exact installed-index mutation receipts (#140328) test(agents): simplify MCP and LSP boundary fixtures (#140312) fix(ui): preserve literal source previews and copied whitespace (#140306) fix: OpenCode Go/Zen requests are missing the required x-opencode-session header (#137464) ...
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Agent tool dispatch still carries compatibility behavior for a retired private calling convention that current callers no longer use. That leaves cancellation, hooks and client-tool execution harder to audit and maintain. This is a maintainer-requested refactor, not a fix for the separate live-test failure described below.
Why This Change Was Made
Use the existing
ToolDefinition.executesignature directly in the source and client-tool adapters, removing the legacy tuple classifier and its intermediate argument projection. Preserve signal/update forwarding, private fifth-slot preparation control, hooks, and reservation/launch/disposal ordering without adding another compatibility path.User Impact
No intended user-visible behavior, public tool API, configuration, dependency or persistence change. Supported tool calls retain their existing callback, cancellation and execution semantics.
The five-file diff is 54 fewer production lines (+4/−58) and 366 additional net test lines (+409/−43). Test-support reductions are not counted as production savings.
Evidence
208aab3aa6f054fd5eb01218284f898d0863478e, the original ten-file suite passed 151 tests and the candidate passed 161, with no failures or skips. Coverage includes actual preparer/cancellation and client-recorder ordering, plus the current SDK tool-outcome sibling. Native inter-file scheduling differed; this is not a claim of whole-run order equivalence.TS2322schema-type error in the new test.satisfies AgentToolalone was insufficient. The final fixture preserves its concrete TypeBox schema and shallow-spreads only the client JSON-record boundary. This changes top-level identity and drops the non-enumerable TypeBox marker while preserving the enumerable schema and nested values; it is not a type-only or whole-JavaScript-identical change. The complete projection file then passed 10 tests, without weakening assertions or deadlines.node scripts/check-changed.mjs --timedpassed all 29 actions on the final source tree, including core/core-test typechecking and changed-file lint. Delegated gate environment.DONE, exact output-file contents and subprocess completion. The original default test was restored after cleanup. This proves that invocation's package-shaped OpenAI flow, not native Codex or all-provider parity.5b2b2eb857c0bb683899523be00d7c0aa34d4b99each completed four Codex passes, scoped-clean at P2 with no actionable findings. Both retained the original live failure as an explicit limitation. One exact-head launch was refused before inference by the unchanged disk-capacity guard; the authorized launch after capacity recovery completed without a reviewer fallback.The Testbox links identify delegated proof environments. Their cancelled workflow conclusions reflect lease shutdown and are not claimed as passing exact-head GitHub CI checks; the results above are the retained native payload outcomes.
Known limitation: the first live failure remains unexplained. Its terminal agent diagnostic did not establish final CLI output or process completion, and the original catch lost subprocess failure details. The later success neither explains that failure nor proves a hang fix or causal exoneration. The named follow-up is the subprocess failure-evidence/finalization boundary; no production stage markers, timeout extension or retry loop is added here.
Exact-head CI: run 34045812043 completed successfully for signed head
5b2b2eb857c0bb683899523be00d7c0aa34d4b99. Normal native review, hosted prepare and merge remain pending.Maintainer disposition of the live-test risk
The unresolved incident and safe-diagnostics work are tracked in #140314; neither will be declared fixed by this cleanup. The first run remains failed and unexplained. The later real application run reached every original success assertion on the same production afterimage, but is not a causal explanation.
Direct source inspection and an independent challenge confirm that current producers already supply signal third, updates fourth, and an absent/context/private-control fifth value without an
abortedmember. The old decoder takes its canonical branch for those inputs, yielding exactly the identities now destructured. No await, hook, cancellation composition, preparation control, callback, reservation/launch/disposal or post-result finalizer changes. This evidence and the actual successful application path support landing the bounded retirement under the normal gates; CI or review counts alone would not resolve the concern. Any new failure or supported legacy-order caller reopens this disposition.The follow-up specifically requires a deterministic failing synthetic subprocess test for the sanitized diagnostic projection. The successful diagnostic invocation never entered its catch, so it does not prove that failure path. No raw streams, credentials, timeout increase, runtime marker or retry loop is added to this PR.