fix(mission): size backend-started forks and log launch widths - #372
Merged
Conversation
Two determined fixes plus diagnostics for the launch-resume width thread: - #367: cache the frontend's mission pane grid in AppState (mission_grid_hint_set), pushed after the launch settle gate (unconditionally), from workspace measurements, and from every real slot-terminal geometry push. MCP mission_start/mission_reset consume it when unsized, so slots no longer fork at 80x24 and lose their scrollback to the first slot-tab visit's cols-gate purge. - #371: shellContentBox returns null on failed measurement (no window.innerWidth fallback) and targets AppShell's main via data-shell-main, immune to SettingsPage's second <main>. Null propagates so launchDimsFor falls to the persisted rung. - #366 diagnostics (info level, reaches the packaged rotating log): per-fork lines after successful runtime.spawn (resume paths + mission slots, with size source), cols-gate purge lines with old->new cols, and [launch-dims] frontend lines routed through a new frontend_log command — settle outcome, per-resumed-session rung detail, and first-fit for launch-resumed sessions only (launchResumeTrace). - docs: renumber duplicate impl 0036-launch-resume-fork-width to 0038 and update every in-repo reference. Closes #367. Closes #371. Refs #366. Checks: cargo test --workspace, cargo fmt --check, tsc --noEmit, eslint, vitest 248/248; peer-reviewed working-tree diff (clean).
This was referenced Jul 29, 2026
Closed
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.
Two determined fixes plus diagnostic logging for the launch-resume width thread (#366).
#367 — MCP-started missions fork slots at 80×24, first slot visit purges scrollback
AppState.mission_grid_hintcaches the frontend's most recent known-good mission pane grid, pushed via the newmission_grid_hint_setcommand: once per launch after the window-geometry settle gate (unconditionally — not gated on resume-on-launch), on every workspace measurement (reset / resume-all), and on every real slot-terminal geometry push (newonSizePushedcallback threaded throughSlotPtyPane).mission_start_impl_with_sizeandmission_reset_implconsume the hint when the caller passes no size (the MCP reset tool had the identical hardcoded-Nonedefect), falling toDEFAULT_PTY_SIZEonly when no hint was ever recorded. The cols-gate purge itself is untouched — it remains correct for genuinely stale-width bytes (impl 0020 / feat: headless terminal model for durable session scrollback #306).mission_fork_sizeresolver triple, register-level default, and two seam tests driving resolver output throughregister_mission_session+complete_mission_session_spawnasserting the actually-forkedSpawnSpec.initial_size.#371 —
shellContentBoxfalls back to full-window width and can read the wrong<main>nullon failed measurement (neverwindow.innerWidth, which includes the sidebar); null propagates throughmissionPaneAreaBox/chatPaneAreaBox/estimateMissionTerminalGridandlaunchDimsForso the persisted rung takes over.main[data-shell-main](stamped on AppShell's<main>), immune to SettingsPage's second<main>under the takeover.<main>selection, null propagation.#366 — instrumentation (mechanism still undetermined; one production repro should answer it)
All info-level so it reaches the packaged build's rotating file log:
runtime.spawn(resume / resume-on-launch / mission slots) with session, runtime, cols×rows, and size source; cols-gate purge lines with old→new cols.frontend_logcommand routes[launch-dims]lines into the same file — settle outcome + elapsed ms per launch, per-resumed-session rung detail (main rect, rail/panel widths, pane share, resulting grid), and first-fit for launch-resumed sessions only (launchResumeTracemark/consume).Docs
Duplicate impl number resolved:
0036-launch-resume-fork-width.md→0038(git mv), all in-repo references updated;0036-trae-runtime.mdkeeps its number.Verification
cargo test --workspace(556 across suites),cargo fmt --check,cargo clippy --workspace,tsc --noEmit,eslint,vitest248/248. Peer-reviewed working-tree diff — clean review, plus dev-build smoke: settle/hint/rung/fork/first-fit/purge lines all present and cross-correlated inrunner.log.Closes #367. Closes #371. Refs #366.
🤖 Generated with Claude Code