Skip to content

fix(server): opt-in fail-closed policy for codex thread resume - #2

Merged
nullStack65 merged 3 commits into
mainfrom
a3s/v0042-strict-resume
Nov 3, 2026
Merged

nullStack65 merged 3 commits into
mainfrom
a3s/v0042-strict-resume

Conversation

@nullStack65

@nullStack65 nullStack65 commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

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 resumeFailurePolicy to Codex provider settings:

  • fallback-to-new-thread remains the default and preserves existing behavior.
  • fail-closed propagates the resume error without calling thread/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: 1403f3f86a28b6b9a6b4a9a4ac4cb8d22b6412a6
Integrated main: 7c146a2c344496f51a93f4cce90763b16cc62437
Tree: 03311284be139eec6edce4e2aaef84c3542a5e50

The integration is a two-parent merge of prior head 6c5c9038acc8661de33f0c620e1640fd1a431c59 and 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:

  • Four focused server suites: 171 passed (CodexSessionRuntime, CodexAdapter, ProviderInstanceRegistryLive, serverSettings).
  • Contracts settings suite: 150 passed. Total: 321 tests across five files.
  • Server and contracts package tsc --noEmit: exit 0, suggestions only.
  • Targeted lint: exit 0 with three existing warnings; targeted formatting and 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

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.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 19, 2026
@nullStack65
nullStack65 force-pushed the a3s/v0042-strict-resume branch from 1ba1ee7 to f014905 Compare September 20, 2026 01:33

@nullStack65 nullStack65 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/contracts and apps/server tsc --noEmit → EXIT 0, no errors.
  • Targeted vp lint / vp fmt --check on changed files → PASS (2 pre-existing no-inline-schema-compile warnings in serverSettings.test.ts:1304-1305, not on A3-added lines).
  • Equivalent git diff --check: reverse-apply with --whitespace=error-all → clean; no conflict markers.
  • resumeFailurePolicy typed/bounded (Schema.Literals), defaulting fallback-to-new-thread; only path to thread/start after a resume request is the non-strict branch; verified no other thread/start producer in server source; strict failure exits makeCodexSessionRuntime.start before status:"ready", resumeCursor, and session/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.

@github-actions

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for f014905.

This comment will update automatically after the next completed run.

@nullStack65

Copy link
Copy Markdown
Owner Author

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.

@nullStack65

Copy link
Copy Markdown
Owner Author

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.

@nullStack65

Copy link
Copy Markdown
Owner Author

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.

@nullStack65
nullStack65 marked this pull request as ready for review November 1, 2026 21:36
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@nullStack65

Copy link
Copy Markdown
Owner Author

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

@nullStack65

Copy link
Copy Markdown
Owner Author

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.

Copy link
Copy Markdown
Owner Author

Source qualification completed on 2026-11-03 for exact head 6c5c9038acc8661de33f0c620e1640fd1a431c59.

  • Focused server suites: 171 tests passed across CodexSessionRuntime, CodexAdapter, ProviderInstanceRegistryLive, and serverSettings.
  • Contracts settings suite: 150 tests passed. Total: 321 tests / five files.
  • Server and contracts tsc --noEmit -p <package>/tsconfig.json: exit 0 (Effect suggestions only).
  • Targeted lint: exit 0, three existing no-inline-schema-compile warnings outside added lines. Targeted formatting and git diff --check: pass.

The initial server typecheck exited 1 solely for TS2307 (jsonc-parser missing from the cloud workspace's apps/server/node_modules links). The declared locked 3.3.1 package was already cached; restoring its local dependency link resolved the error. No source, lockfile, runtime, credential, or provider configuration changes were needed.

Cloud git fetch returned proxy CONNECT 503 twice. Validation instead used the cached exact base 96c7bf6475ca96ea02c8b09f938c693ae7cb3266 and seven source blobs retrieved through the GitHub connector. Every changed blob SHA and all 36 root entries were verified against GitHub at the accepted head; reconstructed tree: 5c08d40fc65960a46ec0a5688d94c5cbce8286db.

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.
Task: source qualification

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
@nullStack65
nullStack65 merged commit 8e5610d into main Nov 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant