Repository navigation
Fix native chat completion sorting and restored activity timestamps - #19144
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Durable activity timestamp —
JournalReducerStategainslastActivityAt(max rowtsacross every non-epochrow, so revisions and completion tombstones count), exposed viaAgentSessionJournal.lastActivityAt(), and the status feed uses it asupdatedAtin place of publication time. - Real completion projection —
StructuredAgentSessionStatusBridgeno longer marks idle sessionssessionBoundary: true, and forwards the hostsummary.updatedAtas the store'supdatedAt/stateStartedAtwith a localevidenceObservedAt; the no-op guard now keys onupdatedAtequality. - Regression coverage — tests for restored completion timestamps, repeated identical turns, both
claudeandcodex, and journal/host reopen.
The root-cause mapping is right: sessionBoundary: true made agentEntryCompletionAt resolve to an empty history and drop completed native chats to class 5. The Math.max fold in the reducer also gives lastActivityAt a useful monotonicity guarantee that survives compaction and replay.
ℹ️ Remote clock-skew on completion age
summary.updatedAt (the journal's host clock) now flows into stateStartedAt, which resolveAttention's class-2 gate and lastEnteredDoneAt compare against the renderer's now. For local sessions the clocks coincide, but for SSH/remote sessions with skew the 30-minute freshness window and the displayed "N since it finished" age are computed cross-machine — the same class of skew the evidenceObservedAt/mirroredEvidenceReceivedAt mechanism exists to avoid. The host-authoritative timestamp is the right call for durability; flagging only because remote validation was scoped out in the description and is the one place this would surface.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe journal reducer now tracks the latest non-epoch activity timestamp and preserves original Orca user message bodies during revisions. The journal store exposes this timestamp. The status feed uses it for Merge Risk: ⚪ Minimal · up to Completed native chats now retain their actual activity age and sorting position after updates and reloads. The timestamp propagation and completion behavior are covered across the journal, status feed, and renderer paths, with no remaining merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The PR also changes propagation and comparison of model, tool-line, and last-assistant-message fields in the status bridge. These changes are separate from the linked issue, which identifies response previews and model labels as separate concerns. Resolution Remove the model, tool-line, and last-assistant-message changes from this PR, or provide clear evidence that they are required to implement completion sorting and timestamp preservation. Move unrelated behavior and tests to a separate PR if needed.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts (1)
39-46: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winInclude
updatedAtinsummariesEqual.A journal revision can advance
updatedAtwithout changing the projected status fields.publish()then returns early at Line 88 and does not send the new durable activity time. The renderer retains the older timestamp for sorting and elapsed-age display.Add
a.updatedAt === b.updatedAtto this comparison. Add a regression test that publishes two otherwise identical summaries with different activity timestamps.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 73a29260-fe8b-4eaf-b079-531d79b70381
📒 Files selected for processing (6)
src/main/native-chat/agent-session-journal/journal-reducer.tssrc/main/native-chat/agent-session-journal/journal-store.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-status-feed.tssrc/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsxsrc/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Settled-activity dedupe —
summariesEqualnow comparesupdatedAtforidlesummaries only, so a completed turn's durable timestamp republishes (closing the prior gap where anupdatedAtadvance alone was swallowed) while streamingworkingturns stay quiet. - Authoritative older timestamps — a new
AgentStatusTiming.allowOlderTimestampflag relaxes theupdatedAt < existing.updatedAtstaleness gate, letting the ordered host feed correct a legacy publication clock after a host upgrade reconnect. - Working-age preservation — the bridge's
stateStartedAtis now pinned across same-state non-donemetadata changes so a streaming turn's age survives host-metadata advances, while completion still stamps the durablesummary.updatedAt. - Test harness + regression coverage — bridge tests moved onto the real
createTestStore()reducer and added reopened completion, host reopen, working-age, and older-timestamp reconnect cases.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Grok QA evidence (PR #19144 / #19143)FINAL HEAD Visible native Claude/Codex git-worktree completions: both sort directions, repeated Claude turn, neighboring Working, renderer reload ages retained (Claude 1m vs Codex 4m, not identical). Store Full report: Screenshots (uncropped real app)Folder catalog existed but sidebar empty ( Claude Done first: Codex Working under Claude Done: Codex Done above Claude: Claude second turn above Codex: After reload (ages kept distinct): SSHThrowaway Linux Docker + Gapsblocked/waiting/interrupted not exercised. Windows: no Windows-specific diff. Mobile: no mobile UI diff (optional follow-up on persisted smart ranks). |
Folder UI addendum
After renderer reload, folder cards are visible with distinct Done ages: Codex completion 1m above Claude completion 2m. Host timestamps unchanged ( Updated |
Folder addendum re-verify (dispatch ctx_f9586f3f653e)HEAD After reload, folder cards remain visible with distinct Done ages: Codex completion 4m above Claude completion 6m. Host timestamps unchanged (claude
Updated |
|
Review complete at 8206dbd. Two GPT-6 Astra / medium review rounds finished clean; focused fixes were committed and pushed without expanding #19143's scope. Fixed four issues found during review:
Validation: 330 focused tests passed, plus Grok's 73-test QA selection (overlapping coverage); node/CLI/web typechecks and changed-code quality passed. All current CI checks are successful or skipped. Performance regression tests verify 20 active streaming revisions produce zero extra status publications and repeated identical snapshots preserve store identity. Initial and final readiness checklists completed; final audit has zero remaining candidate findings. Initial four-seat severity review agreed on P2 findings; two blind-rating seats completed, with the others unavailable due to terminal dispatch errors. Grok exercised real Claude/Codex completions, ordering in both directions, repeated turns, neighboring Working state, and renderer reload in background Electron. Git and folder workspace ages stayed distinct and matched durable journal timestamps. Main screenshots and evidence · Folder-workspace reload proof. The folder addendum supersedes the earlier setup-only hidden-folder gap. A real throwaway Linux SSH demo repository connected and deployed the relay; both native providers returned the existing No remaining in-scope code finding. The PR is not merged. Test app/container/profile cleanup completed and the worktree is clean; some auxiliary counsel terminals have unresolved close/idle/ownership evidence and were left untouched rather than forcibly stopped. |
…t-activity-sort # Conflicts: # src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts # src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Merged
origin/main— brought the branch current with main, resolving the two conflicts instructured-agent-session-status-feed.test.tsandStructuredAgentSessionStatusBridge.tsx; the PR's core behavior (sessionBoundary: false, theupdatedAtgate,lastActivityAt, andallowOlderTimestamp) is preserved intact. - Summary-field reconciliation —
summariesEqualand the bridge now carry main's newmodel/toolName/toolInput/lastAssistantMessagefields alongside the previously-reviewedupdatedAtgate, so settled activity still republishes while streaming turns stay quiet. - Test fixture alignment — the feed tests now drive working state through
TURN_IDENTITYstatus rows and pass a deterministicnowintoopenJournal, matching main's journal fixtures without weakening the regression coverage.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…tablyai#19144) * Fix structured native chat completion sorting and timestamps * Preserve native chat activity across settled updates and host upgrades --------- Co-authored-by: Merge Sim <sim@local>









ELI5
Completed Claude and Codex native chats could sort like idle workspaces, and restored chats could all show the time since startup. They now count as completed turns and retain the journal activity timestamp used for ranking and elapsed ages.
Relationship to fixes already on main
The fixes on main make status and detail updates reach the sidebar, but main still marks idle native-chat summaries as session boundaries, which completion ranking excludes, and assigns publication time to restored summaries. A row can therefore correctly show Done and the response preview while still sorting as idle or showing an age measured from startup.
This PR preserves both merged fixes and adds the missing completion/timing behavior. It also publishes settled timestamp-only changes, preserves the elapsed start of an unchanged active state, and accepts authoritative clock corrections after a host upgrade without clearing read state or history. Timestamp-only updates during an active turn remain deduplicated; model/tool/response-preview changes introduced by #19137 continue to publish.
What Changed
Why
The bridge marked every idle projection as a session boundary, which completion sorting deliberately excludes. Both the host and renderer also substituted publication time for durable activity time.
Linked Issue
Fixes #19143
Visual Proof
Before: user-reported Claude native chats show matching ages and incorrect completion ordering. This is the reported screenshot, not the isolated QA setup.
After: real Claude and Codex native chats in isolated git worktrees. Codex moved above Claude when its turn completed; a subsequent Claude completion moved Claude back above Codex. The screenshot is after renderer reload, with that order and the original timestamps preserved.
Testing
macOS background Electron, attached to this worktree through Playwright CDP: real Claude and Codex completions, Claude working state, completion order in both directions, and renderer reload. All three native session completion timestamps were unchanged after reload. Real Claude completion was also exercised in a folder workspace.
75 targeted tests passed across the status bridge, host feed, journal reducer, and smart-sort suites.
pnpm tcpassed; the renderer typecheck was repeated after the final test changes. Changed-code quality and commit lint/format hooks passed. Full build and remaining CI checks are left to CI.Review
Self-reviewed the status mapping and timestamp flow. The execution host remains authoritative; no new RPC field or opcode is introduced. Linux, Windows, SSH, permission requests, waiting-for-input, and interrupted turns were not manually validated.
Agent skill upstream boundary
Notes
This fixes completion status metadata, sorting, and elapsed ages. It does not add assistant-response previews or model labels to structured native chat sidebar rows.
Checklist