fix(server): buffer ACP session updates received before session registration - #3324
Open
desmond-rai wants to merge 1 commit into
Open
fix(server): buffer ACP session updates received before session registration#3324desmond-rai wants to merge 1 commit into
desmond-rai wants to merge 1 commit into
Conversation
Contributor
|
| Filename | Overview |
|---|---|
| packages/server/src/server/agent/providers/acp-agent.ts | Adds bounded buffering and replay for pre-registration ACP notifications; the previously reported replay-versus-snapshot ordering issue remains. |
| packages/server/src/server/agent/providers/acp-agent.test.ts | Adds focused behavioral tests for early command updates, replay order, and mismatched session filtering. |
Sequence Diagram
sequenceDiagram
participant A as ACP agent
participant S as ACPAgentSession
A-->>S: session/update before registration
S->>S: Buffer notification
A-->>S: session/new response
S->>S: Assign sessionId
S->>S: Replay matching notifications
S->>S: Apply session response state
Reviews (2): Last reviewed commit: "fix(server): buffer ACP session updates ..." | Re-trigger Greptile
19 tasks
…tration ACP agents may emit session-scoped notifications immediately after the session/new response - before the client's response continuation has assigned the session id. ACPAgentSession.sessionUpdate dropped those updates silently because params.sessionId did not yet match, so an agent that pushes its available_commands_update right after session/new (for example Hermes, which advertises installed skills as slash commands) never had its commands cached and the slash-command popup stayed empty. Buffer up to 100 pre-registration session updates and replay them in arrival order once sessionId is assigned; updates addressed to a different session id are still discarded.
desmond-rai
force-pushed
the
fix/acp-session-notification-race
branch
from
August 13, 2026 13:18
09babda to
f0fac80
Compare
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.
Problem
An ACP agent may emit session-scoped notifications immediately after the
session/newresponse - before the client's response continuation has assignedsessionId(ACPAgentSession.initializeNewSession).sessionUpdate()silently drops those notifications becauseparams.sessionId !== this.sessionIdwhilethis.sessionIdis stillnull.Concrete user-visible failure: an ACP agent that pushes its
available_commands_updateright aftersession/new(Hermes advertises installed skills as slash commands this way) never has its command batch cached, solistCommands()returns[]forever and the slash-command popup stays empty for the whole session. The same drop eatsusage_updateand any other early notification.Observed on a live daemon log at session creation:
Fix
Buffer session updates that arrive while
sessionIdis still unassigned (capped at 100 per session) and replay them in arrival order immediately aftersessionIdis assigned ininitializeNewSession. Updates addressed to a different session id are still discarded, and post-registration routing is unchanged.Tests
Three new regression tests in
acp-agent.test.ts(ACPAgentSession pre-registration session updates):available_commands_updatedelivered synchronously with thesession/newresponse is applied and returned bylistCommands()(fails before the fix: returns[])Verification
acp-agent.test.ts: 99/99 passedpackages/servertypecheck: cleannpm run test:unit): 4768 passed, 11 failed in unrelated Hub/websocket/git-service files. Reconciliation: 8 of 11 are 30s+ timeouts under parallel-file load and pass in isolation;workspace-service-port-allocatorfails identically on the clean base commit (pre-existing);workspace-git-service.observationis load-flaky (passes on isolated rerun). None import or exercise ACP provider code.Note: the same race exists one layer up in the shared-process router proposed in #3194; a companion commit there covers that path.