Skip to content

Enhance session lock logic and server stale notifications#2696

Merged
robgruen merged 15 commits into
mainfrom
dev/robgruen/agent_server
Jul 18, 2026
Merged

Enhance session lock logic and server stale notifications#2696
robgruen merged 15 commits into
mainfrom
dev/robgruen/agent_server

Conversation

@robgruen

Copy link
Copy Markdown
Collaborator

This pull request adds support for detecting when the agent-server's code has been rebuilt on disk while the server is still running, and provides a mechanism for clients to restart the server in place. The server now notifies clients (and logs to the console) when it's serving out-of-date code, and exposes a new restart RPC method for supported environments. This improves the developer experience during local development by making it easy to reload new code without manual intervention.

Agent server restart and staleness detection:

  • Added a restart() method to the AgentServerConnection interface and implemented it in both the client and server, allowing clients to request an in-place server restart that reloads freshly-built code. This is only available for standalone servers; embedded/in-process servers will reject the call. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

  • Implemented the server-side restart logic in server.ts, which gracefully tears down the current process and launches a new one with the same arguments, ensuring the new process can bind to the port and acquire the lock without race conditions.

  • Added a new staleBuild.ts module that watches the server's own dist/ directory for changes. If a rebuild is detected after the server starts, it sets a flag, prints a prominent warning banner to the console, and ensures each connecting client is notified once about the stale build. [1] [2] [3]

Client notification of stale builds:

  • On client connection, if the server is detected as stale, a persistent status notice is sent to the client (e.g., chat-ui) with a warning and an action to restart the server. This helps users know when they're running old code and provides a one-click fix.

UI groundwork for persistent status notices:

  • Added scaffolding in chatPanel.ts for a persistent status notice layer, distinct from transient toasts, to display these server-originated warnings in the UI. [1] [2]

robgruen added 3 commits July 17, 2026 13:31
…a .held so you know if the lock is alive or stale.
…and. clients get a persistent message indicating stale server
@robgruen
robgruen marked this pull request as ready for review July 17, 2026 23:46
@robgruen

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts. The only conflict was in ts/packages/dispatcher/dispatcher/README.AUTOGEN.md (an auto-generated docs file) — resolved by accepting the main branch version. Merge commit: d1d0d45.

…displayStatusNotice helper

The CI complexity ratchet failed because adding the statusNotice case inline
to the notify() method pushed its cognitive complexity from ≤30 to 33.

Extract the statusNotice handling logic into a dedicated displayStatusNotice()
helper function, following the same pattern as displayToastNotification() and
displayInlineNotification(), to bring notify() back under the cognitive
complexity threshold.
@robgruen

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

…rver

# Conflicts:
#	ts/packages/agentServer/server/README.AUTOGEN.md
#	ts/packages/chat-ui/README.AUTOGEN.md
#	ts/packages/dispatcher/types/README.AUTOGEN.md
#	ts/packages/shell/README.AUTOGEN.md
#	ts/packages/vscode-shell/README.AUTOGEN.md

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved. The conflicts were in 5 auto-generated README.AUTOGEN.md files (agentServer/server, chat-ui, dispatcher/types, shell, vscode-shell) — all resolved by accepting the origin/main version. Merge commit: 66ead89.

@robgruen
robgruen enabled auto-merge July 18, 2026 01:32
@robgruen
robgruen added this pull request to the merge queue Jul 18, 2026
Merged via the queue into main with commit ac1c1a3 Jul 18, 2026
26 checks passed
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.

3 participants