Repository navigation
fix(agent-pane): don't persist agent panes into window layout (#275) - #360
Conversation
When "Restore window layout (and content)" is enabled, the agent pane was serialized into state.json like an ordinary terminal pane. Its command line embeds session-specific state -- the previous run's wta-master named pipe (--connect-master) and the old tab StableId (--owner-tab-id) -- both of which are gone after a restart. On restore WT replays that saved command line, so a fresh wta-helper tries to connect to the now-dead master pipe and fails its ACP transport (handshake_failed, os error 2 after 21 retries). Combined with the per-tab pre-warmed agent pane that each restored tab already re-creates, the window ends up littered with broken/duplicate panes. Fix: in Pane::BuildStartupActions, skip agent panes on the Persist path -- when one child of a split is an agent-pane leaf, collapse the split and only serialize the other child. Nothing is lost: cross-window move (Content / MovePane) still reattaches via ContentId, and each restored tab re-warms a fresh stashed agent pane bound to the live master. The user can re-open the agent pane after restore to get a fresh one. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR prevents agent panes (which embed run-specific wta connection state) from being serialized into the persisted window layout (state.json) during app restart restores, avoiding broken ACP transports and duplicated/bad panes on startup when “Restore window layout(/and content)” is enabled.
Changes:
- In
Pane::BuildStartupActions, special-caseBuildStartupKind::Persistto omit agent-pane leaves from persisted layouts by collapsing any split where exactly one child is an agent-pane leaf. - Keep cross-window move behavior unchanged (agent panes can still reattach via
ContentId).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a0e31d6 to
c8d1a1c
Compare
This comment has been minimized.
This comment has been minimized.
check-spelling-bot Report
|
| Dictionary | Entries | Covers | Uniquely |
|---|---|---|---|
| cspell:csharp/csharp.txt | 32 | 2 | 2 |
| cspell:aws/aws.txt | 232 | 2 | 2 |
| cspell:fonts/fonts.txt | 536 | 1 | 1 |
Consider adding to the extra_dictionaries array (in the .github/actions/spelling/config.json file):
"cspell:csharp/csharp.txt",
"cspell:aws/aws.txt",
"cspell:fonts/fonts.txt",
To stop checking additional dictionaries, put (in the .github/actions/spelling/config.json file):
"check_extra_dictionaries": []Forbidden patterns 🙅 (1)
In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.
These forbidden patterns matched content:
Should be preexisting
[Pp]re[- ]existing
Errors and Warnings ❌ (2)
See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.
| ❌ Errors and Warnings | Count |
|---|---|
| 54 | |
| ❌ forbidden-pattern | 1 |
See ❌ Event descriptions for more information.
✏️ Contributor please read this
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
- ... misspelled, then please correct them instead of using the command.
- ... names, please add them to
.github/actions/spelling/allow/names.txt. - ... APIs, you can add them to a file in
.github/actions/spelling/allow/. - ... just things you're using, please add them to an appropriate file in
.github/actions/spelling/expect/. - ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in
.github/actions/spelling/patterns/.
See the README.md in each directory for more information.
🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉
If the flagged items are 🤯 false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it,
try adding it to thepatterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
* docs(release-check-list): sync with v0.1.2 features Reviewed the release checklist against the v0.1.2 release notes and fixed two outdated statements plus added seven missing test cases for new features. Outdated statements corrected: - Session view refresh: now F5 on-demand re-scan (incl. WSL distros started after launch), not gated on hooks (#344). - Historical state: history is now sourced from ACP session/list, not on-disk file parsing (#365). Missing test cases added: - Alt+V clipboard image paste into agent chat (#354) - GitHub Enterprise Copilot sign-in (#362) - Bash/WSL shell integration incl. set -u safety (#340) - Shells self-report identity via OSC 9001;ShellType + nested-shell autofix targeting (#345) - Environment-aware answers/fixes: investigate PATH before answering/autofixing (#306) - WSL distro sessions visible and resumable in the correct distro (#323) - Agent panes not persisted into saved window layout (#360/#275) Co-authored-by: Copilot <[email protected]> * docs(release-check-list): tag new v0.1.2 cases with [new] + add 5 more Second review pass over the release checklist against the v0.1.2 release notes: - Added a [new] coverage marker to the legend and tagged all 12 genuinely-new v0.1.2 test cases with it (the two reworded existing cases — F5 refresh, ACP-sourced historical — are corrections, not new cases, so they stay untagged). - Added 5 more previously-missing cases surfaced by a closer read: - FRE execution-policy detection is correct / no false-block on probe timeout (#336/#338/#309) - wta-master death is a consistent degraded state requiring /restart, no split-brain (#329) - Session titles are clean (no bare '# AGENTS.md instructions' heading) (#355) - Focus brings the target window to the foreground (#353) - Agent-created terminals inherit the active pane profile (#366, closes #351) Co-authored-by: Copilot <[email protected]> * test(e2e): add master-death degraded-state integration test (#329); drop rolled-back WSL session checklist item Adds Feature.AgentMasterDeath.Tests.ps1: kills this app's wta-master out from under a live helper and asserts the full #329 contract end-to-end — the pane leaves Connected, the / popup is filtered to only /restart, NO master is silently respawned while degraded (anti-split-brain), and /restart brings up exactly one fresh master and reconnects. Verified passing live against the deployed dev package. Also removes the '[new] WSL distro sessions are visible and resumable' checklist item (#323) since WSL in-distro session support is being rolled back for v0.1.2, and drops the WSL example from the F5 refresh item to match. Co-authored-by: Copilot <[email protected]> * Address Copilot review: tighten master-count assertion and clarify Alt+V behavior - Feature.AgentMasterDeath.Tests.ps1: assert exactly one wta-master while connected (-Be 1, was -BeGreaterThan 0) so the connected-state gate itself catches a split-brain regression. Re-verified passing live. - release-check-list.md: correct the Alt+V item — Alt+V queues the image until the next prompt, and an unsupported agent / empty clipboard surfaces a clear system message rather than being a silent no-op. The [WSL-<distro>] raw-angle-bracket comment is already resolved: that checklist item was removed with the WSL session rollback. Co-authored-by: Copilot <[email protected]> * Address Copilot review round 2: block /stop in degraded popup test, release-agnostic [new] marker, spelling fix - Feature.AgentMasterDeath.Tests.ps1: add /stop to the blocked-slash-command list so a regression that offers /stop while transport-lost is caught (it's a real CommandKind::Stop). Re-verified passing live. - release-check-list.md: reword the [new] marker in release-agnostic terms and say when to clear it (was hard-coded to v0.1.2); fix forbidden spelling non-existent -> nonexistent (check-spelling CI). Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
Problem
Fixes #275. When
Restore window layout/Restore window layout and contentis enabled, opening the terminal after a restart fails the agent pane's ACP transport and litters the window with broken/duplicatecmdpanes.Root cause
The agent pane was serialized into
state.jsonlike an ordinary terminal pane. Its command line embeds session-specific state:Both the
--connect-masternamed pipe (the previous run'swta-master) and the--owner-tab-idare gone after a restart. On restore, WT replays the saved command line, so a freshwta-helpertries to connect to the now-dead pipe:Combined with the per-tab pre-warmed agent pane each restored tab already re-creates (which connects to the new live master fine), the window ends up with broken + duplicate panes.
Fix
Agent panes are ephemeral per-tab infrastructure and must not be persisted. In
Pane::BuildStartupActions, on thePersistpath only, when one child of a split is an agent-pane leaf we collapse the split and serialize just the other child — so no agent-pane command line is ever written to the layout.Nothing is lost:
Content/MovePane) still reattaches viaContentId— unaffected.Testing
TerminalAppLib(containsPane.cpp) — 0 errors.handshake_failedvs live-pipe success). Suggested manual regression: enable layout restore, open several tabs, close & reopen, verify the shell layout restores cleanly with no leftover agent/cmd panes.