fix(acp): forward session title updates to ACP clients via session_info_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 #21013
pull/21111/head
kevinWangSheng 2026-04-05 08:08:05 -07:00
parent 3a0e00dd7f
commit 99d4bedb08
1 changed files with 20 additions and 0 deletions

View File

@ -529,6 +529,26 @@ export namespace ACP {
}
return
}
case "session.updated": {
const props = event.properties
const session = this.sessionManager.tryGet(props.sessionID)
if (!session) return
if (!props.info.title) return
await this.connection
.sessionUpdate({
sessionId: session.id,
update: {
sessionUpdate: "session_info_update",
title: props.info.title,
updatedAt: new Date(props.info.time.updated).toISOString(),
},
})
.catch((error) => {
log.error("failed to send session_info_update to ACP", { error })
})
return
}
}
}