Skip to content

agentHost: restore authentication on transport reconnect - #339454

Open
Osvaldo Ortega (osortega) wants to merge 1 commit into
mainfrom
osortega/agents/mobile-sandbox-auth-recovery
Open

Osvaldo Ortega (osortega) wants to merge 1 commit into
mainfrom
osortega/agents/mobile-sandbox-auth-recovery

Conversation

@osortega

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #339229. The transport can now reconnect, but the client still assumed that a remembered client ID meant authentication survived on the replacement connection. A host that requires authentication again can reject later requests with AuthRequired, while local authentication caching prevents a new authentication request from being sent.

  • Restore required or previously established authentication for replay and snapshot reconnects, not only fresh initialization.
  • Defer protected subscriptions reported missing before authentication, and restore subscriptions omitted from handshake snapshots after authentication.
  • Keep recovery in progress and queued actions buffered until authentication and subscription restoration settle.
  • Preserve errors for resources that remain missing or forbidden after authentication; keep the existing behavior for connections without authentication.
  • Add six regressions covering cached/resolved credentials, replay/snapshot recovery, traffic ordering, response continuity through turn completion, and terminal subscription failures.

Validation

  • Four new regressions reproduced the old behavior before the fix: readiness was reported too early and protected subscriptions were marked unavailable.
  • 321 related protocol-client, sandbox service, credential, and telemetry tests pass in Electron.
  • 122 sandbox service/credential/telemetry tests pass in each of Chromium, Firefox, and WebKit. The protocol-client suite is Electron-only and was excluded by the browser runner.
  • Targeted TypeScript diagnostics, ESLint, whitespace checks, and pre-commit hygiene pass.
  • Independent read-only review found no blocking issues.

Manual verification pending

On mobile, open a sandbox chat, send a message, switch to another app, return, and send a follow-up. Verify recovery authenticates before messages are released and that responses remain visible after completion.

The supplied logs establish the post-reconnect authentication failure. They do not identify the chat-state update that removed an earlier streamed reply, so this PR does not claim that the separate disappearing-response symptom is conclusively resolved. Live mobile validation remains pending. The separately reported regular-tunnel recovery issue is also outside this fix.

Re-establish authentication on replacement transports even when reconnect resumes an existing client. Restore protected subscriptions after authentication before reporting readiness or draining queued actions.

Add regression coverage for replay and snapshot recovery with cached or resolved credentials, response continuity, and genuinely unavailable subscriptions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 05:34

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

🔵 Needs a closer look

Authentication and subscription recovery ordering needs final human review, with live mobile background/foreground validation still pending.

Review effort: Balanced
Findings: None

What changed in this PR

Follow-up to #339229 that restores authentication on replacement transports in the shared Agent Host Protocol client.

Changes:

  • Re-authenticates during replay and snapshot recovery.
  • Restores protected subscriptions before releasing queued actions, while preserving terminal subscription errors.
  • Adds six regressions covering credentials, recovery ordering, response continuity, and subscription failures.
File Description
src/​vs/​platform/​agentHost/​test/​electron-browser/​agentHostProtocolClient.test.ts Adds authentication and subscription recovery regressions.
src/​vs/​platform/​agentHost/​browser/​agentHostProtocolClient.ts Coordinates authentication, subscription restoration, and recovery readiness.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 253b7648 Current: a2b5c979

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/DiscoverInfiniteScroll/Light
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

This branch has not been deployed

No deployments
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.

2 participants