Skip to content

Recover verified native capacity rejections (T65) - #241

Merged
erickb336 merged 4 commits into
mainfrom
codex/t65-capacity-rejection
Oct 15, 2026
Merged

erickb336 merged 4 commits into
mainfrom
codex/t65-capacity-rejection

Conversation

@erickb336

@erickb336 erickb336 commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #240
Sage task T65

When native Codex refuses a spawn at its agent limit, Sage can now release that rejected reservation and admit a fresh retry. Existing children and their completion history stay intact.

The protected transcript reader accepts the exact Codex 0.160.0 preflight result collab spawn failed: agent thread limit reached, including requests that inherit their model. Session, owner, issuer, turn, call, argument hash, server authorship, and no-child checks remain unchanged. Unknown-model recovery keeps its existing behavior. Other error text, duplicate or conflicting records, child-start evidence, spawn results, and saved bindings cannot use this recovery path.

Source changes are in packages/sage-codex/runtime/identity.mjs and its documentation. Generated plugin files come from npm run build. The existing failure reconciler consumes the new evidence; this adds no orchestration API or Claude hook changes.

Verification on bdd90dc

All test commands used fake ps, pgrep, and kill first on PATH. In the commands below, SAGE_FAKE_PROCESS_BIN names that prepared test directory. Native validation also used the synthetic machine identity guard.

  • npm run build — built 306 files.
  • npm run check — all checks pass.
  • env -u NODE_TEST_CONTEXT PATH="$SAGE_FAKE_PROCESS_BIN:$PATH" npm test -- --test-concurrency=1 — exit 0; 1,378 tests, 1,378 pass, 0 fail, 0 cancelled, 0 skipped.
  • env -u NODE_TEST_CONTEXT PATH="$SAGE_FAKE_PROCESS_BIN:$PATH" node --test --test-name-pattern='T65:|T63:|native failed dispatch' scripts/codex-server.test.mjs — 21 tests, 21 pass, 0 fail. This includes the four new capacity groups, existing unknown-model controls, and merged interrupted-run controls. Production behavior is unchanged by the subsequent probe-only repairs and reader comment correction.
  • env -u NODE_TEST_CONTEXT PATH="$SAGE_FAKE_PROCESS_BIN:$PATH" SAGE_TEST_MACHINE_ID=native-fixture node scripts/probe-codex-lifecycle.mjs --sage-capacity-rejection — exit 0, verified true, temporary profile removed. Native limit one and Sage limit two: three reservations, one rejected dispatch, two bindings, two completed children. The first completion remains intact after native residency eviction; the fresh retry completes. Native output reports 12 root requests, five child requests, zero failed turns, unexpected items, malformed events, or rejected fixture requests.

The native check uses the actual supported CLI with simulated model responses. It does not prove real-model behavior or installed automatic Sage.

Regression and negative-control proof

A detached origin/main worktree at 4162ac3bf41951018f0373ca551f363dc6cc6d90 received the exact final test file. Running the T65: selector produced four tests, zero pass, four fail. These are behavioral failures: main records no failure receipt and refuses the eligible retry. The four groups cover inherited/explicit models and exact release; forged, changed, duplicate, and conflicting evidence; live-child ambiguity and off-mode history; and reconciliation before the next spawn.

An isolated negative control changed only the exact capacity-error comparison to a prefix comparison. The text-variant test failed with 1 !== 0: the altered reader incorrectly released a reservation for extra error text. The production comparison remains exact. All proof worktrees and copies were removed.

Native fixture repairs

Early checks exposed fixture defects, which were diagnosed before another run:

  • Removed a duplicate native capacity configuration alias.
  • Added a deterministic child-tool barrier so the first child is bound before its response is held.
  • Treated absent precompletion history as zero entries without changing final positive counts.
  • Checked the actual native residency contract: cap one evicts the completed first resident before creating its replacement. The probe now proves the first native completion before retry, preserves its exact Sage completion, and checks the final resident retry separately.
  • Used strict per-child hook identity checks for this two-child route instead of the generic single-child positional check.

Final validation and limits

Two independent code, security, and QA review cycles are clean on the final head. The full serial repository suite passed all 1,378 tests. Exact-head CI run 38781017736 also passed: tests 1378, pass 1378, fail 0, cancelled 0, skipped 0. Required-hook failure recovery, active-child restart, cross-session transfer, and automatic Sage activation remain outside this change.

@erickb336
erickb336 marked this pull request as ready for review October 15, 2026 18:05
@erickb336
erickb336 merged commit 450ce5c 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 agent-capacity spawn rejections (T65)

1 participant