Repository navigation
fix(codex): reject malformed native tool arguments - #124649
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 10:32 PM ET / August 17, 2026, 02:32 UTC. ClawSweeper reviewWhat this changesThe PR validates OpenClaw-owned native Codex dynamic-tool arguments against their projected JSON schema after preparation and policy hooks, returning bounded failures before execution. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThe repair follows the correct OpenClaw execution boundary and has focused coverage plus reported exact-head packaged proof. Keep it open for a direct Codex runtime/protocol source check that this read-only environment could not perform. Priority: P1 Review scores
Verification
How this fits togetherThe Codex extension projects OpenClaw tools to Codex and routes native tool calls through shared preparation, policy, abort, and capability wrappers. This change enforces the projected schema immediately before OpenClaw-owned tool execution. flowchart LR
A[Codex native tool call] --> B[Dynamic-tool bridge]
B --> C[Argument preparation]
C --> D[Policy and approval wrapper]
D --> E{Schema valid?}
E -->|No| F[Bounded tool error]
E -->|Yes| G[Abort and capability wrappers]
G --> H[Tool execution]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +119, Tests +337, Other 0. Total +456 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep validation private to the Codex bridge, retain its final policy-wrapper position, and confirm the native Codex input contract from the sibling source before merging. Do we have a high-confidence way to reproduce the issue? Yes: current main reaches tool execution without a schema check, and the branch has focused wrong-type, primitive-root, hook-rewrite, direct, and deferred regressions. Is this the best way to solve the issue? Unclear: validation after preparation and hook finalization is the right owner boundary, but the required direct Codex runtime/protocol check could not be completed here. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6c027ad5e1f1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Current head |
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
06c2c5c to
d9b5b47
Compare
|
Pushed a small signed-off maintainer fix in d9b5b477942: Codex native tools now run prepareArguments on the raw input before validation, preserving the existing optional-argument compatibility path and the preparer method receiver. Added regression coverage for null preparation. Local ClawSweeper offline and autoreview are clean; focused tests pass (212/212). |
Signed-off-by: sallyom <[email protected]>
d9b5b47 to
7d62c15
Compare
|
Maintainer Codex-contract check complete for OpenClaw HEAD Codex defines dynamic-tool arguments as arbitrary Verdict: host-side final-argument validation matches the Codex contract; there is no Codex protocol, public API, or config change. The direct-source P1 confirmation is resolved, and the intentional malformed-call tightening is accepted. |
|
Merge-ready at |
|
Merged via squash.
|
Related: #111704
What Problem This Solves
Native Codex dynamic tool calls could execute even when their arguments violated the JSON schema shown to Codex. In the published
2026.8.1-beta.2package,session_status({ sessionKey: 47 })succeeded even thoughsessionKeyis declared as a string.Published-package reproduction: #111704 (comment)
Why This Change Was Made
PR #114461 validates the compact Tool Search path, but native Codex dynamic tools use a separate bridge. This change validates OpenClaw-owned native-tool arguments against the exact normalized schema projected to Codex, after
before_tool_callrewrites and before any side effect.The implementation:
Regression coverage includes wrong types, missing and extra properties, primitive roots, normalized empty-object and repaired
type: nullschemas, direct and deferred surfaces, hook rewrites, same-name tools with different schemas, external MCP ownership, approval metadata, cancellation, and the fully finalized four-argument adapter path that exposed the earlier P1.User Impact
Malformed native Codex tool calls now return a structured validation error instead of reaching execution or silently using tool-specific fallback behavior. Valid calls, ordinary update callbacks, and external MCP tools retain their existing behavior.
Evidence
Exact packaged and public head:
7d62c1549377a98bcee394b4e915616abecf9370Current-head validation:
Exact-head packaged-runtime proof:
sha256:921b8efab8ade0f813cff2583c9311b5be54cc203189052508182509d5a3526cOpenClaw 2026.8.1 (7d62c15)codexopenai/gpt-5.6-solMalformed native call argument:
47Result:
The turn completed with one
session_statuscall, one tool failure, and no successful tool execution.Valid control:
{}The same exact-head runtime returned live session status identifying
OpenClaw 2026.8.1 (7d62c15)and the OpenAI Codex runtime. The turn completed with onesession_statuscall, zero failures, andsession_statuslisted as successfully executed.The sanitized evidence bundle contains the turn summaries, malformed/valid native trace, image identity, and secret scan. Session and run identifiers, quota text, timestamps, and raw authentication material were omitted. TruffleHog scanned the captured envelopes, stderr logs, and sanitized artifacts with zero verified or unverified secrets. The auth-bearing disposable container was removed after capture.
Key artifact hashes:
d3d28a91d883564540121795c62d1a9b008aa9f91e633c49cd2133354262cd37c5b845244230a9b56d8d7caab0b1e59ee29e773946e58bece48cb51fb2c0b9eba03f6f70bfaef8de99efdcaf3594dfdfa2914349787cb2e0f95cf69a53a7b0a3294f4ad126b94b982247be205d153cf79ad8dc0c93971a09f265e531ebd824304a80c2bea202573a4a8dbb0df4a56ac26cd1a0bfede3146cd80bec225419da801b32917d75e78c13c5752af7898e3b0d039bc886bae2d8412df048d0dc1cfafdAI-assisted: Codex helped implement and review this change. The author reviewed the diff, resolved the normalized-schema, validation-bounding, abort-lifecycle, adapter-transport, provider-ownership, and public-SDK-scope findings, and ran the validation above.