Skip to content

fix(acp): forward session title updates to ACP clients via session_info_update#21111

Open
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng:fix/acp-session-info-update
Open

fix(acp): forward session title updates to ACP clients via session_info_update#21111
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng:fix/acp-session-info-update

Conversation

@kevinWangSheng
Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #21013

Type of change

  • Bug fix

What does this PR do?

The ACP protocol defines session_info_update as a valid SessionUpdate notification with title and updatedAt fields, but the OpenCode ACP agent never emitted it.

Session.setTitle() (called from session/prompt.ts after the first assistant turn generates a title) fires a session.updated bus event via SyncEvent.run(Event.Updated, { sessionID, info: { title } }). The handleEvent switch in acp/agent.ts only handled three event types — permission.asked, message.part.updated, and message.part.delta — so the title update was silently dropped and ACP clients never learned the session title had changed.

The fix adds a case "session.updated" that:

  1. Looks up the session via sessionManager.tryGet(props.sessionID) — skips events for sessions not owned by this ACP connection
  2. Guards on props.info.title being non-empty — avoids spamming clients on unrelated session patches (e.g. time.updated touches)
  3. Calls connection.sessionUpdate({ sessionId, update: { sessionUpdate: "session_info_update", title, updatedAt } })

How did you verify your code works?

  • cd packages/opencode && bun run typecheck passes with no errors
  • Traced the event path: Session.setTitle()patch()SyncEvent.run(Event.Updated, ...)handleEvent("session.updated")connection.sessionUpdate(session_info_update)
  • SessionInfoUpdate and the "session_info_update" literal are both present in @agentclientprotocol/sdk@0.16.1

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…fo_update

When a session title is auto-generated after the first prompt turn,
Session.setTitle() fires a session.updated bus event. handleEvent() had no
case for this event type, so ACP clients never learned the session title
changed. Add a case that calls connection.sessionUpdate with sessionUpdate:
"session_info_update" whenever session.updated carries a non-empty title.

Fixes anomalyco#21013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP agent never sends session_info_update session updates

1 participant