test(tui): headless session history reconstructed on hydration#206
Merged
Conversation
Adds a regression test exercising the full restart/reconnect hydration path (load_session_hydration → apply_transcript_to_local_state, including the SessionHydrationRequest.is_headless plumbing) against a mock daemon serving a PTY-less transcript of Message/Reasoning events. Asserts the headless prose + reasoning are folded back into the rebuilt ItemHistory when is_headless, and that a PTY-backed session does NOT re-render that transcript prose (it lives in the PTY stream).
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.
Follow-up to #195 (render headless conversation in the TUI). That PR has rendering coverage, but no test asserting headless history is reconstructed on restart/reconnect. This adds one.
What it covers
Exercises the real hydration path —
load_session_hydration→apply_transcript_to_local_state— including theSessionHydrationRequest.is_headlessplumbing, against a mock daemon serving a PTY-less transcript ofMessage+Reasoningevents (what a headless session persists).is_headless: true): the rebuiltItemHistoryrenders the assistant prose ("Hello from headless") and reasoning ("considering options") — i.e. the conversation is restored on relaunch / after/agentd restart.is_headless: false): the same transcript'sMessageprose is not re-rendered (a PTY-backed session keeps its prose in the PTY stream, so replaying it would double it up).This guards the restart-reconstruction wiring that the rendering-only test (
transcript_replay_renders_messages_only_when_headless) doesn't reach.Verification
Test-only change. New test green; full
agentd-clisuite (173) passes;--lockedworkspace build clean.🤖 Generated with Claude Code