Skip to content

Fix rescue thread persistence across Claude session resume - #567

Open
Asher123452 wants to merge 3 commits into
openai:mainfrom
Asher123452:codex/fix-rescue-resume-persistence
Open

Fix rescue thread persistence across Claude session resume#567
Asher123452 wants to merge 3 commits into
openai:mainfrom
Asher123452:codex/fix-rescue-resume-persistence

Conversation

@Asher123452

@Asher123452 Asher123452 commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • retain completed Codex task records when Claude's SessionEnd hook cleans up active work
  • add a regression test covering task -> SessionEnd -> resumed task
  • fall back to the tracked root process when Windows taskkill only partially terminates a tree
  • make Windows runtime fixtures use platform-correct executable and home-directory environment names
  • use POSIX path joining when constructing simulated/non-Windows Unix broker endpoints

Why

Claude conversations preserve their session ID when reopened, but SessionEnd deleted every job for that ID. As a result, /codex:rescue --resume and the automatic resume candidate lookup reported that no previous Codex task existed even though the Codex thread itself still existed.

The full Windows run also exposed partial taskkill failures that made cancellation report failure after successfully interrupting the Codex turn, plus several test fixtures that assumed POSIX executable and HOME lookup behavior.

Verification

  • npm test: 93/93 pass on Windows
  • live two-process Claude Code smoke test resumed the same Codex thread after SessionEnd
  • resume candidate and stored result both retain the same thread ID
  • syntax checks and git diff --check pass

SessionEnd previously deleted completed task records along with active jobs, so a resumed Claude conversation could not resolve its prior Codex thread. Retain terminal job history while still terminating and removing queued/running work.
@Asher123452
Asher123452 requested a review from a team July 28, 2026 11:43
Fall back to terminating the tracked root process when taskkill reports partial tree failure. Make the no-npm and session-transfer fixtures use Windows-correct executable and home-directory environment names so the full suite is portable.
@Asher123452

Copy link
Copy Markdown
Author

Local verification is complete: npm test passes 93/93 on Windows, including the new Claude SessionEnd -> reopened conversation -> Codex thread resume regression and repeated partial-taskkill cancellation coverage. A live two-process Claude Code smoke test also resumed the same Codex thread ID after SessionEnd.

The fork workflow is currently action_required, and the repository ruleset requires one approval from the configured OpenAI team. A maintainer will need to approve the Actions run and review this PR before it can squash-merge.

matcra587 added a commit to matcra587/codex-plugin-cc that referenced this pull request Jul 30, 2026
SessionEnd removed every job carrying the ending session's id, including
completed ones. Claude reuses a conversation's session id when it is
reopened, so `/codex:rescue --resume` and the resume candidate lookup
then reported no previous task even though the Codex thread was still
live, and the stored result had already been deleted with the record.

Only tear down work that is still in flight. Queued and running jobs are
killed and reaped as before; completed, failed and cancelled records
survive so a reopened session can resume them. Retained history stays
bounded by the existing MAX_JOBS cap in pruneJobs.

The existing cleanup test asserted the old behaviour, so it now pins the
corrected contract: the ending session's finished job and its artifacts
are kept, and only the in-flight job's log and record are reaped. A new
end-to-end test covers task -> SessionEnd -> resume candidate. Both fail
without this change.

Reported upstream as openai/codex-plugin-cc#567, which is unmerged and
Node-based; only the persistence half of it applies here.
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