fix(acp): forward session title updates to ACP clients via session_info_update#21111
Open
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
Open
fix(acp): forward session title updates to ACP clients via session_info_update#21111kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
Conversation
…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
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.
Issue for this PR
Closes #21013
Type of change
What does this PR do?
The ACP protocol defines
session_info_updateas a validSessionUpdatenotification withtitleandupdatedAtfields, but the OpenCode ACP agent never emitted it.Session.setTitle()(called fromsession/prompt.tsafter the first assistant turn generates a title) fires asession.updatedbus event viaSyncEvent.run(Event.Updated, { sessionID, info: { title } }). ThehandleEventswitch inacp/agent.tsonly handled three event types —permission.asked,message.part.updated, andmessage.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:sessionManager.tryGet(props.sessionID)— skips events for sessions not owned by this ACP connectionprops.info.titlebeing non-empty — avoids spamming clients on unrelated session patches (e.g.time.updatedtouches)connection.sessionUpdate({ sessionId, update: { sessionUpdate: "session_info_update", title, updatedAt } })How did you verify your code works?
cd packages/opencode && bun run typecheckpasses with no errorsSession.setTitle()→patch()→SyncEvent.run(Event.Updated, ...)→handleEvent("session.updated")→connection.sessionUpdate(session_info_update)SessionInfoUpdateand the"session_info_update"literal are both present in@agentclientprotocol/sdk@0.16.1Screenshots / recordings
N/A
Checklist