Skip to content

PR6a: Renew Shell and Playground sign-in without interruption - #1133

Merged
Tomasz Naumowicz (tnaum-ms) merged 23 commits into
feature/connection-lifecyclefrom
dev/tnaum/connection-lifecycle-worker-relays
Nov 26, 2026
Merged

Tomasz Naumowicz (tnaum-ms) merged 23 commits into
feature/connection-lifecyclefrom
dev/tnaum/connection-lifecycle-worker-relays

Conversation

@tnaum-ms

@tnaum-ms Tomasz Naumowicz (tnaum-ms) commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

Shell and Query Playground can renew Microsoft Entra tokens silently with the account that opened them. When that account needs attention, Sign in again is an explicit, non-modal action. It keeps the terminal or query open, does not switch accounts, and does not rerun the interrupted command.

Why

The deferred WI-2 closes the renewal gap between the extension and its isolated workers. Keeping the worker bound to its original identity avoids silently treating a saved edit or a different account as a reconnect. As in the approved WI-2 plan, new, user-initiated sessions without a verified account may authenticate on their first relay; an existing pinned session never prompts from a relay (A1).

Scope

Based on feature/connection-lifecycle after #1130 merged: WI-4 supplies the verified identity and WI-7 supplies the disconnect latch (OP-5 cleared). Saved-edit retirement remains unchanged for open webviews. The worker relay is delivered intact, with a separate Playground sign-in event; renewal metrics and the user manual are in PR7.

Validation

  • Case 1: build and 534 focused tests passed across 18 suites on f5b79a3e9.
  • The AI pre-review is complete, including all four approved fixes. Seven Copilot findings were fixed in dedicated commits and one was declined with the rationale in its thread. All eight threads were answered and resolved.
  • Local Case 2 passed: localization, formatting, lint, build, strict workspace test type-checking, 9,959 tests passed (one skipped), and VSIX packaging.
  • OP-6 will verify separate Shell renewal on a fresh socket after the real idle wait, as well as Shell and Playground recovery in the packaged VSIX.

Part of #1102. See the WI-2 plan.

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

Copy link
Copy Markdown
Collaborator Author

Pre-review F1 fixed. Successful Shell and Playground sign-in accepts the confirmed post-sign-in epoch and still rejects superseded actions. No command is replayed. Fix commit.

@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

Pre-review F2 fixed. An explicit Playground re-pick unblocks the next deliberate Run for that document, without interrupting another document. Fix commit.

@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

Pre-review F3 fixed. A healthy Shell keeps its session state across host-only invalidation, including an unchanged save. Fix commit.

@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

Pre-review F4 fixed. An obsolete relay on an attached worker cancels the operation and discards that worker without publishing the old token or diagnostics. Fix commit.

Base automatically changed from dev/tnaum/connection-lifecycle-teardown to feature/connection-lifecycle November 25, 2026 22:42

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.

🟡 Changes recommended

Unresolved critical defects allow token requests through changed authorities and Playground account switches without re-picking after Save As or failed startup.

8 open issues
What changed in this PR

Extends the connection-lifecycle work in #1130 to Shell and Query Playground workers, supporting same-account Microsoft Entra renewal and explicit recovery without closing the surface or automatically replaying interrupted commands.

Changes:

  • Centralizes worker token renewal with pinned identities, destination checks, and lifecycle safeguards.
  • Adds non-modal Sign in again actions and controlled replacement of failed workers.
  • Adds document-level Playground bindings, regression coverage, and implementation-review records.

The PR reports Case 1 build and 534 focused tests passed. Full Case 2 checks, including prettier-fix, remain deferred until the draft is ready for review.

File Description
src/​documentdb/​shell/​ShellSessionManager.ts Adds pinned renewal and recovery safeguards.
src/​documentdb/​shell/​ShellSessionManager.test.ts Covers renewal, respawn, and invalidation.
src/​documentdb/​shell/​DocumentDBShellPty.ts Adds actionable Shell sign-in recovery.
src/​documentdb/​shell/​DocumentDBShellPty.test.ts Tests non-modal recovery and stale actions.
src/​documentdb/​playground/​workerTypes.ts Defines bounded authentication failure messages.
src/​documentdb/​playground/​WorkerSessionManager.ts Supervises failed workers and invalidated requests.
src/​documentdb/​playground/​WorkerSessionManager.test.ts Covers error reconstruction and lifecycle cancellation.
src/​documentdb/​playground/​types.ts Adds document identity and replacement bindings.
src/​documentdb/​playground/​playgroundWorker.ts Preserves callback failures across worker boundaries.
src/​documentdb/​playground/​playgroundWorker.test.ts Tests authentication failures during startup and execution.
src/​documentdb/​playground/​PlaygroundService.ts Captures host and worker document bindings.
src/​documentdb/​playground/​PlaygroundService.test.ts Tests binding capture and explicit re-picks.
src/​documentdb/​playground/​PlaygroundEvaluator.ts Enforces pinned execution and controlled worker replacement.
src/​documentdb/​playground/​PlaygroundEvaluator.test.ts Covers identity checks and recovery without replay.
src/​documentdb/​ClustersClient.ts Computes fingerprints from current credentials.
src/​documentdb/​ClustersClient.test.ts Tests password-free, identity-qualified fingerprints.
src/​documentdb/​auth/​WorkerTokenRelay.ts Shares host-side token acquisition between workers.
src/​commands/​signInAgain/​signInAgain.ts Adds same-account worker recovery entry points.
src/​commands/​signInAgain/​signInAgain.test.ts Tests account rejection and worker-only recovery.
src/​commands/​playground/​newPlayground.ts Captures host bindings for new documents.
src/​commands/​playground/​executePlaygroundCode.ts Displays bounded failures and offers recovery.
src/​commands/​playground/​executePlaygroundCode.test.ts Tests recovery ownership and result preservation.
src/​commands/​playground/​connectDatabase.ts Captures bindings after explicit connection selection.
docs/​ai-and-plans/​features/​connection-lifecycle/​iterations/​01-pr6a-worker-token-relays-review.md Records pre-review findings, decisions, and validation.
docs/​ai-and-plans/​features/​connection-lifecycle/​iterations/​01-dev-plan.md Updates relay implementation and live-validation status.

Review effort: Max

Comment thread src/documentdb/auth/WorkerTokenRelay.ts Resolved
Comment thread src/commands/signInAgain/signInAgain.ts Resolved
Comment thread src/documentdb/auth/WorkerTokenRelay.ts Resolved
Comment thread src/documentdb/auth/WorkerTokenRelay.ts Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses Copilot review comment 4704909901.

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added this to the 1.2.0 milestone Nov 26, 2026
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) marked this pull request as ready for review November 26, 2026 11:21
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: standard tier (ready PR)

Commit 8e86157, workflow run.

Layer Result Ran or skipped because
Static checks ✅ passed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ⏭️ skipped no change to packages/**, package-lock.json or the CI workflow
VSIX: inspect contents ✅ passed ready PR
VSIX: self-test of the checks ⏭️ skipped no change to build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow
VSIX: activate in VS Code ✅ passed ready PR
VSIX: self-test of the activation check ⏭️ skipped no change to build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow
Webview host in unbundled extensions ⏭️ skipped no change to packages/vscode-ext-webview/**, package-lock.json or the CI workflow
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Full run: add the ci:full-requested label to run every layer once on the current commit.
No full run yet.

Code quality

Check Status How to fix
Localization (l10n) ✅ Passed Nothing to fix
ESLint ✅ Passed Nothing to fix
Prettier formatting ✅ Passed Nothing to fix

Build size

No size data for feature/connection-lifecycle yet; sizes only. VSIX: 8.8 MiB.

Artifacts: VSIX | Bundle-reports-45809885922 | L1-manifest-report-45809885922

All graphs (exact bytes)
Graph PR bytes
Collection View page (collectionView) 6,058,236
Document View page (documentView) 4,826,019
Local Quick Start page (localQuickStart) 1,592,278
Atlas Credentials page (atlasCredentials) 1,520,944
Cluster Dashboard page (clusterDashboard) 1,570,044
Diagnose Connection page (connectionDiagnostics) 1,543,859
Activation (mainStartup) 3,225,276
Extension host (main) 9,801,864
Playground worker (playgroundWorker) 5,416,927
VSIX (vsix) 9,263,272
playgroundTsPlugin 6,175
viewsEntry 1,468,371
viewsAssets 80,340
editorWorker 259,570
jsonWorker 389,427

Packaged bytes. Shared chunks count in every graph that loads them, so rows do not add up.

Updated in place on every run.

@tnaum-ms
Tomasz Naumowicz (tnaum-ms) merged commit 724127d into feature/connection-lifecycle Nov 26, 2026
18 of 21 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/tnaum/connection-lifecycle-worker-relays branch November 26, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants