Skip to content

fix(tab) Fix tab config cwd being dropped for missing directories#9724

Open
doubledare704 wants to merge 1 commit intowarpdotdev:masterfrom
doubledare704:fix-tab-config-cwd
Open

fix(tab) Fix tab config cwd being dropped for missing directories#9724
doubledare704 wants to merge 1 commit intowarpdotdev:masterfrom
doubledare704:fix-tab-config-cwd

Conversation

@doubledare704
Copy link
Copy Markdown

Description

Preserves the directory/cwd value from tab configs when creating terminal and agent panes, even if the directory does not exist yet.

Previously, pane_group filtered the configured cwd with p.exists(). When the directory was missing at tab creation time, Warp silently discarded the tab config cwd and fell back to the default startup directory, making the tab config field appear ignored.

This change removes that early existence check so the configured cwd is still passed into session startup. Lower-level platform-specific startup behavior remains responsible for handling invalid process cwd values. In particular, the Windows PTY path still guards CreateProcessW with an is_dir() check before passing lpCurrentDirectory, so this should preserve the existing Windows spawn safety while keeping the tab config intent available to shell/bootstrap handling.

Open technical questions for review:

  1. Should a tab config directory always be treated as user intent, even when the path does not exist yet, or should Warp intentionally drop missing paths before shell startup?
  2. On Windows, is the lower-level CreateProcessW is_dir() fallback the right place to keep spawn safety, instead of filtering tab config cwd earlier in pane_group?
  3. For WSL/MSYS/PowerShell, should the configured path be passed through unchanged to shell bootstrap, or normalized only when it exists?

My current read is that pane_group should preserve the configured cwd, while lower-level PTY/bootstrap code should decide how each platform handles missing or invalid directories.

Linked Issue

Closes #9130

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Screenshots / Videos

Not applicable; this is startup behavior with no UI changes.

Testing

Added a regression test covering a tab config pane whose configured cwd does not exist. The test asserts the non-existent cwd is still preserved as the terminal model startup path.

Ran:

  • cargo test -p warp test_tab_config_preserves_nonexistent_cwd
  • cargo test -p warp pane_group::tests
  • cargo test -p warp working_directories
  • cargo test -p warp tree::tests

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Changelog Entries for Stable

CHANGELOG-BUG-FIX: Fixed tab configs silently ignoring configured directories that do not exist yet.

@cla-bot cla-bot Bot added the cla-signed label May 1, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 1, 2026

@doubledare704

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @vkodithala.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 1, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR preserves the tab config directory value when constructing terminal and agent panes, allowing lower-level shell startup/bootstrap handling to receive the configured cwd even when it does not exist yet. The added regression test covers the pane-template path and asserts the startup path remains available on the terminal model.

Concerns

  • No blocking correctness or security concerns found in the changed lines. Local Unix startup passes the path through WARP_INITIAL_WORKING_DIR and starts the process from home; Windows still filters lpCurrentDirectory with is_dir() while passing the bootstrap env var, so invalid paths should not become unsafe process cwd values.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot requested a review from vkodithala May 1, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab Configs: directory field not applied before commands run

1 participant