Repository navigation
fix(acp): forward session title updates to ACP clients via session_info_update - #21111
kevinWangSheng wants to merge 1 commit into
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
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
FYI: the gap this PR fixed is still present in 2.0.32 — verified live (zero |
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/[email protected]Screenshots / recordings
N/A
Checklist