Repository navigation
fix(codex): scope resume picker to current cwd - #23
Merged
Merged
Conversation
So that git worktrees created under .worktrees/<branch>/ don't leak into the main checkout's `git status`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Codex provider's listSessions ignored the cwd argument and returned every Codex session on disk. The resume picker (PathPickerModal / CommandPalette / ⌘⇧R) presented that global list as if it were filtered to the focused pane's project, so picking a "this project" session could land on a rollout recorded in a totally different directory. cc-shell then spawned codex with the user's current cwd plus --resume <foreign-id>, codex saw the cwd mismatch, opened its upstream cwd_prompt modal, and the next bracketed-paste submission got eaten by the modal's paste-discarding event loop. The user saw an optimistic prompt in the feed and a streamPhase that never left 'submitting'. Plumb cwd through registry.main.ts → listCodexSessions and pin the filter behavior with a new regression test (submodule bump on packages/codex-headless). Claude's lister already filters by cwd; this brings codex to parity. The unfiltered global path stays available for callers that still want it (the session:list-all rendering harness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Sep 3, 2026
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
listSessionswas ignoring itscwdargument (registry.main.ts:23previously read(_cwd, limit) => listCodexSessions({ limit })), so the resume picker —PathPickerModal,CommandPalette, and⌘⇧R— silently returned every Codex session globally instead of the user's current project.codex --resume <foreign-id>with the user's current cwd, codex would notice the mismatch, open its upstreamcwd_promptmodal, and the next bracketed-paste submission was eaten by the modal's paste-discarding event loop. The user saw an optimistic prompt in the feed and astreamPhasethat never left'submitting'.cwdthrough tolistCodexSessions, normalize viapath.resolve(so trailing slashes /..segments compare equal), and drop rollouts whosesession_meta.cwddoesn't match. The unfiltered global path stays for thesession:list-allrendering harness.packages/codex-headlesstofix/list-sessions-cwd-filter(companion PR: https://github.com/Juliusolsson05/codex-headless/pull/new/fix/list-sessions-cwd-filter).Test plan
npx tsx packages/codex-headless/src/testing/regression-list-sessions-cwd-filter.ts— passes (covers filtered, unfiltered, trailing slash,..segments, and unknown-cwd cases).npm run build— clean.⌘⇧Rwhile focused on a cc-shell pane shows only Codex rollouts whosesession_meta.cwdis cc-shell.⌘⇧Rwhile focused on a different worktree shows only that worktree's Codex rollouts.'submitting').Not in this PR
The upstream
cwd_promptmodal is still undetected. If a session ever gets resumed across cwds via a different path (e.g. a stale persistedcwdinworkspace.jsonthat disagrees with the rollout — exactly the case the original debug bundle showed), the eat-the-prompt failure is still reachable. Follow-ups worth doing:cwd_promptinpackages/codex-headless(twin ofTrustDialogParser) and either render it as a modal or auto-respond.session_meta.cwdat spawn time and refuse / warn when it disagrees with the renderer-supplied cwd.streamPhase = 'submitting'after ~30s with no semantic event, with a toast, so any future unknown modal can't silently brick a pane.🤖 Generated with Claude Code