feat(acp): broadcast session title updates to daemon clients - #5032
Closed
qqqys wants to merge 2 commits into
Closed
feat(acp): broadcast session title updates to daemon clients#5032qqqys wants to merge 2 commits into
qqqys wants to merge 2 commits into
Conversation
Auto-generated session titles land in the ACP child's chat recording — the daemon bridge never sees the write, and listSessions computes titles lazily, so HTTP clients could only discover a new title by re-polling the session list. Now chatRecordingService exposes a title-recorded observer; the ACP session registers it and forwards titles over the agent->bridge extNotification side-channel (qwen/notify/session/title-update — a title update is not an ACP SessionUpdate variant, matching the current_model_update precedent). The bridge demuxes it into the canonical session_metadata_updated bus event, the same envelope manual HTTP renames publish, so clients keep ONE "name changed" signal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Superseded by #5035 with clean commit metadata. |
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.
What this PR does
When a session title is recorded in the ACP child — auto-generated after a turn (fast-model side query) or set by an in-process
/rename— the child now notifies attached daemon clients. The recording service exposes a title-recorded observer; the ACP session registers it and forwards the title over the agent→bridgeextNotificationside-channel (qwen/notify/session/title-update); the bridge demuxes it into the canonicalsession_metadata_updatedbus event with{sessionId, title, titleSource}— the same envelope manual HTTP renames already publish, so clients keep a single "this session's name changed" signal.A title update is intentionally NOT sent as an ACP
SessionUpdatevariant: the external @agentclientprotocol/sdk union would reject an unknown kind at validation. This follows the existingcurrent_model_updateextNotification precedent.Why it's needed
Auto-generated titles land in the child's chat recording — the bridge never sees the write, and
listSessionscomputes titles lazily (customTitle ?? first prompt). Today an HTTP client (e.g. a web UI overqwen serve) can only discover the generated title by re-polling the session list, so sidebars keep showing the raw first-prompt text (or "untitled") until some unrelated action triggers a refresh. With this event, clients refresh the moment the title exists.Reviewer Test Plan
How to verify
fastModelin settings so auto-titling is active, startqwen serve, and create a session viaPOST /session.GET /session/:id/eventsand send a first prompt.session_metadata_updatedwithdata: {sessionId, title, titleSource: "auto"}, and the session file contains the matchingcustom_titlerecord. Without this PR, no event is emitted and only a freshGET /workspace/:cwd/sessionsreveals the title.Unit coverage: two new tests in
packages/acp-bridge/src/bridge.test.ts(rebroadcast happy path; malformed payloads dropped — missing/empty/non-string title, missing sessionId). Full runs: acp-bridge 266 passed, cliSession.test.ts124 passed, corechatRecordingService.test.ts25 passed; workspace typecheck clean.Evidence (Before & After)
Before: first prompt in a fresh daemon session → SSE stream shows only
session_update/turn_completeframes; the sidebar of a connected web client keeps the first-prompt placeholder title until its next poll.After: same flow → SSE stream additionally receives
session_metadata_updated {sessionId, title: "<generated 3-7 word title>", titleSource: "auto"}seconds afterturn_complete; the connected web client refreshes its session list immediately (verified end-to-end against a web UI drivingqwen servelocally).Tested on
🤖 Generated with Claude Code