Repository navigation
fix(codex): stop advertising unavailable subagent tools - #157684
roboclaw-bot wants to merge 1 commit into
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. |
Leave native collaboration discovery and calling conventions with Codex; emit dynamic discovery guidance only for actual deferred OpenClaw tools. Suppress native delegation guidance on policy-restricted turns without hiding offered OpenClaw delegation. Co-authored-by: vincentkoc <[email protected]>
dcb1812 to
0cbc79a
Compare
|
Codex review: needs changes before merge. What this changesThe PR aligns subagent instructions with effective tool restrictions and leaves native collaboration discovery and calling conventions to Codex. Example: An agent runs with a restricted tool policy allowing only read
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains This PR retains useful work: current main fixes restricted-turn advertising but still prescribes native discovery and waiting conventions that differ between Codex backends. No actionable introduced defect was found; overlapping main changes still require synchronization. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Codex plugin translates OpenClaw agent settings and available tools into requests and instructions for Codex's agent runtime. This change keeps those instructions consistent with the tools the runtime exposes. flowchart TD
A[Agent settings and tool policy] --> C[Codex request builder]
B[Available OpenClaw tools] --> D[Instruction builder]
A --> D
D --> E[Policy-aware delegation guidance]
E --> C
C --> F[Codex runtime]
F --> G[Native collaboration tools]
Technical reviewBest possible solution: Keep native collaboration instructions with Codex and describe only actually offered OpenClaw tools in the existing prompt owner. Do we have a high-confidence way to reproduce the issue? Yes, the request-builder regression establishes the original policy/prompt contradiction, and inspected current-main and Codex source establish the remaining discovery-contract mismatch. No reviewer-side runtime execution was performed. Is this the best way to solve the issue? Yes, the patch repairs the existing instruction owner without changing permissions or adding another discovery mechanism; integration must preserve subsequent main changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a73ef559b23a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +18. Total +18 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 9, 2026, 1:34 AM ET / 05:34 UTC (Revision 3). |
What Problem This Solves
Fixes Codex-backed agents receiving misleading subagent instructions: native collaboration tools were described as deferred OpenClaw tools, and policy-restricted turns still recommended native delegation that their request configuration disabled.
User Impact
Subagent guidance now follows the tools and calling conventions exposed by Codex. OpenClaw still describes its actual deferred tools, preserves offered OpenClaw delegation, and retains its background-completion handoff. No permissions, model defaults, configuration schema, or runtime delegation capabilities change.
Why This Change Was Made
Codex owns native collaboration discovery and invocation. Its v1 and v2 backends do not share the same exposure contract: v2 defaults to direct-only collaboration tools. OpenClaw should not prescribe one backend’s discovery convention to the other.
The prompt owner now honors the existing policy-restricted flag and limits dynamic-discovery guidance to registered deferred OpenClaw tools. Native follow-up and wait conventions remain with Codex instead of hardcoding tool names.
Reported by Vincent Koc.
Work sessions
Evidence
Three final regression cases fail against the pre-fix production modules and pass against the repair: restricted native guidance, preserved offered OpenClaw delegation, and native-versus-dynamic discovery. The original defects were captured before production edits; an independent actual request-builder probe corroborated the configuration/prompt contradiction.
Final focused prompt and thread-lifecycle coverage: 253 tests passed across two files. Command:
node scripts/run-vitest.mjs extensions/codex/src/app-server/thread-prompt.test.ts extensions/codex/src/app-server/thread-lifecycle.test.ts --maxWorkers=1; warm-run wall 16.51 seconds; final refreshed-head runner 43.21 seconds (Vitest 41.59 seconds, including compiler artifact preparation). Added cases exercise the actual request builder and preserve offered OpenClaw delegation; existing native/deferred/yield cases cover the calling-convention change.Independent Codex autoreview: scoped-clean through P3, no actionable findings. The subsequent base-only refresh retained an identical patch, verified with
git range-diff.Full changed-surface gate passed on final head
0cbc79a2f33b78a11c784d25b5d7d9d6bf1a842e, including extension production/test typechecks, lint, import-cycle and repository guards.Production delta: +12/-12 (net zero). Tests: +40/-22.
Inspected pinned Codex 0.155.1: native collaboration instructions, direct-only v2 default, and tool registration.
Exact-head runtime build (
pnpm build qaRuntime) and real Gateway → Codex subagent probe passed on a fresh Blacksmith Testbox: 72.135 seconds for the test, 83.31 seconds for Vitest. The probe covers initial spawning, two additional native-shell assignments on the same child, distinct durable task results, and retained child history. Settings: API-key authentication, low effort, one child; testruns gateway agent turns through the plugin-owned Codex app-server harnessinsrc/gateway/gateway-codex-harness.live.test.ts.Exact-head Testbox lease provenance:
tbx_01m3awenxktf3vw96pcv12fprn; runner exit 0. The wrapper verified the source commit and materialized tree before execution. Both task-owned leases were stopped. Lease-workflow cleanup is not the test verdict.Build context: the original baseline had an unrelated TS2459 in the npm-pack helper. Its existing fix, #157659, has merged. This branch was refreshed onto that landed prerequisite, without duplicating its change; tests, full changed checks, and the live probe were rerun on the refreshed head.
Scope: the baseline’s OpenClaw spawn/completion checks and native Codex child/follow-up checks passed with the tested target and control configurations. These checks do not establish a universal model-specific regression. This PR fixes the reproduced instruction-contract defects, not an unproven model-specific runtime issue.