Skip to content

Recover rejected Codex follow-ups and preserve retry ownership (T2) - #244

Merged
erickb336 merged 6 commits into
mainfrom
codex/t2-followup-capacity-evidence
Oct 15, 2026
Merged

erickb336 merged 6 commits into
mainfrom
codex/t2-followup-capacity-evidence

Conversation

@erickb336

@erickb336 erickb336 commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #242
Sage task T2 (the Codex task namespace)

A native follow-up can fail while Codex restores an evicted child at its thread limit. Sage now records that exact rejected attempt, releases its reservation, and permits a fresh prepared retry on the original child. The failed attempt and completed predecessor remain in history.

The reader accepts only the captured Codex 0.160.0 result collab tool failed: agent thread limit reached. It verifies sender, owner epoch, call, turn, recipient, predecessor, message hash, and argument hash. Delivered messages, successful callbacks, and bindings block failure recovery. Core atomically excludes binding and failure for the same attempt. Both predecessor guards permit retry only after a verified continuation failure; initial-spawn failure remains separate.

The child's first tool can arrive before its parent's successful result. A deterministic test reproduced immediate refusal. The policy now waits only for an exact pending parent call plus verified recipient delivery, and requires both proofs before binding or evaluating the tool. It makes at most 40 delayed reads, 25 ms apart. Timeout, mode changes, interruption, conflicting evidence, or a lost claim refuse. Off-mode waiting retains the original assignment, checked before publication.

Validation

Every test command used fake ps, pgrep, and kill first on PATH, with NODE_TEST_CONTEXT removed from the launching environment. Attack inputs went to parsers only.

  • npm run build: built 306 files.
  • npm run check: all checks pass.
  • Focused server/provider selection: 23 substantive groups passed. The combined invocation reported 24 because its name filter also included an empty helper-file wrapper; the helper ran separately without filtering.
  • node --test scripts/fixtures/codex-native/fresh-control.test.mjs: 1 passed, including six invalid-output controls.
  • node --test scripts/fixtures/codex-native/policy-diagnostic.test.mjs: 2 passed, including symlink and size limits.
  • Detached origin/main at 450ce5c with final test files: 14 groups, 2 pass and 12 fail. Eight provider groups fail behaviorally; four core groups fail because the new API is absent. The two existing safety controls pass main. Disposable mutants that remove delivery/success conflict checks, retry every error, or remove the native first-tool assertion each fail the intended control.
  • The pending-parent barrier failed before its repair. The off-mode lost-claim test failed on 82db976. Both pass after repair. Mock timers control schedules; no tight wall-clock assertions.
  • node scripts/probe-codex-lifecycle.mjs --sage-followup-capacity-recovery on 0d49693: actual CLI 0.160.0, simulated model responses, verified true and cleanup true. Native capacity one and Sage capacity two produced one rejection and a successful same-child retry after the other child completed. Final evidence: 4 reservations, 1 failure, 3 bindings, 3 completions, 0 reports. The failed attempt never bound. The fresh child's first tool returned exactly {"resources":[]}. Actual counts: 18 root requests, 7 child requests, 26 response requests; zero unexpected/failure counters.
  • npm test -- --test-concurrency=1: 1,392 tests passed; zero failures, cancellations, skips, or todos. Process exited 0.
  • GitHub CI run 38794102681 on the same head: 1,392 tests passed, zero failed.

Focused selector: T2 |continuation failure core|native failed dispatch|native follow-up dispatch consumes|native capacity on scripts/codex-server.test.mjs and scripts/providers.test.mjs. Main selector: T2 |continuation failure core.

Diagnostics and limits

Baseline capture 74966ae retained the rejected reservation. An early recovery probe denied the fresh child's first tool. Both failed and passing diagnostic captures show the child call before parent success publication. Terminal replay did not identify the erased exception; the deterministic pending-parent test independently established the ordering defect. The failed capture remains a failed check.

The fixture now requires the first tool's successful output before completing the child. It stores bounded diagnostics only inside its disposable profile. Profiles and proof worktrees were removed. No production policy is disabled for the probe.

This does not accept arbitrary errors, mark tasks or runs successful, transfer sessions, restart active children, or enable installed Sage/autopilot. Real-model behavior and installed-session activation remain unverified. Claude-owned task/state operations are unchanged. Two independent code, security, and QA review cycles are clean on 0d49693. CI run 38794102681 passed on this exact head: 1,392 tests passed, zero failed.

@erickb336
erickb336 marked this pull request as ready for review October 15, 2026 19:40
@erickb336
erickb336 merged commit bdd7aa2 into main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recover verified native follow-up capacity rejections

1 participant