Repository navigation
fix(workspace): honour the startup directory on cold start - #485
Merged
Kuddev merged 4 commits intoOct 5, 2026
Merged
Conversation
When no tab is restored (empty session, restore disabled, missing session, tripped boot breaker or failed post-update restore), the first terminal used the process working directory. The login-autostart shortcut sets that to %USERPROFILE%, so the configured startup directory was ignored on every boot while Ctrl+T tabs honoured it. Prefer the startup directory for both cold-start fallbacks, falling back to the launch directory when it is unset or invalid. Fixes Kuddev#479
Kuddev
approved these changes
Oct 5, 2026
Kuddev
left a comment
Owner
There was a problem hiding this comment.
已审阅两处冷启动入口及 startup_directory / initial_startup / restore 路径。修复复用现有目录校验,只在恢复未产生标签时读取配置目录;不改变显式 CLI 目录、已恢复会话目录及未配置/无效目录的回退。没有新依赖、线程或常驻缓存,成本限于冷启动路径。
维护者已直接把测试目录改为中性名称并同步 main。本地 Windows 产品测试构建使用 gpui-test-support,cold_start_tests 两项通过;架构、名称范围与差异检查通过。未运行真实登录自启动或全套本地 UI 场景。批准精确 head 的代码;合并仍等待该 head 的必需 CI,旧 head 的成功记录不替代它。
This was referenced Oct 5, 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.
Advertising, commercial promotion, and traffic solicitation are prohibited in PRs
and Issues. Business requests must go through the email in the
contribution policy.
PRs or Issues containing unauthorized promotion will be closed directly.
严禁利用 PR 或 Issue 推广、引流,未经授权的推广将直接关闭;商业需求请通过贡献指南中的邮箱沟通,已获批准的赞助按批准范围处理。
Result / 用户结果
Addresses the cold-start part of #479. When no tab is restored at startup (empty session,
restore_session=0, missingsession.json, tripped boot breaker, or a failed post-update restore), the first terminal now opens in the configured Startup directory instead of the process working directory. With the login-autostart shortcut that process directory is%USERPROFILE%, so the setting was ignored on every boot whileCtrl+Ttabs honoured it.启动时没有恢复出任何标签(空会话、关闭「启动时恢复上次标签」、缺少
session.json、断路器跳闸、更新后恢复失败)时,首个终端现在进入设置里的「启动目录」,不再落在进程启动目录。开机自启动快捷方式的起始位置是%USERPROFILE%,此前每次开机都会忽略该设置,而Ctrl+T新标签是正确的。Design / 设计边界
gpui_shell/workspace.rs— theRestoreOrDefaultandRestoreUpdatecold-start fallbacks callSelf::cold_start_cwd()instead ofstd::env::current_dir(). The helper lives ingpui_shell/workspace/session_recovery.rs(cold restoration) and reuses the existingNebulaWorkspace::startup_directory(), the same authorityadd_terminaluses, so no second reading of the setting is added.preferred_initial_cwd.windowing::initial_startupdispatch is unchanged, so an explicit CLI path still wins and a restored session still keeps its saved cwd.Evidence / 验证依据
cargo test --locked -p nebula --bin pebrel --features gpui-shell cold_start_tests— 2 passed (andconfigured_startup_directory_wins_over_the_launch_directoryfails when the helper is reverted to the old "launch directory only" behaviour)cargo check --locked -p nebula --bin pebrel --features gpui-shell --tests— passes (only pre-existing warnings)python3 scripts/check_architecture.py --base origin/main(baseb6e7b78d) — passespython3 -m unittest scripts.tests.test_architecture_budgets scripts.tests.test_architecture_dependencies scripts.tests.test_architecture_governance— 54 tests OKcargo fmt --all -- --check— passesgpui-test-support, the full native suite (left to CI).configured_startup_directory_wins_over_the_launch_directorypins that a configured startup directory beats the launch directory (%USERPROFILE%in the autostart case). The old fallback passedstd::env::current_dir()straight through, which is exactly the case this test rejects.unset_startup_directory_keeps_inheriting_the_launch_directorycovers the preserved unset/invalid path.Ctrl+Talready does).Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md.python3 scripts/check_architecture.py --base <PR-base-commit>passes; budgets were not inflated to fit the change.Checkboxes explain the review; they do not replace CI or maintainer approval.