Skip to content

fix: start transcript notices on their own line for clients without session.notices - #1362

Open
alexwan02 wants to merge 3 commits into
agentclientprotocol:mainfrom
alexwan02:fix/transcript-notice-paragraph
Open

alexwan02 wants to merge 3 commits into
agentclientprotocol:mainfrom
alexwan02:fix/transcript-notice-paragraph

Conversation

@alexwan02

Copy link
Copy Markdown

What

When a client does not advertise session.notices, a notice falls back to an agent_message_chunk like **Notice:** …. Clients render consecutive chunks as one markdown stream, so the fallback is glued to Claude's last sentence. In Zed 1.24 a Stop hook's systemMessage shows up as:

…推上去。**Notice:** Stop says: token: 3 calls
Stop says: hand off now

The fallback is now its own blockquote paragraph, with blank lines on both sides:

…推上去。

> **Notice:** Stop says: token: 3 calls
> hand off now

Behavior

  • noticeOrTranscriptUpdate wraps the transcript text with transcriptBlock: a leading blank line so it starts on a new line, > on every line, and a trailing blank line so Claude's next chunk does not continue the quote. This covers every transcript fallback (hook notices, "Task stopped by user", "Fast mode turned off", "Auto mode unavailable").
  • Claude Code prefixes every line of a hook's systemMessage with <HookEvent> says: . The informational fallback keeps that prefix on the first line only, and only when every line repeats the same prefix (collapseHookSpeaker).
  • Clients that advertise session.notices get the same notice update as before.
  • Turn.noticeTexts still records message.content unchanged, so the hook-blocked result de-duplication keeps working.

Tests

  • New unit tests for transcriptBlock and collapseHookSpeaker, plus an end-to-end test for a two-line notice-level hook message.
  • Updated the existing transcript fallback assertions to the blockquote form.
  • npm run check, npm run build and npm run test:run pass (3111 tests).

alex and others added 3 commits October 16, 2026 10:11
…ession.notices

When a client does not advertise `session.notices`, a notice falls back to
an `agent_message_chunk` such as `**Notice:** …`. Clients render consecutive
chunks as one markdown stream, so the fallback lands mid-sentence right after
Claude's last chunk:

    …all done.**Notice:** Stop says: token: 3 calls

The fallback text is now its own blockquote paragraph, with blank lines on
both sides so it starts on a new line and Claude's next chunk does not
continue the quote.

Claude Code also prefixes every line of a hook's `systemMessage` with
"<HookEvent> says: ", so a two-line Stop hook message read
"Stop says: a\nStop says: b". The informational fallback keeps the prefix on
the first line only when every line repeats it.

Clients that advertise `session.notices` are unaffected.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant