Skip to content

Resolve codex resume target from session_meta instead of trusting --last - #394

Merged
tildesrc merged 1 commit into
mainfrom
panopticon/fix-codex-resume-target
Aug 24, 2026
Merged

Resolve codex resume target from session_meta instead of trusting --last#394
tildesrc merged 1 commit into
mainfrom
panopticon/fix-codex-resume-target

Conversation

@tildesrc

Copy link
Copy Markdown
Contributor

Summary

  • Add _find_resume_target() in container/cli/codex.py: scans $CODEX_HOME/sessions/**/*.jsonl, reads only the first line of each file, and filters to sessions with payload.originator == "codex-tui" and payload.thread_source == "user" — the root interactive TUI thread, not codex exec subprocesses or internal subagent threads (e.g. compaction).
  • Replace the bare-existence probe + resume --last in launch_argv with _find_resume_target, passing the winner's payload.id explicitly as codex resume <session_id>.
  • Implement the interrupt prompt on resume when turn == "agent" (previously deferred as unverified; it is verified working on codex resume).
  • Port the full test matrix for _find_resume_target (13 new tests) and update the 3 existing resume tests that relied on the old bare-existence probe.

Plan: panopticon://tasks/50a66e1c392b496cb8c3db9cbfa9dec2/artifacts/plan.md

🤖 Generated with Claude Code

@tildesrc
tildesrc force-pushed the panopticon/fix-codex-resume-target branch 2 times, most recently from f2dc43b to 787792b Compare August 24, 2026 01:45
$CODEX_HOME/sessions is shared by codex exec subprocesses and internal
subagent threads (e.g. compaction), so `resume --last` can resume the
wrong or non-resumable session. Add _find_resume_target(), which reads
only the first line of each .jsonl file and filters to sessions with
originator=codex-tui and thread_source=user, then passes the winner's
id explicitly as `codex resume <session_id>`. Also implement the
interrupt prompt on resume when turn=agent (previously deferred as
unverified; it is verified).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tildesrc
tildesrc force-pushed the panopticon/fix-codex-resume-target branch from 787792b to af12209 Compare August 24, 2026 01:46
@tildesrc
tildesrc marked this pull request as ready for review August 24, 2026 01:49
@tildesrc
tildesrc merged commit f12061b into main Aug 24, 2026
3 checks passed
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