Resolve codex resume target from session_meta instead of trusting --last - #394
Merged
Conversation
tildesrc
force-pushed
the
panopticon/fix-codex-resume-target
branch
2 times, most recently
from
August 24, 2026 01:45
f2dc43b to
787792b
Compare
$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
force-pushed
the
panopticon/fix-codex-resume-target
branch
from
August 24, 2026 01:46
787792b to
af12209
Compare
tildesrc
marked this pull request as ready for review
August 24, 2026 01:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_find_resume_target()incontainer/cli/codex.py: scans$CODEX_HOME/sessions/**/*.jsonl, reads only the first line of each file, and filters to sessions withpayload.originator == "codex-tui"andpayload.thread_source == "user"— the root interactive TUI thread, notcodex execsubprocesses or internal subagent threads (e.g. compaction).resume --lastinlaunch_argvwith_find_resume_target, passing the winner'spayload.idexplicitly ascodex resume <session_id>.turn == "agent"(previously deferred as unverified; it is verified working oncodex resume)._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