Repository navigation
fix(codex): reject unrelated-thread follow-ups at the input hook - #167075
Conversation
Bind hook-side follow-up admission to the sender tree while preserving current-lifecycle recovery. Keep session/conversation restrictions and stop advertising native helpers on restricted turns. Mandatory native target authorization remains a separate dependency blocker.
|
🦞👀 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 October 8, 2026, 1:23 PM ET / 17:23 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch restricts native Codex follow-ups to admitted conversation trees, preserves qualified recovery, and aligns restricted-turn guidance and admin-tool denials with available capabilities. Example: An agent sends a follow-up to an unrelated native root
Review scores
ProductKind: Bug fix · Worth it: Yes Merge readiness✅ Ready for maintainer review The new native final-effect evidence resolves the earlier authority-chain proof blocker. This PR remains useful: current main lacks its receiver-scope checks, and no blocking introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Codex plugin connects OpenClaw agents to Codex's native conversations and subagents. Its input hook checks follow-up authority before native tools submit input to another conversation. flowchart TD
A[Native follow-up request] --> B[OpenClaw input hook]
B --> C[Sender authority and receiver scope]
C --> D[Native conversation metadata]
D --> E[Recheck live lifecycle custody]
E --> F[Admit native input]
C --> G[Reject unrelated target]
E --> G
F --> H[Receiver conversation turn]
Technical reviewBest possible solution: Keep receiver authorization in the existing lifecycle owner and retain conservative native restrictions until independent native target enforcement is qualified. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the missing receiver-tree check in current main; the new native controls demonstrate rejection and preserved allowed behavior after the fix. No reviewer-side runtime execution was performed. Is this the best way to solve the issue? Yes, the repair extends the existing admission and lifecycle owners while preserving recovery and conservative session restrictions, rather than claiming optional hooks provide complete native isolation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bd90c1bbe666. Provenance checked
TestingProof path: shipped entry point. Added test files: 7. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +93, Tests +214, Docs +13. Total +320 across 14 files. View PR surface stats
Review metrics
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 History |
|
Merged via squash auto-merge.
|
…nclaw#167075) * fix(codex): reject unrelated-thread follow-ups at the input hook Bind hook-side follow-up admission to the sender tree while preserving current-lifecycle recovery. Keep session/conversation restrictions and stop advertising native helpers on restricted turns. Mandatory native target authorization remains a separate dependency blocker. * test(codex): expect early foreign-root rejection
What Problem This Solves
Native Codex follow-up admission can mistake a resolvable thread ID and compatible model source for authority to address that thread.
User Impact
OpenClaw's input hook rejects unrelated native receivers and revalidates live authority after preparation, while preserving same-tree follow-ups, saved-child recovery, and lifecycle-qualified parent rotation. Restricted turns stop advertising unavailable native helpers.
This is bounded hook-side hardening, not full helper restoration. Default child restrictions remain enabled. No Codex dependency, native protocol selection, permission policy, or deployed runtime is changed.
Why This Change Was Made
The receiver lifecycle owner rejects known unrelated targets before metadata reads. Collected children require native parent lineage, requested without turn history. Native metadata and current lifecycle custody are checked again after asynchronous preparation.
Only four OpenClaw admin/status denials are added to the audited safe-deny set. Session/conversation denials, unknown denials, finite allowlists, and delegation-depth restrictions remain conservative. Optional hooks do not establish mandatory native isolation.
Related: #157684 by @roboclaw-bot retains distinct value. I inspected its full diff: the restricted-policy predicate overlaps; its broader V1/V2-native wording, discovery, and waiting guidance are not incorporated or superseded here. This patch additionally covers workspace-only restrictions and receiver admission. #153902 and #160700 concern different input-policy and CLI-tool boundaries.
Evidence
Current head:
2edb9bb6bd183d4da66e54a709f07ca057a1e0eb(14 files). Production code and the original 13-file candidate are identical to formally reviewedc90367669a1858b9dad3e308bed6f7ccc4cb51cc; the only subsequent change corrects one sibling test assertion for earlier foreign-root rejection.task_startedevents and accepted user input in native persisted records, not model claims or request counters. Nativewaitjoins work; saved-child proof additionally verifies successful nativeclose_agentandresume_agentoutputs before the accepted follow-up.Native executable SHA-256:
12eb3e81114588aca3b7998f4f19e8997b056aca08e57a7ca7c8a3ec8c652aad.Final native proof invocations passed in 26.59s (four controls), 27.56s (two rotation controls), and 26.72s (saved-child control), including import/transform overhead. The earlier focused target/recovery runners took 84.16s and 51.34s. Proof-fixture failures were investigated and corrected; they are not counted as passing evidence.
The first CI run (https://github.com/openclaw/openclaw/actions/runs/37813653535) exposed one obsolete sibling assertion: foreign-root admission now correctly rejects before receiver-turn binding. The signed test-only correction updates that expected denial. The complete native-hook relay retention suite passes 6/6 (86.55s Vitest / 89.95s runner).
Current-head CI: https://github.com/openclaw/openclaw/actions/runs/37815283027 (in progress when recorded). Required GitHub checks and native merge admission remain enforced.
Redacted actual-native receipt excerpts
The following fields are extracted from the successful fixture receipts; unrelated metadata, local paths and ephemeral thread identifiers are omitted. The denied relay path has no Gateway fallback, so the production CLI emits its generic explicit deny response, which the native dispatcher records as blocked. No claim of native hook-failure isolation is made.
[ { "mode": "unrelated", "targetTurns": 0, "targetHasInput": false, "nativeHookStatuses": [ "blocked" ], "relayResponses": [ { "exitCode": 0, "stdout": "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Native hook relay unavailable\"}}\n", "stderr": "native hook relay unavailable: isolated proof has no Gateway fallback\n" } ] }, { "mode": "same-tree", "targetTurns": 1, "targetHasInput": true, "nativeHookStatuses": [ "completed" ], "relayResponses": [ { "exitCode": 0, "stdout": "", "stderr": "" } ] }, { "mode": "revoked", "targetTurns": 0, "targetHasInput": false, "nativeHookStatuses": [ "blocked" ], "relayResponses": [ { "exitCode": 0, "stdout": "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Native hook relay unavailable\"}}\n", "stderr": "native hook relay unavailable: isolated proof has no Gateway fallback\n" } ] }, { "mode": "collected-child", "targetTurns": 1, "targetHasInput": true, "nativeHookStatuses": [ "completed" ], "relayResponses": [ { "exitCode": 0, "stdout": "", "stderr": "" } ] }, { "mode": "rotated-parent", "targetTurns": 1, "targetHasInput": true, "nativeHookStatuses": [ "completed" ], "relayResponses": [ { "exitCode": 0, "stdout": "", "stderr": "" } ] }, { "mode": "rotated-denied", "targetTurns": 0, "targetHasInput": false, "nativeHookStatuses": [ "blocked" ], "relayResponses": [ { "exitCode": 0, "stdout": "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Native hook relay unavailable\"}}\n", "stderr": "native hook relay unavailable: isolated proof has no Gateway fallback\n" } ] }, { "mode": "saved-child", "targetTurns": 1, "targetHasInput": true, "nativeHookStatuses": [ "completed" ], "relayResponses": [ { "exitCode": 0, "stdout": "", "stderr": "" } ] } ]Limitations
This proves the bounded hook-to-native effect and recovery contract in isolated local state, not an authenticated or deployed Gateway flow. It does not qualify native isolation when the hook itself is absent or fails. Full helper restoration still needs mandatory native target authorization and a separately qualified official artifact; this PR deliberately retains session-send restrictions until then.