sessions: wait for eager Agent Host creation before first send - #330575
Draft
Paul (pwang347) wants to merge 2 commits into
Draft
sessions: wait for eager Agent Host creation before first send#330575Paul (pwang347) wants to merge 2 commits into
Paul (pwang347) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9dfb4b59-c716-468a-a424-b8394af3d743
Contributor
There was a problem hiding this comment.
Pull request overview
Ensures the first Agent Host request waits for eager backend creation and subscription, preventing session-not-found races.
Changes:
- Tracks and awaits the complete eager-creation task.
- Preserves fallback behavior and adds regression tests.
- Updates provider lifecycle documentation.
Show a summary per file
| File | Description |
|---|---|
baseAgentHostSessionsProvider.ts |
Tracks and awaits eager session creation. |
localAgentHostSessionsProvider.test.ts |
Tests trust-delay ordering and fallback. |
AGENT_HOST_SESSIONS_PROVIDER.md |
Documents the updated first-send lifecycle. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
|
|
||
| async waitForEagerCreate(): Promise<void> { | ||
| if (this._eagerCreateTask) { | ||
| await raceCancellationError(this._eagerCreateTask, this.cancellationToken); |
Paul (pwang347)
marked this pull request as draft
August 13, 2026 00:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createSessionand its state subscription before dispatching the first requestFailure evidence
Recent unrelated PR runs repeatedly failed macOS Electron smoke test
Agents Window (local AgentHost) > Test Copilot CLI session via AgentHost:In the failed AHP trace, the first request subscribed to the client-allocated session before the asynchronous workspace-trust check started eager creation. The host returned
Session not found on backend; eagercreateSessionthen raced the handler fallback, and nochat/turnStartedwas dispatched for the real prompt. A passing trace consistently completedcreateSession, opened the session subscription, and only then dispatched the turn.Validation
npm run valid-layers-checknpm run typecheck-clientnode --experimental-strip-types build/hygiene.ts src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.tsgit diff --checkThe focused unit cases were added in
localAgentHostSessionsProvider.test.ts. The current checkout's generated test output was stale because the active watch task targets a different checkout, so executable validation is delegated to PR CI and the focused Flaky Smoke Tests pipeline run.