fix(orgtrack): add reply preview + end time to Claude placeholders - #849
Merged
Conversation
Pre-commit hook ran. Total eslint: 5, total circular: 0
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.
Summary
Claude Code replays open through the reduced user-row index, and every round except the newest collapses into an
unloadedTurnplaceholder. Unlike every full-stream provider, those placeholders carried no final-reply preview and no end timestamp — so collapsed rounds rendered an empty "Agent worked for <1min" bar with nothing under it. This PR makes the Claude fast path emit the same placeholder metadata the generic imported-history window builder produces.Problem
load_claude_code_initial_window_for_sessionpushes only the user header chunk for rounds outside the recent window. Downstream,build_initial_window_from_turnsderives a collapsed round's last-reply preview (turnPreviewOnly) andendedAtfrom the round's body chunks — which the Claude path never supplies. The result in the Chat Pane:endedAt == startedAt, so the bar reads<1minwith noHH:MM – HH:MMrange regardless of the round's real duration.Solution
index_claude_user_turns) now records, per round, the byte range of the newest line that raw-scans as an assistant message with a text item (last_assistant_text_line). The scan stays raw-prefilter only — no extra JSON parsing.endedAt. The chunk itself never crosses the wire.overlay_indexed_body_countstakes the loaded-turn boundary so reduced rounds keep the honest line-count surrogate asbodyEventCounteven though they now project one preview chunk.Potential risks
\"type\":\"text\"inside a tool input) — the canonical parser then finds no assistant text and the round simply stays preview-less, the previous behavior. It can also pick a text line followed only by tool activity, makingendedAtthe last reply time rather than the last event time; that is an approximation, but strictly better thanstartedAt.Validation / Test plan
claude_initial_window_placeholders_advertise_fetchable_bodiesnow runs the real path-based loader end to end and additionally asserts each placeholder carriesturnPreviewOnly, the round's closing reply text, andendedAt > startedAt, while the loaded round keeps its exact projected counts.claude_initial_window_previews_skip_tool_use_only_assistant_linescovers tool_use-only assistant lines not displacing the text candidate, and that no stray body chunks leak next to an unloaded round.cargo test -p orgtrack_core: 550 passed.cargo clippy -p orgtrack_core --all-targetsclean; fullsrc-tauriworkspacecargo checkclean.