Skip to content

automations: fix: preserve view during run archival - #334032

Merged
Ulugbek Abdullaev (ulugbekna) merged 1 commit into
mainfrom
ulugbekna/agents/remove-top-automation-switch-view
Sep 2, 2026
Merged

automations: fix: preserve view during run archival#334032
Ulugbek Abdullaev (ulugbekna) merged 1 commit into
mainfrom
ulugbekna/agents/remove-top-automation-switch-view

Conversation

@ulugbekna

Copy link
Copy Markdown
Contributor

Summary

Preserve the Automations custom view when the underlying active Automation run is archived or when provider-driven session/chat lifecycle changes select a fallback.

Explicit session and chat open actions continue to dismiss the custom view.

Problem

Automation History renders provider-backed sessions while the Sessions grid remains alive behind the full-surface Automations view.

If the underlying active run was archived, SessionsService reacted by opening the new-session composer. That automatic fallback used the same navigation path as an explicit user action, so it called hideCustomView(), navigated away from Automations, and cleared the persisted custom-view selection.

Fix

  • Distinguish explicit open actions from automatic lifecycle reconciliation.
  • Keep custom-view dismissal separate from open cancellation.
  • Preserve the active custom view while reconciling:
    • an archived active session;
    • a removed active session, with or without another visible fallback;
    • a removed active chat.
  • Keep explicit session, chat, New Session, and Quick Chat opens dismissing custom views.
  • Report failures from detached automatic fallback promises through onUnexpectedError.
  • Clarify the explicit-open versus reactive-fallback contract in the Sessions layout specification.

The implementation remains provider-neutral and does not special-case the Automations view ID.

Important behavior

Trigger Reconcile hidden Sessions state Dismiss custom view
Explicitly open a session/chat Yes Yes
Explicitly open New Session/Quick Chat Yes Yes
Active session becomes archived Yes No
Provider removes the active session Yes No
Provider removes the active chat Yes No

An explicit folder-less New Session action also dismisses the custom view when the hidden grid is already on its empty slot. The no-op automatic fallback remains before open-token acquisition, so it cannot cancel an unrelated pending explicit open.

Tests

Added focused coverage for:

  • archiving the active session while a custom view is visible;
  • active-session removal without a fallback;
  • active-session removal with another visible fallback;
  • active-chat removal;
  • explicit open actions dismissing the custom view;
  • no-op automatic fallback remaining inert during delayed explicit navigation.

Validation:

  • npm run typecheck-client
  • ./scripts/test.sh --run src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts
    • 115 passing
    • 2 pre-existing pending
  • git diff --check

Manual verification

Repeated the reported sequence in an isolated Agents Code OSS window:

  1. Open an unarchived Automation history run.
  2. Return to Automations.
  3. Archive the same run.

Verified at both the default wide viewport and 1208×768:

  • Automations remained visible.
  • The run remained in History as archived.
  • Its Archive action disappeared.
  • Neither the new-session composer nor the Files/editor pane became visible.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bd312c9c-1961-430a-a572-bd4cd6a47441
Copilot AI balanced review requested due to automatic review settings September 2, 2026 16:17
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Sandeep Somavarapu (@sandy081)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsService.ts
  • src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts

Ladislau Szomoru (@lszomoru)

Matched files:

  • src/vs/sessions/services/sessions/browser/sessionsService.ts
  • src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation is localized, provider-neutral, and adequately covered by focused tests.

Review tier: Balanced
Findings: None

What changed in this PR

Preserves active custom views while Sessions reconciles automatic lifecycle changes.

Changes:

  • Separates explicit navigation from automatic fallback behavior.
  • Reports detached fallback failures and adds focused regression tests.
  • Documents the custom-view navigation contract.
File Description
src/​vs/​sessions/​services/​sessions/​browser/​sessionsService.ts Adds navigation intent handling.
src/​vs/​sessions/​services/​sessions/​test/​browser/​sessionsManagementService.test.ts Covers archival, removal, fallback, and explicit navigation.
src/​vs/​sessions/​LAYOUT.md Documents dismissal behavior.

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

@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit be08585 into main Sep 2, 2026
60 of 62 checks passed
@ulugbekna
Ulugbek Abdullaev (ulugbekna) deleted the ulugbekna/agents/remove-top-automation-switch-view branch September 2, 2026 20:21
@vs-code-engineering vs-code-engineering Bot added this to the 1.137.0 milestone Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants