Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ab2e392
fix(gpui): open the startup window at config.window.dimensions
WilliamWang1721 Sep 27, 2026
5788e0f
Merge upstream main into codex/issue-312-window-startup-size
WilliamWang1721 Sep 27, 2026
c3d451e
Merge remote-tracking branch 'origin/main' into codex/pr313-review-fix
WilliamWang1721 Sep 27, 2026
0b38e7d
fix(gpui): format startup geometry assertions
WilliamWang1721 Sep 27, 2026
cf25a79
Merge branch 'main' into codex/issue-312-window-startup-size
WilliamWang1721 Sep 27, 2026
f8c041d
Merge upstream main into codex/issue-312-window-startup-size
WilliamWang1721 Sep 27, 2026
447f700
Merge upstream main into codex/issue-312-window-startup-size
WilliamWang1721 Sep 28, 2026
955dd8b
Merge upstream main into codex/issue-312-window-startup-size
WilliamWang1721 Sep 28, 2026
0917369
fix: apply a saved custom proxy to new local terminals
yellatiamo Sep 28, 2026
8902351
fix: keep the legacy window file inside its line budget
yellatiamo Sep 28, 2026
dbf93b1
style: satisfy rustfmt in the proxy shell test
yellatiamo Sep 28, 2026
724bae4
fix: stop adding platform cfg for the terminal proxy environment
yellatiamo Sep 28, 2026
69c3012
Merge upstream main into codex/issue-312-window-startup-size
WilliamWang1721 Sep 28, 2026
58aa6e1
Merge upstream main into codex/issue-312-window-startup-size
WilliamWang1721 Sep 28, 2026
0aea9b1
fix(gpui): honor explicit startup config file
WilliamWang1721 Sep 28, 2026
f4ef373
fix(gpui): pass config path in init test callers
WilliamWang1721 Sep 28, 2026
ae578b0
Merge remote-tracking branch 'origin/main' into codex/pr313-20260928
WilliamWang1721 Sep 28, 2026
57329fb
Merge remote-tracking branch 'origin/main' into codex/pr313-20260928
WilliamWang1721 Sep 28, 2026
f40938a
ci: retrigger required checks after macOS log loss
WilliamWang1721 Sep 28, 2026
3a7fc70
fix: keep the selected proxy scheme in new terminals
yellatiamo Sep 29, 2026
4d30b98
Merge remote-tracking branch 'origin/main' into fix/new-terminal-cust…
yellatiamo Sep 29, 2026
0a464e5
fix: honor a scheme typed into the proxy address box
yellatiamo Sep 29, 2026
8c6b61f
feat(terminal): allow inheriting the Windows launch environment
Kuddev Sep 29, 2026
b7b0ff8
test(settings): check environment control visibility on every platform
Kuddev Sep 29, 2026
97b0613
Merge remote-tracking branch 'origin/review-main-20260930' into fix/i…
Kuddev Sep 29, 2026
8d9bf38
Merge remote-tracking branch 'origin/review-main-20260930' into revie…
Kuddev Sep 29, 2026
d28e6a4
fix(config): report startup configuration discovery failures
Kuddev Sep 29, 2026
62f1133
Merge remote-tracking branch 'origin/review-main-20260930' into revie…
Kuddev Sep 29, 2026
feeb1e0
fix(proxy): preserve inherited scope and verify native HTTP proxy req…
Kuddev Sep 29, 2026
022eac2
docs(proxy): scope native protocol evidence to tested HTTP requests
Kuddev Sep 29, 2026
0a64431
test(proxy): use the settings fixture owner and serialize persisted U…
Kuddev Sep 29, 2026
6e4ff64
test(settings): serialize environment preference persistence with sha…
Kuddev Sep 29, 2026
03de6b8
Merge remote-tracking branch 'origin/review-main-20260930' into fix/i…
Kuddev Sep 29, 2026
af06891
Merge remote-tracking branch 'origin/review-main-20260930' into revie…
Kuddev Sep 29, 2026
b58eb77
Merge reviewed PR #375 into settings integration
Kuddev Sep 30, 2026
a8cf871
Merge reviewed PR #377 into settings integration
Kuddev Sep 30, 2026
af35684
Merge reviewed PR #378 with environment refresh and shared settings f…
Kuddev Sep 30, 2026
541db45
Reuse one settings snapshot during Windows pane preparation
Kuddev Sep 30, 2026
4514152
Merge terminal and backup integration into reviewed settings fixes
Kuddev Sep 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
theme-studio = { max-threads = 1 }

[[profile.default.overrides]]
filter = 'test(gpui_shell::settings_pane::theme_studio_tests::) or test(ctrl_wheel_font_zoom_toggle_gates_zoom_and_terminal_scroll) or test(ctrl_wheel_font_zoom_setting_is_searchable_and_has_a_visible_switch)'
filter = 'test(gpui_shell::settings_pane::theme_studio_tests::) or test(ctrl_wheel_font_zoom_toggle_gates_zoom_and_terminal_scroll) or test(ctrl_wheel_font_zoom_setting_is_searchable_and_has_a_visible_switch) or test(environment_refresh_switch_is_searchable_and_persists) or test(pasted_proxy_scheme_updates_the_visible_protocol_and_saved_url)'
test-group = 'theme-studio'
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Startup window size follows `config.window.dimensions`

## Status

Implemented for issue #312 (GPUI shell, `dimensions` only).

## Context

The GPUI shell is the default product shell (`default = ["gpui-shell"]`, and
the legacy shell is a separate compile-time feature, so `config::load` is not
even in the shipped binary). Its only touch with the user's config file was
`gpui_shell::config::find_config_file()`, which resolves
`config::source::discover_toml()` and merges imports with its own TOML reader —
TOML only, never Lua, and only for the keys the settings page wants. So
`config.window.*` had no reader in the shell at all, while `pebrel config
check` — which uses `config::source::discover` + `config::load_source` —
accepted and validated keys the running app ignored. The reporter's
`config.window.dimensions = { columns = 155, lines = 43 }` on Windows 11 at
125% scaling fell into that gap: the window always opened at the shell's fixed
startup geometry.

Startup size had a second, independent cause. `workspace_window_options` pins a
1080×720 logical centered window with a 760×540 minimum, and the real grid came
from `prepare_initial_grid`, which multiplied the hard-coded
`TerminalView::DEFAULT_GRID_COLUMNS`/`DEFAULT_GRID_LINES` (116×30) by the
measured startup cell size. The 116×30 pair was itself the legacy shell's
default canvas, not a user value.

## Evidence

- `config::source::discover` / `config::load_source` are the same entry points
`config_cli.rs` uses for `pebrel config check`, so a key accepted there must
mean the same thing here.
- `WindowConfig::dimensions()` already carries the legacy contract "both
nonzero, else unset"; `display::window_size` clamps each axis to
`term::MIN_COLUMNS` / `term::MIN_SCREEN_LINES`.
- gpui rev `7c66238`: `WindowOptions::window_bounds` and `Window::resize` take
logical `Pixels` (scaled per window by the platform layer), `App` exposes no
scale factor, and `Window` has no `set_position`/`move_window`.
- Local `cargo check -p nebula` cannot complete on this machine: the
`gpui_macos` build script needs the Xcode `metal` tool
(`xcrun: error: unable to find utility "metal"`), so compile-level
verification runs in CI. See Validation.

## Decision

`gpui_shell::config::StartupWindow` holds the startup grid and is loaded once in
`init()` through `config::source::discover(config_file)` + `config::load_source` —
the pair `pebrel config check` uses, so a key accepted there means the same thing
here, and Lua, TOML and YAML share one parser. `main` forwards the selected
`--config-file` path through `run_shell`; without that option, normal environment
and file discovery still applies. Because the value is a grid (columns × lines)
and not pixels,
`prepare_initial_grid` multiplies it by the cell it measures in the window's own
scale domain, so the result is correct at 100%, 125% and any other DPI without
the shell knowing the scale factor. Unset config keeps the 116×30 built-in
canvas; an oversized grid keeps the existing 95%-of-visible-display clamp, which
shrinks the grid rather than pushing the window off screen.

## Rejected alternatives

- Implementing `config.window.position` in the same pass. gpui only accepts
placement through `WindowOptions::window_bounds`, in logical pixels, with no
programmatic move and no `App`-level scale factor; the legacy shell hands winit
a `PhysicalPosition`. Feeding the user's raw numbers as logical would place the
window ~25% off at the reporter's 125% scaling, so `position` is left
unwired rather than shipped wrong. `startup_mode`, `decorations` and
`dynamic_title` are similarly untouched: they are not the reported symptom.
- Folding the field into `Settings`. `Settings` reloads on every settings-page
write, and a Lua `require`/eval on that path would re-execute user code per
save; the startup grid is by definition read once. Separate global, separate
lifecycle.
- Reading `config.window.dimensions` directly in `workspace_window_options` as
pixel math. That duplicates the chrome budget already owned by
`prepare_initial_grid` and cannot measure the cell before a window exists, so
the two paths would drift.
- Parsing Lua/TOML again inside `gpui_shell`. A second parser would diverge from
`pebrel config check` in precedence and error handling; reuse keeps one
authority.
- Extending the shell's existing TOML reader (`find_config_file` +
`load_merged_toml`) with a `window.dimensions` lookup. It cannot see a Lua
file, which is the format the reported config uses, and it deserializes into
`toml::Value` rather than `UiConfig`, so one key would need a third spelling
of the same config.
- Fixing only the legacy shell, or documenting the key as legacy-only. The
default product shell is the one users hit.

## Consequences

- The GPUI shell now depends on the app-level config loader (`config::source`,
`config::load_source`, and therefore mlua for Lua sources) during bootstrap.
Discovery order stays `pebrel.lua` → `pebrel.toml` → YAML, so a Lua file
shadows a TOML file for startup size exactly as it does for `config check`.
- `init()` performs one synchronous config read plus possible Lua evaluation on
the main thread before the first window opens. The explicit CLI path reaches
this one-time load; settings-page writes do not re-evaluate it.
- A config file that fails to parse prints `[pebrel:gpui] failed to read window
config …` to stderr and falls back to the built-in canvas; the shell still
opens.
- Issue #312 is only half closed: window size now follows config, position still
does not.

## Validation

Local: `cargo fmt --all -- --check`,
`python3 scripts/check_architecture.py --base 7b0cedb` and
`python3 scripts/check_platform_cfg.py` (budget unchanged at 481) pass; no line
budget was raised, and `workspace.rs` is net −1 line because the grid math moved
to `config.rs`.

`lua_window_dimensions_reach_the_startup_grid` fails before the change, because
`StartupWindow` did not exist; it pins the Lua source → `dimensions()` link.
`startup_grid_follows_window_dimensions` pins the three shell-side verdicts:
unset → built-in canvas, configured → exact grid, below-minimum → clamped.
`startup_window_uses_the_config_file_selected_by_cli` covers CLI parsing through
startup loading. Follow-up builds and tests run through the upstream PR Actions.

## Supersedes

None.

## Revisit when

gpui exposes a window-position API or an app-level scale factor, and
`config.window.position` can be honoured with the same physical-pixel contract
the legacy shell has. Also when the GPUI shell moves onto a shared config
loader with the rest of the app; at that point `StartupWindow` should read from
it rather than re-discovering.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Terminal proxy environment keeps the selected scheme

## Status

Implemented; pending review.

## Context

New Windows local terminals receive `http_proxy`, `https_proxy`, and `all_proxy` from the
saved network settings. A first version rewrote `socks5://host:port` to
`http://host:port` for the first two variables so Windows PowerShell's
`WebRequest` could use a mixed listener. That assumption is not true of every
SOCKS endpoint.

## Evidence

curl uses a protocol-specific proxy variable ahead of `ALL_PROXY`
(https://curl.se/docs/manpage.html). An HTTP URL in `http_proxy` therefore
sends HTTP proxy requests to a SOCKS-only port, and the original scheme left
in `all_proxy` does not correct it. The managed PowerShell adapter is verified
with HTTP URLs; other URL schemes remain available through the environment for
clients whose own networking stack supports them.

## Decision

Write the validated URL, with its original scheme, into all three variables.
Set `PEBREL_HTTP_PROXY` to that URL only when it is HTTP, for both a custom
address and an enabled system proxy. A selected SOCKS endpoint writes an empty
marker to shadow an inherited HTTP marker even in an incremental environment.
The PowerShell startup script consumes that marker and does not read
`ssh_proxy_url`. Jump and command proxies stay out of the environment because
Rust already rejects them. The Windows adapter preserves inherited WSLENV entries
only for incremental environments; complete registry snapshots remain authoritative.
Do not add `PEBREL_HTTP_PROXY` to `WSLENV`.

## Rejected alternatives

- Rewriting SOCKS to HTTP on the same host and port. A mixed listener may
accept both, but a SOCKS-only listener will not.
- Leaving the original scheme only in `all_proxy`. curl and git prefer
`http_proxy` / `https_proxy` when those are set.
- Parsing `ssh_proxy_url` again in the PowerShell script. That path accepts
forms the environment exporter already refuses, and it missed the system
proxy that Rust had already selected.

## Consequences

A SOCKS setting reaches curl and git as SOCKS. The PowerShell initialization
overrides request defaults only for an HTTP URL; it leaves other protocols to
the client's networking stack. An already open terminal does not change.
HTTP URL credentials are decoded into native proxy
credentials; they are removed from the URL passed to the request cmdlets. Proxy
initialization uses a local script scope and does not print credential-bearing
URLs when initialization fails.

## Validation

`terminal_proxy_assignments` and `apply_terminal_proxy_env` cover scheme
preservation, the HTTP marker, IPv6 brackets, credential bytes, and removal of
a stale marker. The Windows prompt script test requires `PEBREL_HTTP_PROXY`
and forbids reading the raw proxy settings. The production `proxy.ps1` fragment is
also executed by Windows PowerShell 5 and PowerShell 7 tests against a loopback
HTTP proxy, covering anonymous requests, a Basic authentication challenge and an
empty marker with a SOCKS environment.

## Supersedes

None.

## Revisit when

The managed adapter gains verified support for another proxy scheme or the
native request clients change their proxy configuration contracts.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Choosing the environment for new Windows terminals

## Status

Proposed in the fix for issue #103.

## Context

Windows terminals refresh registered environment variables so newly installed
tools can become visible without restarting Pebrel. The same refresh replaces a
temporary PATH supplied by the shell that launched Pebrel. Both behaviors are
useful, but a registered PATH cannot reveal which inherited entries were temporary
and which came from an older registry snapshot.

## Evidence

`nebula_terminal/src/tty/windows/environment.rs` removes registered keys from the
inherited snapshot before applying current machine/user values. Its deletion and
expansion tests depend on that rule. Issue #103 supplies the concrete case of
prepending a directory to PATH in cmd before launching Pebrel.

## Decision

Add `refresh_environment` to the shared settings model, defaulting to true for
existing configurations. The Windows startup adapter, already used by both UI
shells, skips the registry refresh when the setting is false. The terminal then
inherits the environment of the Pebrel process, with normal pane-specific
overrides applied afterward. The setting affects newly created local terminals;
it does not rewrite an open process or a remote SSH environment.

## Rejected alternatives

- Always replace inherited PATH: loses deliberate launcher modifications.
- Always append inherited entries to refreshed PATH: can resurrect removed
registered entries and change executable selection order.
- Guess temporary entries by comparing against a later registry snapshot:
loses provenance when the registry changes before the first terminal opens.
- Disable refresh globally: changes the existing installation workflow.

## Consequences

Users can choose launch-time inheritance or current Windows settings. Missing or
invalid values keep the existing default. Reset restores refresh. The Terminal
settings row explains the difference and reports persistence failures through the
existing localized feedback path. No new dependency or core/UI dependency edge
is introduced.

## Validation

Settings tests cover defaults, invalid values, persistence round trips and reset.
A Windows subprocess regression prepends a temporary PATH entry and verifies the
real shell child receives it together with a pane override. A GPUI test clicks the
visible switch twice and verifies persisted state and search navigation.

## Supersedes

None.

## Revisit when

Windows supplies reliable environment provenance or the existing refresh policy
is replaced by an equivalent explicit per-profile configuration.
1 change: 1 addition & 0 deletions nebula_app/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
- 测试真实控件和布局路径;编译或状态单测不能代替 hover、命中区域、键盘路径和视觉验收。
- 只有跨层所有权、持久化、协议、线程/生命周期或重要性能取舍才写 note,路径镜像到 `architecture/notes/nebula_app/<capability>/`。
- Agent 集成、改键输入与 SSH 认证的因果记录分别位于 [`ai_hook`](../architecture/notes/nebula_app/ai_hook/)、[`input`](../architecture/notes/nebula_app/input/) 和 [`ssh_session`](../architecture/notes/nebula_app/ssh_session/)。
- 新终端代理保持选定协议,不把 SOCKS 改写成 HTTP。见 [`terminal proxy scheme`](../architecture/notes/nebula_app/ssh_proxy/2026-09-29-terminal-proxy-scheme.md)。
- Windows Acrylic 的运行库回退与窗口生命周期见 [`platform`](../architecture/notes/nebula_app/platform/2026-09-22-acrylic-controller.md)。
- Windows Acrylic 的动画期间透明回退与计时边界见 [`窗口状态切换`](../architecture/notes/nebula_app/platform/2026-09-22-acrylic-window-transitions.md)。
8 changes: 8 additions & 0 deletions nebula_app/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"en_us": "English"
},
"settings": {
"environment": {
"refresh": "Refresh system environment for new terminals",
"refresh_description": "Read current Windows environment settings when opening a terminal. Turn off to inherit the environment used to launch Pebrel, including temporary PATH entries. Open terminals are unchanged."
},
"cursor_motion": {
"title": "Smooth cursor",
"description": "Animate terminal cursor movement; large jumps remain instant.",
Expand Down Expand Up @@ -69,6 +73,10 @@
"address": {
"label": "Proxy address"
},
"terminal": {
"label": "System proxy",
"description": "When enabled, new terminals use the current Windows system proxy. A custom proxy address is applied to new terminals on its own, without this switch."
},
"status": {
"idle": "Test whether the current settings can access the network",
"running": "Testing network access with the current settings...",
Expand Down
8 changes: 8 additions & 0 deletions nebula_app/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"en_us": "English"
},
"settings": {
"environment": {
"refresh": "新建终端时刷新系统环境变量",
"refresh_description": "打开终端时读取 Windows 当前环境设置。关闭后继承启动 Pebrel 时的环境,包括临时添加的 PATH。已打开的终端不受影响。"
},
"cursor_motion": {
"title": "平滑光标",
"description": "让终端光标平滑移动,大范围跳转仍立即定位。",
Expand Down Expand Up @@ -69,6 +73,10 @@
"address": {
"label": "代理地址"
},
"terminal": {
"label": "系统代理",
"description": "打开后,新建终端使用当前 Windows 系统代理。填写自定义代理地址后,新开的终端会直接使用这个地址,不必再打开这项。"
},
"status": {
"idle": "测试当前设置是否可以访问网络",
"running": "正在通过当前设置测试网络…",
Expand Down
4 changes: 2 additions & 2 deletions nebula_app/src/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ pub(crate) fn caret_blink_on() -> bool {
}
#[cfg(feature = "gpui-shell")]
pub(crate) use network_proxy_model::{
MANUAL_PROXY_PROTOCOL_OPTIONS, ManualProxyProtocol, ProxyTestStatus, manual_proxy_parts,
manual_proxy_value,
MANUAL_PROXY_PROTOCOL_OPTIONS, ManualProxyProtocol, ProxyTestStatus, compose_manual_proxy_url,
manual_proxy_parts, manual_proxy_value,
};
pub use settings::{NebulaSettingsSection, SettingsDropdown, SettingsHit, settings_hit};
pub(crate) use settings::{NewTabPosition, SettingsOpacityTarget};
Expand Down
28 changes: 28 additions & 0 deletions nebula_app/src/display/network_proxy_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ pub(crate) fn manual_proxy_value(protocol: ManualProxyProtocol, address: &str) -
}
}

/// A recognized scheme in the address box wins over the protocol dropdown.
/// Pasting `http://127.0.0.1:7890` while SOCKS5 stays selected still persists HTTP.
pub(crate) fn compose_manual_proxy_url(
dropdown: ManualProxyProtocol,
typed: &str,
) -> (ManualProxyProtocol, String) {
let typed = typed.trim();
let (parsed, host) = manual_proxy_parts(typed);
let protocol = if host.len() == typed.len() { dropdown } else { parsed };
(protocol, manual_proxy_value(protocol, host))
}

#[cfg(test)]
mod tests {
use super::{ManualProxyProtocol, manual_proxy_parts, manual_proxy_value};
Expand All @@ -74,6 +86,22 @@ mod tests {
assert_eq!(manual_proxy_value(ManualProxyProtocol::Http, ""), "");
}

#[test]
fn typed_scheme_overrides_the_protocol_dropdown() {
use super::compose_manual_proxy_url;
let (protocol, url) =
compose_manual_proxy_url(ManualProxyProtocol::Socks5, "http://127.0.0.1:7890");
assert_eq!(protocol, ManualProxyProtocol::Http);
assert_eq!(url, "http://127.0.0.1:7890");
let (protocol, url) = compose_manual_proxy_url(ManualProxyProtocol::Http, "127.0.0.1:7890");
assert_eq!(protocol, ManualProxyProtocol::Http);
assert_eq!(url, "http://127.0.0.1:7890");
let (protocol, url) =
compose_manual_proxy_url(ManualProxyProtocol::Http, "socks5://127.0.0.1:7890");
assert_eq!(protocol, ManualProxyProtocol::Socks5);
assert_eq!(url, "socks5://127.0.0.1:7890");
}

#[test]
fn parts_accept_non_ascii_without_slicing_inside_utf8() {
for value in ["127.0.0.1:", ":127.0.0.1", "127.0:0.1", ":"] {
Expand Down
Loading
Loading