Skip to content

fix(codex): explain when a resumed worker has a different parent - #206114

Merged
freeqaz-openai merged 1 commit into
mainfrom
fix/codex-worker-parent-refusal
Nov 26, 2026
Merged

freeqaz-openai merged 1 commit into
mainfrom
fix/codex-worker-parent-refusal

Conversation

@freeqaz-openai

Copy link
Copy Markdown
Contributor

What Problem This Solves

After Codex opens a different native parent thread, resume_agent can find a saved worker but send_input cannot use it. The parent sees “Native hook relay unavailable” even when the relay is healthy. That gives a running Goal the wrong reason to retry.

User Impact

The parent sees “Cannot verify this worker belongs to the current parent. Check the original task before assigning new work.” The worker receives no input. A successful resume alone does not authorize a follow-up.

Why This Change Was Made

Keep the rejection at the monitor's existing parent check. Share its error type across copies of the same plugin build and translate only that error into a PreToolUse denial. Recheck admission before returning the reason. Other errors propagate as before. No permission, persistence, or configuration changes.

Evidence

Isolated Linux Gateway and Codex 0.164.0 with synthetic inference. Two runs started from the same saved chat, goal, two completed worker turns and history. Both changed the synthetic connection credential. The second build added this patch to the first build on 82b682c with goal-handling fixes backported.

Observation Before After
Parent thread changed, resume accepted Yes Yes
Message seen on send Native hook relay unavailable Worker ownership denial above
Worker history after refusal Same 2 completed turns Same 2 completed turns

With a stable parent, the original worker answered a third task, automatic pursuit used its answer, and the goal completed. After a cold return the worker answered a fourth. The test matched the tool catalog across both builds. This diagnostic does not restore authority when a parent changes.

The registered relay regression failed on the original lineage exception. Both focused suites passed (25 tests, 69.62 s with one worker). The changed case took 140 ms. With the relay importing a second copy of the input module, the six relay tests passed again (164.58 s including a cold build). Formatting, diff checks and type-aware lint against SDK source passed. The isolated checkout reused older dependencies. Package-boundary lint reported the same four unresolved SDK type errors on both revisions.

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 26, 2026
@clawsweeper

clawsweeper Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

Translate a resumed worker’s parent-lineage mismatch into a specific tool denial instead of a generic relay-unavailable error.

Example: A parent resumes worker 00000000-0000-4000-8000-000000000042 whose saved metadata names old-parent, then calls send_input.

  • Before: The call reports “Native hook relay unavailable.”
  • After: The call reports “Cannot verify this worker belongs to the current parent. Check the original task before assigning new work.”

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and has a relevant relay regression plus passing exact-head CI, but required runtime proof is not inspectable.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A parent receives a relay-outage explanation when a resumed worker actually fails the existing ownership check, encouraging the wrong recovery action.
Reason: A specific denial explains the actual failure without expanding worker authority, adding configuration, or changing recovery policy.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a misleading diagnostic while preserving the existing worker ownership check; no actionable code defect was found.

Reviewed head: 08caef83e062cc3d5ac2c18a8974a85de7ddce43

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Attach a redacted Gateway/Codex output capture showing the new denial after parent rotation and no additional worker input or turn; the body reports base-red/head-green regression results but supplies no execution capture.
Agent review details

How this fits together

The Codex plugin’s native hook relay asks the subagent monitor to prepare worker input, then returns an admission result that Codex consumes before executing the tool.

flowchart TD
  A[Parent send_input] --> B[Native hook relay]
  B --> C[Subagent monitor]
  C --> D[Worker lineage check]
  D --> E[Shared lineage error]
  E --> F[PreToolUse denial]
  F --> G[Codex blocks worker input]
Loading

Technical review

Best possible solution:

Retain the existing lineage rejection and report its specific cause through the relay’s established denial response.

Do we have a high-confidence way to reproduce the issue?

Source shows the saved-worker lineage exception escaping relay admission, and the PR reports a matching Gateway reproduction; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change is appropriately narrow: the monitor still owns admission, the relay translates one typed failure, and the existing build-state helper preserves error identity across duplicate plugin modules.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 279aeec1529f.

Provenance checked

  • Native worker lineage rejection keeps the original intent (9ed1b9d: Reject unrelated native receivers rather than treating a resolvable thread ID or compatible provider as authority.)
  • Relay model-input admission keeps the original intent (17d2faf: Apply the admitted model source and role model limits to native child input and restored workers.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 17d2faf adds extensions/codex/src/app-server/native-hook-relay.ts:315 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 17d2faf6b710; files: extensions/codex/src/app-server/native-hook-relay.ts)

PR surface

Source +17, Tests +18. Total +35 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 32 15 +17
Tests 1 19 1 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 51 16 +35

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide a redacted runtime capture from the reported parent-rotation run.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 26, 2026, 2:18 PM ET / 19:18 UTC.

@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

Redacted Gateway/Codex output for 08caef83. Each row projects fields recorded when the synthetic parent received the tool result. This used the backported builds described above. The refusal flags test for these strings in the output.

  • transportRefusal matches “Native hook relay unavailable”.
  • ownershipRefusal matches “Cannot verify this worker belongs to the current parent. Check the original task before assigning new work.”
{"build":"before","parentChanged":true,"resume":"accepted","send":"untyped-output","transportRefusal":true,"ownershipRefusal":false,"afterUnknown":{"count":2,"current":true}}
{"build":"after","parentChanged":true,"resume":"accepted","send":"untyped-output","transportRefusal":false,"ownershipRefusal":true,"afterUnknown":{"count":2,"current":true}}

The harness labels a send without a submission ID untyped-output. It then reads the original worker using thread/turns/list. current means the same ordered turn IDs, all completed. Both runs had exactly two turns and no third submission ID. No retry.

The hosted extension job passed in 361 seconds for the whole job.

@freeqaz-openai
freeqaz-openai merged commit 1fdb6b1 into main Nov 26, 2026
115 of 116 checks passed
@freeqaz-openai
freeqaz-openai deleted the fix/codex-worker-parent-refusal branch November 26, 2026 19:21
@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant