Skip to content

fix(gpui): open the startup window at config.window.dimensions - #313

Merged
Kuddev merged 15 commits into
Kuddev:mainfrom
WilliamWang1721:codex/issue-312-window-startup-size
Sep 30, 2026
Merged

Kuddev merged 15 commits into
Kuddev:mainfrom
WilliamWang1721:codex/issue-312-window-startup-size

Conversation

@WilliamWang1721

@WilliamWang1721 WilliamWang1721 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Refs #312. config.window.dimensions was validated by pebrel config check and then ignored by the running app: the default GPUI shell had no reader for config.window.* at all, and its startup geometry came from a hard-coded 116x30 built-in canvas. A user who wrote columns = 155, lines = 43 in pebrel.lua always got the same window.

Changes

  • gpui_shell::config::StartupWindow reads the grid once during shell init through config::source::discover + config::load_source — the same entry points pebrel config check uses. Lua, TOML and YAML therefore work through one path, with the precedence the rest of the app already applies.
  • prepare_initial_grid multiplies that grid by the cell it measures in the window's own scale domain. Keeping the configured value a grid rather than pixels is what makes 155x43 land correctly at 125% scaling without the shell ever knowing the scale factor. Unset config keeps the 116x30 canvas; an oversized grid keeps the existing 95%-of-display clamp, which shrinks the grid instead of pushing the window off screen.
  • The value deliberately does not live in Settings: that global reloads on every settings-page write, and user Lua should not be re-evaluated on that path.
  • Rationale and rejected options: architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md.

Not covered

config.window.position still does nothing in the GPUI shell. gpui accepts placement only at window creation and only in logical pixels, and exposes no app-level scale factor, whereas the legacy shell hands winit a physical position. Forwarding the raw numbers would place the window about a fifth of the screen away from the requested spot at exactly the scaling in the report, so it is left unwired rather than shipped wrong. startup_mode, decorations and dynamic_title remain legacy-only for the same reason.

Validation

  • Added the focused CLI regression that parses --config-file and confirms the selected Lua file supplies startup dimensions.
  • No local build, tests, or automated checks were run for this follow-up.
  • Synced with upstream main at 360613a in merge commit 57329fb; the branch retains its earlier 77e6470 merge.
  • The prior Full native tests run for head 0aea9b1 failed to compile because two GPUI test setup callers omitted the new startup-config argument; f4ef373 fixed both by passing None.
  • On previous head 57329fb, PR size run 36451857204 succeeded. Full native tests run 36451857529 failed: Tests (macos-26-intel) job 109028517735 ended with failure while Test complete workspace and native harness remained in_progress; its log download returned BlobNotFound, so no test-level failure text was available. The two Release workspace jobs (109067603489, 109067603477) reported only Native validation did not succeed: failure. GitHub rejected --failed rerun with cannot be rerun; its workflow file may be broken. No PR-specific root cause is established from the available evidence. Full native run · macOS Intel job.
  • Current head f40938a adds only an empty commit to retrigger required CI. PR size run 36464855985, Architecture contracts run 36464856182, and Full native tests run 36464856992 are queued; post-retrigger validation is pending.
  • Historical startup comparison: personal-fork Actions run 36427911961 succeeded on Ubuntu 24.04 / Rust 1.97.1. Under Xvfb, the same locked Release build and representative Lua config were used for three starts per revision; time is process launch to first viewable X11 window and memory is Linux VmHWM sampled then. Base cff2334: median 185.8 ms (153.4–1611.6), median 154.2 MiB (153.4–192.7). Head 0aea9b1: median 154.0 ms (153.3–157.1), median 155.0 MiB (154.2–156.0). This comparison predates the 77e and 360 syncs and does not validate the current head.
  • Historical startup comparison after base 77e6470: personal-fork Actions run 36434634226 succeeded on Ubuntu 24.04 / Rust 1.97.1 using the same locked Release build and Lua config. Base 77e6470: median 191.5 ms (189.9–2218.9), median 167.3 MiB (153.5–168.7). Head ae578b0: median 189.5 ms (189.0–190.3), median 160.6 MiB (155.9–165.6). The 360613 font-registration change affects pre-window startup work, so these values are not current-head evidence; the base run's first sample was a large outlier.
  • Current-main startup comparison: personal-fork Actions run 36452070689 succeeded on Ubuntu 24.04 / Rust 1.97.1. It used the same locked Release build and representative Lua config for three interleaved starts per revision under Xvfb; time is process launch to first viewable X11 window and memory is Linux VmHWM sampled then. Base 360613a: median 191.9 ms (191.8–1803.1), median 167.6 MiB (154.1–168.0). PR head 57329fb: median 191.3 ms (190.7–193.4), median 164.0 MiB (155.8–166.5). The first base sample (1803.1 ms) is a clear outlier; three samples on one Ubuntu runner do not resolve small differences or establish a universal performance guarantee. This is supporting evidence from the personal fork, not upstream PR CI or Windows 11 at 125% acceptance.
  • Manual Windows 11 / 125% visual acceptance remains open.

Test plan

  • CI green on this PR.
  • Windows 11 at 125%: config.window.dimensions = { columns = 155, lines = 43 } opens the window at that grid instead of 116x30.
  • With the key removed, the default startup size is unchanged.
  • With columns = 1, lines = 1, the window clamps to the terminal minimum rather than failing to open.

AI assistance: GPT-6 Luna (max).

The default shell had no reader for `config.window.*`, so `pebrel config
check` accepted a window size the GUI then ignored: every start used the
built-in 116x30 canvas regardless of the user's file.

Read the grid once during shell init through the same discovery and parse
entry points `pebrel config check` uses, so Lua, TOML and YAML all work and
precedence matches the rest of the app. It stays a grid rather than pixels:
the existing sizing path multiplies it by the cell it measures in the
window's own scale domain, which keeps 155x43 correct at 125% scaling.

`config.window.position` is deliberately not wired here. gpui accepts
placement only at window creation, in logical pixels, and exposes no
app-level scale factor, while the legacy shell hands winit a physical
position; passing the raw numbers through would place the window a fifth of
the screen off at exactly the scaling the report uses.

Refs Kuddev#312
@WilliamWang1721

Copy link
Copy Markdown
Contributor Author

CI evidence (commit ab2e392)

All 10 checks on this PR report green in upstream CI (Full native tests run 36288372951, event pull_request, head ab2e39200bc34d2365e9032d50238636ff50aa32); windows-diagnostics is skipped by design because it is dispatch-only.

The two new tests run in that matrix — CI builds the workspace with --features nebula/gpui-test-support, so the #[gpui::test] case is included:

PASS [0.040s] (649/2288) nebula::bin/pebrel gpui_shell::config::tests::lua_window_dimensions_reach_the_startup_grid
PASS [0.035s] (652/2288) nebula::bin/pebrel gpui_shell::config::tests::startup_grid_follows_window_dimensions

This replaces the local run that could not be performed: cargo check -p nebula fails here at the gpui_macos build script (xcrun: error: unable to find utility "metal", Command Line Tools only). Nothing in this PR was validated in a personal repository — the runs above are upstream CI on this PR.

Still open on the reporter's side, and not covered by any check here: the Windows 11 / 125% visual acceptance row in the test plan.

@Kuddev Kuddev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Review 状态:已检查配置发现/解析、默认值与最小网格语义;当前主线集成尚未通过,暂不批准合并。#251 已把 prepare_initial_grid 移到 workspace/windowing/startup_geometry.rs,并增加显示窗口前的 preferred_size。因此本 PR 与当前 main 有真实冲突,解决时需要让 preflight 和 post-creation 两条路径都使用同一个配置网格计算,保留基准字体/终端缩放区分、DPI 量化、屏幕上限和最小窗口规则,而不是只保留任意一侧。新增完整配置读取和可能的 Lua 求值位于首次开窗前的主线程;性能优先下也需要明确这条新增启动路径的成本。已在隔离 worktree 验证冲突存在,随后撤销该临时 merge;没有修改或推送本 PR 的生产代码,也未触碰主工作区。

@Kuddev Kuddev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

更新后的复审(5788e0f):此前与 #251 的尺寸计算冲突已经解决,不再将旧冲突作为阻塞理由。已核对当前 effective diff:startup_geometry 的 preferred_size/preflight 和 prepare_initial_grid 都把 config::startup_grid 传入同一个 default_size,保留字体度量、DPI、屏幕上限与首帧路径。

仍暂不批准合并:

  • 当前精确 head 的必需 lint 检查失败,其他平台显示跳过不等同于验证通过。
  • 性能/内存优先级下,gpui_shell::init 新增的 StartupWindow::load 在首次开窗前同步调用完整 config::load_source;Lua 路径执行 load_lua_file 的 eval,而非仅读取两个网格整数。临时 Lua/config 对象随后释放,未看到新增逐帧处理或常驻服务;但现有新增测试只覆盖解析和网格值,尚未证明新增同步路径的启动耗时与峰值内存成本。请给出同一构建配置下代表性配置的基线/修复后对照,再决定是否接受这项启动路径变化。

本次只更新 review,没有修改或推送 PR 的生产代码,也没有改动本地主工作区。

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Propagate the selected --config-file source into GPUI startup configuration loading.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR makes GPUI startup sizing honor config.window.dimensions with scale-aware sizing, defaults, clamping, tests, and architectural documentation.

Changes:

  • Loads dimensions from Lua, TOML, or YAML during shell initialization.
  • Applies configured grid dimensions to the initial window size.
  • Preserves default sizing and minimum/display clamping.
  • Documents design decisions and limitations.

The explicit --config-file path is not currently propagated to GPUI startup configuration loading, so the window may use a different configuration source.

File Summary
nebula_app/​src/​gpui_shell/​workspace/​windowing/​startup_geometry.rs Uses configured grid dimensions for startup window sizing.
nebula_app/​src/​gpui_shell/​mod.rs Registers startup configuration during initialization.
nebula_app/​src/​gpui_shell/​config.rs Loads and exposes startup dimensions; must honor the selected explicit configuration file.
architecture/​notes/​nebula_app/​gpui_shell/​2026-09-27-config-window-startup-size.md Documents the design and tradeoffs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread nebula_app/src/gpui_shell/config.rs Resolved

@Kuddev Kuddev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

[P2] Honor the explicitly selected configuration source. StartupWindow::load calls discover(None), while the GPUI entry path returns before config::load(&mut options) and does not pass --config-file into this initializer. With a selected file containing window.dimensions and a different discovered/default file, startup geometry comes from the wrong source. The current tests directly call load_lua_file/from_config and therefore do not exercise this public CLI path. Please thread the selected source into bootstrap and add a focused explicit-config regression.

Performance review: the separate StartupWindow lifetime correctly avoids reevaluating Lua on every settings save. It still evaluates the full selected config synchronously before the first window; that cold-path cost should stay one-time. All current source checks are green, but this source-selection problem remains. Excluded from the batch.

@Kuddev
Kuddev merged commit 8d9bf38 into Kuddev:main Sep 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants