Skip to content

Delete the runtime's codex-shaped recovery regexes and account-restart set (WS4 L2) - #2236

Closed
SawyerHood wants to merge 1 commit into
bb/ws4-runtime-recovery-process-topology-skills-pi-thr_qdx8ashimgfrom
bb/ws4-l2-delete-runtime-recovery-regexes-thr_qdx8ashimg
Closed

Delete the runtime's codex-shaped recovery regexes and account-restart set (WS4 L2)#2236
SawyerHood wants to merge 1 commit into
bb/ws4-runtime-recovery-process-topology-skills-pi-thr_qdx8ashimgfrom
bb/ws4-l2-delete-runtime-recovery-regexes-thr_qdx8ashimg

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

WS4 layer 2 of 7, stacked on #2235 (L1). Design: ideal-state-provider-api.md §7 "Deleted from core" — the codex regexes, the account-restart set, and the rename retry.

What was wrong

After L1 every condition the runtime used to recognize by matching codex prose arrives as a typed provider/recovery hint, so the regexes and the provider-id guards they justified were dead weight that still ran: CODEX_ARCHIVED_SESSION_ERROR_PATTERN gated the unarchive-and-retry beside the hint, the runtime retried renames a bridge had already retried, and shouldRestartCodexThreadAfterEvent re-classified every terminal codex error by text to schedule a process restart the codex bridge now performs itself. The steer path still needed isAcpProviderId to read the ACP bridge's NO_ACTIVE_TURN as a stale steer.

What changed

Deleted from packages/agent-runtime/src/runtime.ts (each with its L1 counterpart):

Deleted symbol Covered by
CODEX_ARCHIVED_SESSION_ERROR_PATTERN, isCodexArchivedSessionError sessionArchived on the rejection (error.data.recovery); sendCommand now switches on the hint alone
CODEX_EMPTY_ROLLOUT_RENAME_ERROR_PATTERN, CODEX_RENAME_RETRY_DELAYS_MS, sendRenameWithRolloutRetries, SendRenameWithRolloutRetriesArgs the codex bridge's own 50/200 ms ladder (sendMaintenanceRequestWithRetries); the runtime sends thread/name/set once
CODEX_ACCOUNT_RESTART_PROVIDER_ERROR_CATEGORIES, CODEX_ACCOUNT_RESTART_PROVIDER_ERROR_TEXT_PATTERN, shouldRestartCodexThreadAfterEvent, restartCodexThreadForNextTurnIfNeeded, codexThreadsRequiringAccountRestart the codex bridge rebuilds its app-server child before the next turn (rebuildBeforeNextTurnReason) and raises authRequired/rateLimited; the generic restartRecommended action stays for bridges that cannot self-heal
the isAcpProviderId(pid) && code === NO_ACTIVE_TURN steer branch the generic staleTurn branch
imports isAcpProviderId, ProviderErrorCategory, BRIDGE_JSON_RPC_ERRORS unused after the above

RestartCodexThreadForNextTurnArgs is renamed RestartThreadBridgeArgs (it now only serves restartThreadBridgeIfRecommended). The CODEX_PROVIDER_ID guards that remain (resolveProviderProcessKey, isThreadScopedCodexProcess, the pre-experiment idle-reap gate) belong to the per-thread process lane and go in L3.

Single-site exception in plugins/provider-acp/src/bridge/bridge.ts (coordinator-approved): the turn/steer NO_ACTIVE_TURN rejection now carries data: { recovery: { kind: "staleTurn", retryable: false } }. Nothing else in that plugin changes; the error code stays for the wire.

Ratchet: scripts/provider-literal-baseline.json 148 → 142 (runtime.ts 12 → 6).

Not a wire change: no HOST_DAEMON_PROTOCOL_VERSION bump (nothing between server and daemon moved) and no PROVIDER_BRIDGE_PROTOCOL_VERSION bump (the ACP data is the optional field L1 added).

How you verified

Tests:

  • Removed the three runtime tests that pinned the deleted behavior — retries a Codex rename while its new rollout file is still empty, stops retrying a Codex rename once its rollout stays empty (replaced by does not retry a rename: the bridge owns the not-ready-rollout ladder, one thread/name/set on the wire), and the two account-restart tests in runtime.process-lifecycle.test.ts (their counterparts: bridge.recovery.test.ts in the codex plugin and the restartRecommended cases in runtime.recovery.test.ts).
  • maps a bridge no-active-turn error to a stale steer now sends the staleTurn hint (the ACP bridge's shape) and is no longer provider-gated.
  • The L1 suite runtime.recovery.test.ts runs under provider id fake, so it already proved the typed path with the text gates unable to fire; it is unchanged and green.

Oracle (--concurrency 4): typecheck 9/9; tests agent-runtime 450, provider-acp 196, provider-codex 201, scripted-echo 1, host-daemon 555 — green. Parity acp-cursor 10 passed / 1 skipped, zero diffs (the data rides an error response, never an event). A4: 307 threads, 93,534 rows, zero diffs. Ratchet --base origin/main: 142 ≤ 148, baseline written.

Part of the provider-plugin migration (WS4). L3 collapses the codex per-thread process lane.

AGENT GENERATED: by Claude Opus 5

…t set (WS4 L2)

The typed provider/recovery hint (L1) covers every path these matched:
sessionArchived replaces CODEX_ARCHIVED_SESSION_ERROR_PATTERN, the codex
bridge's own rename ladder replaces CODEX_EMPTY_ROLLOUT_RENAME_ERROR_PATTERN
and CODEX_RENAME_RETRY_DELAYS_MS, and the bridge's child rebuild plus the
authRequired/rateLimited hints replace the account-restart set and
restartCodexThreadForNextTurnIfNeeded. The ACP-gated NO_ACTIVE_TURN steer
branch becomes the generic staleTurn branch; the ACP bridge attaches the
hint to that one emission. Ratchet baseline 148 → 142.

Co-Authored-By: Claude <noreply@anthropic.com>
@SawyerHood

Copy link
Copy Markdown
Collaborator Author

Coordinator review — WS4 layer 2 (#2236)

PASS against REVIEW-GATE.md. Do not merge: the stack accumulates until the full migration is done.

Verified on the branch

Oracle (reported): typecheck 9/9; agent-runtime 450, provider-acp 196, provider-codex 201, host-daemon 555 green; parity acp-cursor 10/0; A4 307 threads, zero diffs.

AGENT GENERATED: by Claude (coordinator)

@SawyerHood SawyerHood closed this Aug 21, 2026
@SawyerHood
SawyerHood deleted the bb/ws4-l2-delete-runtime-recovery-regexes-thr_qdx8ashimg branch August 21, 2026 21:41
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.

1 participant