Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d38df54
fix: pin shell and playground worker authentication relays
tnaum-ms Nov 25, 2026
8c2ca3f
fix: handle worker authentication failures in surfaces
tnaum-ms Nov 25, 2026
f997696
docs: record WI-2 pre-review findings for author decisions
tnaum-ms Nov 25, 2026
e7a7c7b
docs: record approved fixes for WI-2 pre-review
tnaum-ms Nov 25, 2026
72fb52d
fix: preserve healthy shells across host-only invalidation
tnaum-ms Nov 25, 2026
8faa1ba
fix: honor the epoch established by worker sign-in
tnaum-ms Nov 25, 2026
25e686f
fix: cancel invalidated token relays on attached workers
tnaum-ms Nov 25, 2026
f5b79a3
fix: honor explicit playground connection re-pick
tnaum-ms Nov 25, 2026
fce9000
docs: record verification of the four WI-2 review fixes
tnaum-ms Nov 25, 2026
e1e0f31
chore: prepare worker relay formatting and localization for review
tnaum-ms Nov 26, 2026
2741008
fix: require a verified host identity for worker sign-in
tnaum-ms Nov 26, 2026
50cb05d
fix: report Playground sign-in recovery separately from the run
tnaum-ms Nov 26, 2026
2967db6
fix: compare worker auth mechanisms using their wire types
tnaum-ms Nov 26, 2026
a5ce99b
fix: retain the playground Entra pin after startup failure
tnaum-ms Nov 26, 2026
1e9fc14
fix: follow playground worker bindings across Save As
tnaum-ms Nov 26, 2026
56b5143
fix: preserve destination telemetry across warm Playground runs
tnaum-ms Nov 26, 2026
f9dbc4e
fix: bind worker token relay to audience environment
tnaum-ms Nov 26, 2026
a42fa23
fix: validate worker environment after rejected lookup
tnaum-ms Nov 26, 2026
1a48106
chore: fix worker token relay lint
tnaum-ms Nov 26, 2026
de06cca
test: verify sovereign worker recovery fails closed
tnaum-ms Nov 26, 2026
8a70988
docs: record the PR6a Copilot review dispositions
tnaum-ms Nov 26, 2026
6ab3abd
style: format the PR6a review fixes
tnaum-ms Nov 26, 2026
8e86157
docs: record completed PR6a handoff checks
tnaum-ms Nov 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@ verdict exists, do not start the work it gates. The fingerprint table (formerly
- **Rescheduled (2026-11-20), operator decision:** Finish PR 1 with WI-1 only. Deliver WI-2
intact after WI-4's verified identity and fingerprint and WI-7's disconnect latch exist,
retaining the planned **Sign in again** action. Do not implement the partial relay option.
- **PR6a ([#1133](https://github.com/microsoft/vscode-documentdb/pull/1133)):** The complete relay
and recovery flow is in a draft stacked on PR6. The operator approved all four fixes in the
[AI pre-review](./01-pr6a-worker-token-relays-review.md). All four are implemented; the combined
Case 1 build and 534 focused tests passed. Live Shell and Playground verification stays at OP-6.

---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# PR6a pre-review: Shell and Playground token relays

[PR #1133](https://github.com/microsoft/vscode-documentdb/pull/1133) · WI-2 · reviewed head `8c2ca3fdc`

Claude Opus 5.5 performed the first pass. OpenAI GPT-5.6-Luna validated both findings and
independently found two more. There were no GitHub Copilot review threads on the draft at this
head. Findings are based on code inspection; the initial Case 1 build and 310 focused tests
passed, but those tests did not exercise the failing cases below.

## F1. Successful Sign in again does not restart the worker (high)

[`signInAgain`](../../../../../src/commands/signInAgain/signInAgain.ts#L172) replaces the host
client and advances its epoch. Both [Shell](../../../../../src/documentdb/shell/DocumentDBShellPty.ts#L950)
and [Playground](../../../../../src/commands/playground/executePlaygroundCode.ts#L401) reject this
successful result because it does not match the epoch captured before sign-in. The worker then
remains blocked and offers the same action again.

**Recommendation:** Before opening sign-in, confirm the notification still belongs to the
same shell revision or document binding. After sign-in, check that the exact epoch returned
by that sign-in is still current and that the same surface owns the action. Do not accept
arbitrary newer epochs or remove the fence. Test a successful epoch change and a superseding
invalidation without replaying the old operation.

**Author decision:** Approved as recommended. Use the confirmed post-sign-in epoch without
loosening the ownership checks or replaying the operation.

**Fixed:** [`8faa1ba8f`](https://github.com/microsoft/vscode-documentdb/commit/8faa1ba8f).
Shell and Playground use the confirmed epoch and reject stale or superseded recovery
actions. The two surface suites passed 99 tests, including no replay.

## F2. Re-picking a Playground connection leaves Run blocked (medium)

The [connection picker](../../../../../src/commands/playground/connectDatabase.ts#L120) updates
the document binding, but the [evaluator](../../../../../src/documentdb/playground/PlaygroundEvaluator.ts#L194)
keeps the previous worker's authentication failure for the whole cluster. The next Run can
reject before it checks the new binding.

**Recommendation:** Let an explicit re-pick advance past that failed worker on the next
deliberate Run, after the existing identity and execution checks. Do not stop an evaluator
from the picker: another document may be using it. Separate failure tracking for every
document would be more complex without removing the need to replace the failed worker.
Test successful re-pick and Run, preservation of the old binding's identity, and a second
document's in-flight run.

**Author decision:** Approved as recommended. Apply the explicit re-pick on the next Run
without interrupting another document.

**Fixed:** [`f5b79a3e9`](https://github.com/microsoft/vscode-documentdb/commit/f5b79a3e9).
The re-pick is scoped to that document and used on its next Run. The picker never stops
an active worker, and other documents cannot inherit the new binding. The two focused
Playground suites passed 51 tests.

## F3. A no-op saved edit can discard healthy Shell state (medium)

The [Shell manager](../../../../../src/documentdb/shell/ShellSessionManager.ts#L227) kills a
healthy worker when the host epoch changes. [Saving unchanged settings](../../../../../src/commands/saveConnectionEdit.ts#L54)
can advance the host epoch even though the Shell remains connected and the identity has not
changed. The next command then loses the Shell's variables and cursors.

**Recommendation:** Keep the healthy Shell worker across a host-only epoch change. Keep the
epoch fence for startup and token replies, and keep the latch and fingerprint checks before
respawn. Do not add a separate epoch counter. Test that a no-op edit does not respawn the
healthy worker, while explicit Disconnect still stops it.

**Author decision:** Approved as recommended. Preserve healthy Shell state on an unchanged save.

**Fixed:** [`72fb52da6`](https://github.com/microsoft/vscode-documentdb/commit/72fb52da6).
A host-only invalidation no longer restarts a healthy Shell. The startup, latch and
explicit Disconnect checks remain in effect.

## F4. A stale token request can hang a worker that is still attached (medium)

The [host relay](../../../../../src/documentdb/auth/WorkerTokenRelay.ts#L71) drops the token reply
when the host epoch changes, even if the worker is still attached. The worker is awaiting
that reply and a warm evaluation has no IPC timeout. The existing late-reply test only
covers a worker that has been terminated.

**Recommendation:** Keep ignoring detached workers. Settle an obsolete request on a worker
that is still attached with a bounded lifecycle cancellation. Do not send the stale token,
update diagnostics, or replay the evaluation. Adding a timeout alone would leave the
request running until the timeout and would not express why it was interrupted. Test
invalidation with an attached worker and no stale token or diagnostics.

**Author decision:** Approved as recommended. Cancel the obsolete request without returning a
stale token or recording a stale failure.

**Fixed:** [`25e686f93`](https://github.com/microsoft/vscode-documentdb/commit/25e686f93).
The supervisor cancels an obsolete operation and discards its attached worker. Detached
replies remain ignored. The combined F3 and F4 focused suites passed 114 tests.

## Scope clarification

[Decision 0018](../decisions.md#0018-saved-connection-edits-permanently-lock-existing-views)
retires registered webviews after a saved settings change. It does not make Shell terminals
or Playground documents Close-only. WI-2 and
[D12](../../sovereign-clouds/decisions.md#d12-open-sessions-keep-what-they-started-with)
allow a needed same-identity respawn after a password-only edit, but do not require a healthy
Shell worker to restart.

## Verification after the fixes

Case 1 passed on `f5b79a3e9`: `npm run build` and 534 focused tests across 18 suites.
The packaged live checks remain at OP-6.

## Copilot review follow-up

The advisor confirmed that a worker-only account pin cannot complete host recovery.
[`27410085f`](https://github.com/microsoft/vscode-documentdb/commit/27410085f) requires a
matching host-verified pin before offering **Sign in again**. Otherwise, the existing
surface guidance points to the tree; no worker-learned identity is promoted to a host pin.

- A Playground document retains the account learned before a later startup failure
([`a5ce99b97`](https://github.com/microsoft/vscode-documentdb/commit/a5ce99b97)).
- Late binding capture follows the same Playground connection through Save As but not
through an explicit re-pick ([`1e9fc1446`](https://github.com/microsoft/vscode-documentdb/commit/1e9fc1446)).
- Warm Playground runs retain the worker's destination metadata without reading cached
credentials ([`56b5143c8`](https://github.com/microsoft/vscode-documentdb/commit/56b5143c8)).
- The notification action records its own Playground sign-in outcome rather than writing
to the completed Run event ([`50cb05dc3`](https://github.com/microsoft/vscode-documentdb/commit/50cb05dc3)).
- A worker keeps its token audience and sign-in environment together and refuses cloud
or authority changes ([`f9dbc4ee0`](https://github.com/microsoft/vscode-documentdb/commit/f9dbc4ee0)).
The environment check also runs when a current token lookup rejects
([`a42fa23f8`](https://github.com/microsoft/vscode-documentdb/commit/a42fa23f8)).

The [configuration-guidance finding](https://github.com/microsoft/vscode-documentdb/pull/1133#discussion_r4704910161)
is not being changed in this PR. Some cloud or managed identity configuration errors
still receive the generic worker retry guidance. Keeping the bounded worker failure
contract avoids expanding error transport or adding a second guidance path just for these
failures. The tree connection and **Diagnose Connection** remain available for configuration
troubleshooting.

The operator approved the sovereign-auth integration expectations after the full test run:
a warm Entra worker keeps the original token audience but refuses renewal if the configured
provider, cloud or authority changes. A different destination requires a new Shell or an
explicit Playground re-pick. Same-identity respawn and managed identity's existing audience
snapshot are unchanged.

**Case 2 handoff:** Localization, formatting, lint, build, strict workspace test
type-checking, 9,959 tests across 444 suites (one skipped), and VSIX packaging passed.
The VSIX was built for verification, not published as a new operator candidate.
Loading
Loading