Repository navigation
fix(server): opt-in fail-closed policy for codex thread resume - #2
Conversation
A requested provider-thread resume currently falls back to a fresh thread on any recoverable error, so a failed resume is accepted as successful continuity. Add an opt-in 'fail-closed' Codex resumeFailurePolicy (per provider instance) that propagates the resume failure instead of starting a replacement thread. Default behavior is unchanged.
1ba1ee7 to
f014905
Compare
nullStack65
left a comment
There was a problem hiding this comment.
A3V independent composed review — T3 fork #2 (COMMENT, not approval)
Reviewed exact head f014905ed1c73600310accc6d2bc378c9d5c7840 against fork main e6ae764f47d678b96f4a1b2c8c76eedf1a342e26 (1 ahead / 0 behind).
Independently reproduced:
- Six-file scope exactly as required; all six blob SHAs identical to the pre-refresh A3 head
1ba1ee7…(patch-equivalent). - Focused Vitest: 151 passed / 4 files (
CodexSessionRuntime,serverSettings,ProviderInstanceRegistryLive,CodexAdapter). - Contracts suites: 427 passed / 24 files.
@t3tools/contractsandapps/servertsc --noEmit→ EXIT 0, no errors.- Targeted
vp lint/vp fmt --checkon changed files → PASS (2 pre-existingno-inline-schema-compilewarnings inserverSettings.test.ts:1304-1305, not on A3-added lines). - Equivalent
git diff --check: reverse-apply with--whitespace=error-all→ clean; no conflict markers. resumeFailurePolicytyped/bounded (Schema.Literals), defaultingfallback-to-new-thread; only path tothread/startafter a resume request is the non-strict branch; verified no otherthread/startproducer in server source; strict failure exitsmakeCodexSessionRuntime.startbeforestatus:"ready",resumeCursor, andsession/ready, closing the race.
Disposition for this repo: T3_STRICT_POLICY PASS, STOCK_DEFAULT_PRESERVED PASS, STRICT_NO_THREAD_START PASS, T3_SETTING_PROPAGATION PASS, T3_BASE_COMPOSITION PASS, CONTINUITY_ACCEPTANCE_ORDERING PASS.
Exact-head CI still QUEUED (Test, Test Server 1-3, Check, Rust, Release Smoke, Mobile Native Changes, Native fingerprint diff). No dispatch/rerun performed.
Cross-repo note (not a T3 defect): the agent-config successor contract currently cites the pre-refresh head 1ba1ee7…, not this head. See agent-config pingdotgg#227.
Thread transfer impact
This comment will update automatically after the next completed run. |
|
START: Resume PR #2 main merge / port fix at f014905; merge origin/main 96c7bf6, preserve default fallback, port opt-in typed fail-closed resume, focused tests and package typechecks only; push and ready if focused tests pass. No merge of PR. Connectivity probes both HTTP 200; swap free 772.50 MB. Fresh main has no resumeFailurePolicy and openCodexThread still unconditionally catches recoverable errors into thread/start. Direct approved codex/gpt-6.1-sol execution; no children. |
|
CHECKPOINT: HEAD f014905, merge of 96c7bf6 in progress; single conflict resolved preserving governedSkills no-resume path and forwarding resumeFailurePolicy. Scope relative main: seven files (original six plus settings contract tests). Focused five-file run: 320 passed, one isolation fixture failed because macOS temp path contains symlinks; bounded rerun uses TMPDIR=/private/tmp. Formatting seven files PASS. Contracts package typecheck exit 0 (suggestions only); server package typecheck underway. No full suite/build. Dependency install completed; discarded only install-generated lockfile deprecation metadata. |
|
CHECKPOINT: Merge commit 6c5c903 created with parents f014905 and 96c7bf6 (no rebase). All 321 focused tests passed across five files: initial run 320/321, sole isolation fixture then passed with canonical TMPDIR=/private/tmp. Contracts typecheck PASS, targeted lint PASS with existing warnings, targeted format PASS. Server typecheck still in progress. Commit hook formatted staged merge files; final scope compared with main is being verified. No full test suite/build. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
CHECKPOINT: Pushed 6c5c903 to origin/a3s/v0042-strict-resume with ordinary fast-forward push. PR body appended with Model: codex/gpt-6.1-sol and Task type: main merge / port fix. gh pr ready 2 succeeded; readback verifies exact head, isDraft=false, mergeable=MERGEABLE and both provenance lines. Final scope remains seven files relative main, clean worktree. No PR merge. Server package typecheck still running; no full local suite/build. #2 |
|
RESULT: PORT PUSHED / READY; LOCAL SERVER TYPECHECK INCOMPLETE. PR #2 at exact head 6c5c903, ordinary merge of main 96c7bf6 into branch a3s/v0042-strict-resume, no rebase/force-push/PR merge. Readback confirms isDraft=false and mergeable=MERGEABLE; required model/task provenance appended. Seven files relative main: CodexAdapter.ts, CodexSessionRuntime.ts, CodexSessionRuntime.test.ts, ProviderInstanceRegistryLive.test.ts, serverSettings.test.ts, contracts/settings.ts, contracts/settings.test.ts. All 321 focused tests passed (320 initial plus one isolation fixture passing with canonical TMPDIR=/private/tmp); contracts package typecheck exit 0; targeted lint and formatting passed (existing lint warnings). Server package typecheck has not completed after over fourteen minutes, peak native compiler footprint 5.2 GB. No full suite/build. Native compiler PID 75141 remains active under exec session 51726, log /tmp/t3-pr2-server-typecheck.log; no success claimed. Session input interrupt did not stop it. AGENTS process rule permits killing only a PID captured at spawn or a confirmed owned port; compiler PID was discovered afterward, so no PID-based kill performed. Remaining obligation: collect server typecheck outcome or stop it through supported session control/explicit owner authorization; full GitHub CI remains unverified. secret_scan: not_performed. |
|
Source qualification completed on 2026-11-03 for exact head
The initial server typecheck exited 1 solely for TS2307 ( Cloud git fetch returned proxy CONNECT 503 twice. Validation instead used the cached exact base Static inspection confirms fail-closed errors propagate before ready status, resumeCursor replacement, and session/ready emission. Default fallback and governed-session behavior remain preserved. No source defects found, no commit/push, no formal review, no draft transition, no merge. GitHub workflow runs for this head remain absent; CodeRabbit's success status corresponds to a skipped review. Independent review and landing remain with the parent owner. Model/harness: GPT-6 / Codex cloud. |
Preserve main's provenance guidance and PR template without changing the qualified fail-closed source. Model: direct (box) Task: fix Agent: Codex cloud source qualifier Lane: codex
Problem and fix
A recoverable Codex thread-resume error can silently start a replacement thread and report it as successful continuity. This adds the opt-in, typed
resumeFailurePolicyto Codex provider settings:fallback-to-new-threadremains the default and preserves existing behavior.fail-closedpropagates the resume error without callingthread/start, before ready status, resumeCursor replacement, or session/ready emission.The setting is hidden from the settings form and flows through CodexAdapter into CodexSessionRuntime. Governed-session startup is preserved. Scope is seven files: settings schema and tests, adapter, runtime and tests, and two settings fixtures.
Current integration and local qualification
Head:
1403f3f86a28b6b9a6b4a9a4ac4cb8d22b6412a6Integrated main:
7c146a2c344496f51a93f4cce90763b16cc62437Tree:
03311284be139eec6edce4e2aaef84c3542a5e50The integration is a two-parent merge of prior head
6c5c9038acc8661de33f0c620e1640fd1a431c59and current main. Main's three documentation-only commits are preserved. All seven implementation blobs are identical to the previously qualified head; only AGENTS.md and the PR template differ from that head. No rebase or force-push.Revalidated on the resulting tree on 2026-11-03:
tsc --noEmit: exit 0, suggestions only.git diff --check: pass.These are local qualification results, not a CI-green claim. No full local suite/build was run, and no passing GitHub CI receipt is claimed. Independent review and landing remain with the parent owner; this PR remains open and ready for review.
Historical evidence
The original implementation was derived from stock v0.0.42 by openrouter/deepseek/deepseek-v4.1-flash via opencode. The 2026-11-01 main port used codex/gpt-6.1-sol and passed 321 focused tests, contracts typechecking, lint, and formatting. Its Mac server typecheck ultimately exited 130 at 21:58:17 UTC; follow-up collection failed because Codex authentication expired. That process is not still running and did not produce a passing receipt.
The 2026-11-03 cloud run initially found a missing local link for the declared, already-cached jsonc-parser 3.3.1 dependency. Restoring that link made server typechecking pass; no source or lockfile change was required. Git transport returned proxy CONNECT 503, so source was retrieved through GitHub tools and verified by blob/tree hashes. The current merge tree matches the locally tested tree exactly.
Earlier draft/not-for-merge language described the initial review carrier and is superseded by the current ready-for-review state. Historical comments remain available. Prior-head qualification evidence.
Harness: Codex cloud. The exact runtime model identifier is unavailable; the documented provenance fallback is used below.
Model: direct (box)
Task: fix