Skip to content

agentHost: add local host restart command - #329839

Merged
roblourens merged 2 commits into
mainfrom
roblou/agents/force-restart-local-agent-host
Aug 9, 2026
Merged

roblourens merged 2 commits into
mainfrom
roblou/agents/force-restart-local-agent-host

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

  • add Developer: Restart Local Agent Host to desktop editor and Agents windows
  • restart the shared utility process through its main-process lifecycle owner and reconnect all local clients immediately
  • preserve fresh-host subscriptions and restore cold sessions before applying actions so existing chats and tool confirmations continue after restart

Validation

  • launched an isolated authenticated Code OSS build with three connected windows
  • completed a persisted Agent Host turn, restarted the host, and immediately continued the same chat
  • verified a real web_fetch confirmation appeared, approval reached the provider, and the turn completed
  • verified all three windows began reconnecting immediately and reconnected in about 1.1 seconds
  • 9 focused lifecycle/protocol tests passed
  • npm run typecheck-client
  • npm run valid-layers-check

(Written by Copilot)

Add a Developer command that replaces the shared local Agent Host process and reconnects every local client immediately. Preserve fresh-host subscriptions and restore cold sessions before applying queued actions so existing chats and tool confirmations continue after restart.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 9, 2026 18:21

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.

Pull request overview

Adds a desktop command to restart the shared local Agent Host while preserving client state and reconnecting windows.

Changes:

  • Adds restart command registration for editor and Agents windows.
  • Coordinates main-process restart and renderer reconnection.
  • Restores subscriptions and cold sessions before replaying actions.
Show a summary per file
File Description
restartAgentHostAction.ts Defines the developer command.
chatDeveloperActions.ts Registers the editor command.
agentHost.contribution.ts Registers the Agents-window command.
AGENT_HOST_SESSIONS_PROVIDER.md Documents desktop commands.
protocolServerHandler.test.ts Tests pending subscriptions.
agentService.test.ts Tests cold-session restoration.
agentHostService.test.ts Tests restart lifecycle behavior.
protocolServerHandler.ts Retains subscriptions without snapshots.
agentService.ts Restores sessions before dispatch.
agentHostService.ts Serializes process lifecycle operations.
electronAgentHostStarter.ts Handles restart IPC and window notification.
localAgentHostService.ts Reconnects local renderer clients.
common/agentService.ts Defines restart IPC channels.
common/agent.ts Exposes restart requests from starters.

Review details

Tip

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

  • Files reviewed: 14/14 changed files
  • Comments generated: 4
  • Review effort level: Balanced

@roblourens
roblourens marked this pull request as ready for review August 9, 2026 18:57
@roblourens
roblourens enabled auto-merge (squash) August 9, 2026 18:57
@roblourens
roblourens marked this pull request as draft August 9, 2026 18:58
auto-merge was automatically disabled August 9, 2026 18:58

Pull request was converted to draft

Recover interrupted initial handshakes, restore cold subagents through their parent sessions, and bound restart lifecycle disposables. Add regression coverage for each review finding.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <[email protected]>
@roblourens
roblourens marked this pull request as ready for review August 9, 2026 19:15
@roblourens
roblourens enabled auto-merge (squash) August 9, 2026 19:15
@roblourens
roblourens merged commit bba5e40 into main Aug 9, 2026
29 checks passed
@roblourens
roblourens deleted the roblou/agents/force-restart-local-agent-host branch August 9, 2026 19:18
@vs-code-engineering vs-code-engineering Bot added this to the 1.133.0 milestone Aug 9, 2026
Misha Damjanic (mdamjanic7) added a commit to mdamjanic7/pihub that referenced this pull request Aug 24, 2026
…n (temporary core patch)

Upstream microsoft#329839 (bba5e40, 2026-08-17 sync) made _getManagementService
async resolving to the ProxyChannel.toService proxy; _callManagement awaits
it, so JS treats the proxy as a thenable — .then is proxied as an RPC whose
function arguments serialize to zero-length objects. The agent host fails to
deserialize the frame (SyntaxError: Unexpected end of JSON input on stderr),
never responds, and the awaited call hangs forever (Compact Conversation
spinner, 100% repro).

Split the readiness wait (void) from the proxy accessor (sync) so the proxy
never travels through promise resolution. Superseded by upstream microsoft#330030 /
microsoft#330567 (bd094b5) in the deferred slice — drop on that merge and re-home
compactSession onto the synchronous accessor. Ledger: docs/pihub-patches.md.
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants