Skip to content

feat(desktop): fall back to home when the terminal cwd is unusable - #723

Merged
ace331 merged 2 commits into
mainfrom
feat/terminal-cwd-home-fallback
Sep 18, 2026
Merged

ace331 merged 2 commits into
mainfrom
feat/terminal-cwd-home-fallback

Conversation

@ace331

@ace331 ace331 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adjust the embedded terminal's startup-directory logic:

  • Workspace thread → opens in its workspace directory (unchanged).
  • Standalone chat session → opens in its session (temporary-workspace) directory (unchanged).
  • Validation at startup → when the resolved directory is missing or unusable, the shell now starts in the user's home directory automatically, instead of failing with CWD_INVALID and waiting for an explicit start-in-home confirmation.

The skipped path is logged server-side and the final cwd is reported back in the session info; only an unusable home directory still errors. This removes the whole CwdPolicy/homeConfirmed mechanism (wire field, client types, error hint, fallback button, i18n keys). Pre-spawn validation itself is kept so portable-pty never silently substitutes /Users/ace for a bad cwd — the choice is now made deliberately on our side.

Test plan

  • cargo test terminal:: — 52 passed, incl. the rewritten e2e (workspace dir removed → shell starts in home)
  • cargo clippy --all-targets clean, cargo fmt applied
  • Frontend vitest full suite (1160 tests) + ESLint + tsc clean

The embedded terminal now validates the resolved workspace/session
directory before spawn and starts in the user's home directory when it
is missing or unusable, instead of failing with CWD_INVALID and waiting
for an explicit start-in-home confirmation.

- Workspace threads still open in their workspace directory; standalone
  chat sessions in their session (temporary-workspace) directory.
- The skipped path is logged and the final cwd is reported in the
  session info; only an unusable home directory still errors.
- Removes the CwdPolicy/homeConfirmed wire field, its client types and
  the fallback button, keeping validation itself so portable-pty never
  silently substitutes $HOME.
@ace331
ace331 enabled auto-merge (squash) September 18, 2026 07:10
@ace331
ace331 merged commit 2757294 into main Sep 18, 2026
12 checks passed
@ace331
ace331 deleted the feat/terminal-cwd-home-fallback branch September 18, 2026 07:19
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.

1 participant