Skip to content

Ask for cwd choice when resuming session from different cwd#9731

Merged
charley-oai merged 12 commits into
mainfrom
ask-for-cwd-upon-resume-from-different-cwd
Jan 25, 2026
Merged

Ask for cwd choice when resuming session from different cwd#9731
charley-oai merged 12 commits into
mainfrom
ask-for-cwd-upon-resume-from-different-cwd

Conversation

@charley-oai

@charley-oai charley-oai commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix resume/fork config rebuild so cwd changes inside the TUI produce a fully rebuilt Config (trust/approval/sandbox) instead of mutating only the cwd.
  • Preserve --add-dir behavior across resume/fork by normalizing relative roots to absolute paths once (based on the original cwd).
  • Prefer latest TurnContext.cwd for resume/fork prompts but fall back to SessionMeta.cwd if the latest cwd no longer exists.
  • Align resume/fork selection handling and ensure UI config matches the resumed thread config.
  • Fix Windows test TOML path escaping in trust-level test.

Details

  • Rebuild Config via ConfigBuilder when resuming into a different cwd; carry forward runtime approval/sandbox overrides.
  • Add normalize_harness_overrides_for_cwd to resolve relative additional_writable_roots against the initial cwd before reuse.
  • Guard read_session_cwd with filesystem existence check for the latest TurnContext.cwd.
  • Update naming/flow around cwd comparison and prompt selection.
Screenshot 2026-01-23 at 5 42 13 PM

And proof the model understands the new cwd:

Screenshot 2026-01-22 at 5 36 45 PM

@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7dc8bd072

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/lib.rs Outdated
@charley-oai charley-oai marked this pull request as ready for review January 23, 2026 02:06
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,281 @@
use std::path::Path;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This CWD prompt is consistent with other full‑screen startup overlays in the TUI. The codebase has two UI patterns:

1) Full‑screen, bespoke overlays (custom WidgetRef)
Handwritten screens that render their own layout:

  • codex-rs/tui/src/update_prompt.rs (update available)
  • codex-rs/tui/src/oss_selection.rs (OSS provider selection)
  • codex-rs/tui/src/onboarding/* (welcome/auth/trust screens)
  • codex-rs/tui/src/resume_picker.rs (resume/fork picker)

These use shared low‑level helpers like ColumnRenderable, selection_option_row, and key_hint—the same approach as the CWD prompt.

2) Bottom‑pane popups with shared components
Reusable selection/popup system used inside the chat UI:

  • codex-rs/tui/src/bottom_pane/selection_popup_common.rs
  • codex-rs/tui/src/bottom_pane/list_selection_view.rs
  • many chatwidget popups via SelectionViewParams

Conclusion: For a startup/resume prompt, a bespoke full‑screen overlay is aligned with existing practice. There isn’t a single generic modal used across all startup screens, and
this prompt already reuses the common low‑level helpers.

@justjxke

Copy link
Copy Markdown

Love this!

@joshka-oai joshka-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/openai/codex/blob/82e97f6173b5efe69f1b190136be0bfa5c1e1b48/codex-rs/tui/src/app.rs#L811-L814
P2 Badge Propagate chosen cwd into resumed ChatWidget config

When the new cwd prompt returns CwdSelection::Session, resume_config.cwd can differ from self.config.cwd, but the resumed widget is still initialized with self.config.clone(). That leaves the UI using the old cwd even though the underlying thread was spawned with the selected cwd, which is observable because history_cell::new_session_info renders config.cwd and chatwidget::skills::set_skills_from_response filters skills by self.config.cwd. This mismatch occurs specifically when resuming from a different directory and choosing the session directory.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dfec8cf863

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/app.rs Outdated
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c1188001c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/lib.rs
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad265edd7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/app.rs
@charley-oai charley-oai force-pushed the ask-for-cwd-upon-resume-from-different-cwd branch from 5d60581 to a02710a Compare January 24, 2026 06:36
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a02710a7fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/lib.rs
@charley-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a02710a7fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/lib.rs
@charley-oai charley-oai merged commit 18acec0 into main Jan 25, 2026
51 of 53 checks passed
@charley-oai charley-oai deleted the ask-for-cwd-upon-resume-from-different-cwd branch January 25, 2026 05:57
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants