Skip to content

fix(codex): release active thread writers on dispose - #582

Merged
SDSLeon merged 1 commit into
masterfrom
poracode/sunny-gazelle-614e7056
Aug 18, 2026
Merged

fix(codex): release active thread writers on dispose#582
SDSLeon merged 1 commit into
masterfrom
poracode/sunny-gazelle-614e7056

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • recover authoritative in-progress Codex turn IDs during structured-session teardown
  • interrupt every tracked or provider-reported active turn before unsubscribing
  • preserve replacement sessions across ownership transfers and stale-ID interrupt retries

Root cause

Teardown relied on locally observed active turn IDs. If Poracode missed a concurrent or continuation turn, it could unsubscribe while that Codex turn kept running in a pooled app-server process. The provider thread retained its writer, so a later thread/resume failed with thread … already has an active writer.

Impact

Reopening a Codex GUI thread no longer intermittently fails because an unobserved turn survived teardown. Replacement sessions are protected from interruption if ownership changes while teardown is in flight.

Validation

  • pnpm exec vitest run src/supervisor/agents/codex/codex.test.ts src/supervisor/agents/codex/appServerRpc.test.ts src/supervisor/agents/codex/serverPool.test.ts — 3 files, 161 tests passed
  • pnpm run typecheck
  • pnpm run lint
  • pnpm exec oxfmt --check src/supervisor/agents/codex/acp.ts src/supervisor/agents/codex/codex.test.ts
  • git diff --check

@SDSLeon
SDSLeon marked this pull request as ready for review August 18, 2026 18:29
@SDSLeon
SDSLeon merged commit d63356a into master Aug 18, 2026
8 checks passed
@SDSLeon
SDSLeon deleted the poracode/sunny-gazelle-614e7056 branch August 18, 2026 18:29
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