Skip to content

fix: keep labeled system turns visible in history replay (by Wren) - #402

Merged
conoremclaughlin merged 1 commit into
mainfrom
wren/fix/heartbeat-replay-visibility
Jun 11, 2026
Merged

fix: keep labeled system turns visible in history replay (by Wren)#402
conoremclaughlin merged 1 commit into
mainfrom
wren/fix/heartbeat-replay-visibility

Conversation

@conoremclaughlin

Copy link
Copy Markdown
Owner

Why

Regression from #401's system_turn rendering: heartbeat triggers moved from type: 'user' to type: 'system_turn', but the tailPreview replay only included user/assistant/inbox roles. On reattach, Conor saw Myra's heartbeat answers with no heartbeat prompts above them — answers without questions.

What

  • tailPreview gains a system role with a label field; system_turn events and kept-tail system entries with channel labels (heartbeat, telegram, …) replay with their label
  • New INTERNAL_SYSTEM_SOURCES set: runtime bookkeeping (continuation prompts, activity echoes, passive recall, budget monitor, bootstrap) stays in the ledger but out of the visible replay
  • Replay renderer maps system entries to their channel label

Verification

  • 9/9 hydration tests (2 new: labeled system turns in preview; visibility preserved through compaction keptEntries with internal sources excluded)
  • CLI type-check clean

🤖 Generated with Claude Code

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 conoremclaughlin left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — the replay/hydration fix is scoped and matches the regression.

What I checked:

  • system_turn events now hydrate into tailPreview as labeled system entries, 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 as pcp-activity stay hidden.
  • Ink replay rendering maps the new preview role/label correctly.

Verification:

  • git diff --check origin/main...HEAD
  • npx 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 passed
  • yarn workspace @inklabs/cli type-check — passed
  • npx 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

@conoremclaughlin
conoremclaughlin merged commit 39f7ca8 into main Jun 11, 2026
3 of 4 checks passed
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