Fix terminal split layout restoration for agent sessions - #335620
Fix terminal split layout restoration for agent sessions#335620KAVYANSH KUMAR (kavyansh18) wants to merge 4 commits into
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
There was a problem hiding this comment.
🟡 Changes recommended
Asynchronous terminal creation can associate one terminal with multiple sessions, and the production restoration path lacks direct coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Preserves split-terminal grouping when switching between Agent sessions.
Changes:
- Captures parent relationships before backgrounding terminals.
- Restores parents before child terminals, with standalone fallback.
- Adds regression tests for restoration and fallback behavior.
File summaries
| File | Description |
|---|---|
terminalService.ts |
Rejoins restored terminals to parent groups. |
terminal.ts |
Exposes parent-aware group insertion. |
sessionsTerminalContribution.ts |
Captures and orders split relationships. |
sessionsTerminalContribution.test.ts |
Tests grouping and missing-parent fallback. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Mixed session-owned and standalone split groups can still lose their layout, and restoration ordering lacks effective coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/vs/sessions/contrib/terminal/browser/sessionsTerminalContribution.ts:683
- The regression test backgrounds
t1beforet2and the mock enumerates terminals in creation order, sotoShowis already parent-first; the test still passes if this entire sort is removed. Add a child-before-parent (or three-level split) case and assertshowBackgroundCallsorder so the ordering logic described here is actually exercised.
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The Show All Terminals path bypasses the new ordered restoration and can still lose split grouping or order.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🟢 Approval recommended
The behavior is focused and well-tested; only a minor documentation-style issue remains.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/vs/sessions/contrib/terminal/browser/sessionsTerminalContribution.ts:846
- This four-line JSDoc exceeds the project's 1–2 sentence limit and narrates private implementation details. Please reduce it to a concise contract statement.
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Description
Fixes #335252
When switching between Agent sessions, terminal instances were restored but their split layout was lost.
This change:
Testing
npm run -s precommit./scripts/test.sh --grep "SessionsTerminalContribution"git diff --check