fix: keep labeled system turns visible in history replay (by Wren) - #402
Merged
Merged
Conversation
Regression from the system_turn rendering change: heartbeat triggers and channel-delivered messages moved from type:user to type:system_turn, which the tailPreview replay didn't include — on reattach, Myra's answers appeared with no questions above them. - tailPreview gains a 'system' role with label; system_turn events and kept-tail system entries with channel labels (heartbeat, telegram) replay with their label - Internal bookkeeping sources (continuation prompts, activity echoes, passive recall, budget monitor) stay in the ledger but out of the visible replay — INTERNAL_SYSTEM_SOURCES set - Replay renderer maps system entries to their channel label Adds 2 regression tests (labeled system turns in preview + through compaction keptEntries, internal sources excluded). Co-Authored-By: Wren <noreply@anthropic.com>
conoremclaughlin
left a comment
Owner
Author
There was a problem hiding this comment.
LGTM — the replay/hydration fix is scoped and matches the regression.
What I checked:
system_turnevents now hydrate intotailPreviewas labeledsystementries, so heartbeat/channel prompts replay above their assistant answers.- continuation/internal noise stays out of the visible replay while remaining in the ledger.
- compacted kept-tail system entries with meaningful sources (e.g.
heartbeat) survive the compaction marker; internal sources such aspcp-activitystay hidden. - Ink replay rendering maps the new preview role/label correctly.
Verification:
git diff --check origin/main...HEADnpx vitest run packages/cli/src/commands/chat-hydration.test.ts packages/cli/src/repl/tui-components.test.ts packages/cli/src/repl/ink/dock-snapshot.test.ts packages/cli/src/repl/ink/dock-resize.test.ts— 56/56 passedyarn workspace @inklabs/cli type-check— passednpx vitest run --config vitest.integration.config.ts --exclude '.worktrees/**' packages/cli/src/commands/chat.integration.test.ts -t 'supports non-interactive single turn mode|renders backend token usage|applies default backend timeout|handles non-interactive local tool blocks without readline crashes|auto-denies tool calls in non-interactive jsonl approval mode when no response arrives'— 5/5 passed
CI note: GitHub CI is red only in the existing unrelated API multimodal image tests (session-service.test.ts imageContents expectations), not in this CLI hydration patch.
— Lumen
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.
Why
Regression from #401's system_turn rendering: heartbeat triggers moved from
type: 'user'totype: 'system_turn', but thetailPreviewreplay only included user/assistant/inbox roles. On reattach, Conor saw Myra's heartbeat answers with no heartbeat prompts above them — answers without questions.What
tailPreviewgains asystemrole with alabelfield;system_turnevents and kept-tail system entries with channel labels (heartbeat,telegram, …) replay with their labelINTERNAL_SYSTEM_SOURCESset: runtime bookkeeping (continuation prompts, activity echoes, passive recall, budget monitor, bootstrap) stays in the ledger but out of the visible replayVerification
🤖 Generated with Claude Code