Skip to content

feat: filter resume picker by current directory - #4604

Closed
lox wants to merge 1 commit into
openai:mainfrom
lox:feat/resume-by-dir-pr
Closed

lox wants to merge 1 commit into
openai:mainfrom
lox:feat/resume-by-dir-pr

Conversation

@lox

@lox lox commented Oct 2, 2025 •

Copy link
Copy Markdown

Addresses #4342. This changes the default behavior of codex resume to what users typically expect - showing only conversations from the current directory rather than all conversations system-wide.

Summary

Filter the resume picker to show only conversations from the current working directory by default, with an --all flag to restore the previous behavior of showing all conversations.

Motivation

When working on multiple projects, codex resume currently shows all conversations from all directories, making it difficult to find relevant sessions. This change makes the resume picker context-aware, showing only conversations from the current project directory by default.

Changes

  • Add cwd_filter parameter to list_conversations() and get_conversations() to filter by working directory
  • Add matches_cwd_filter() function that checks the SessionMeta cwd field against the filter path
  • Add --all flag to codex resume command to show all conversations across all directories (restores previous behavior)
  • Update TUI to conditionally apply filtering based on the flag
  • Update all existing callsites to pass None for backward compatibility

Usage

# Show only conversations from current directory (NEW DEFAULT)
codex resume

# Show all conversations across all directories (previous behavior)
codex resume --all

Breaking Change

This changes the default behavior of codex resume - it now filters to the current directory by default. Users who want to see all conversations can use the new --all flag.

I have read the CLA Document and I hereby sign the CLA.

@J3m5

J3m5 commented Oct 2, 2025

Copy link
Copy Markdown

Will we always be able to see all conversations, perhaps as an option?

@lox

lox commented Oct 3, 2025

Copy link
Copy Markdown
Author

@J3m5 added an --all flag for the previous behaviour.

Add directory filtering to the resume picker - by default, conversations
are filtered to only show those from the current working directory.

Add --all flag to 'codex resume' to show all conversations across all
directories (restores previous behavior).

Changes:
- Add cwd_filter parameter to list_conversations() and get_conversations()
- Add matches_cwd_filter() to check conversation working directory
- Add --all flag to ResumeCommand to control filtering behavior
- Update TUI to conditionally filter based on flag

This makes it easier to work with multiple projects without seeing
unrelated conversation history from other directories.

Signed-off-by: Lachlan Donald <[email protected]>
@Wangnov

Wangnov commented Oct 6, 2025

Copy link
Copy Markdown

Great work on this PR! 🎉 I noticed that while the picker now filters by directory, --last still searches globally (line 402: None // No cwd filter for resume_last).

Issue: This doesn't fully address the use case described in #4545 - users working across multiple projects often want codex resume --last to resume their most recent session in the current directory.

Suggested change:

// In lib.rs, around line 399-407
let cwd_filter = if cli.resume_all { 
    None 
} else { 
    Some(config.cwd.as_path())
};

match codex_core::RolloutRecorder::list_conversations(
    &config.codex_home, 
    1, 
    None, 
    INTERACTIVE_SESSION_SOURCES,
    cwd_filter,  // Apply directory filter
)

New behavior:

  • codex resume --last → last session in current dir (intuitive default)
  • codex resume --last --all → last session globally (power user escape hatch)

This would make the PR fully resolve both #4342 and #4545. Happy to submit this as a follow-up PR if you prefer, or you can include it here!

@lox

lox commented Oct 6, 2025

Copy link
Copy Markdown
Author

Happy to include it, will add shortly @Wangnov.

@etraut-openai

Copy link
Copy Markdown
Contributor

Thanks for the contribution, and apologies for the slow response. We've received many PRs, and we don't have the bandwidth on the codex team to review all of them.

We've updated our contribution guidelines to clarify that we're currently accepting contributions for bugs and security fixes, but we're not generally accepting new features at this time. We need to make sure that all new features compose well with both existing and upcoming features and fit into our roadmap. If you would like to propose a new feature, please file or upvote an enhancement request in the issue tracker. We will generally prioritize new features based on community feedback.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 31, 2025
@openai openai unlocked this conversation Oct 31, 2025
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.

4 participants