fix(hub): preserve invocation activity timestamps - #1249
Merged
tiann merged 1 commit intoJul 30, 2026
Conversation
There was a problem hiding this comment.
Findings
- None.
Summary
Review mode: initial
No high-confidence correctness, security, regression, data-loss, performance, or maintainability issues found in the latest full diff. Residual risk is limited to timing-sensitive SQLite/cache synchronization under production concurrency; the added tests cover first-write, replay, partial-batch, unknown-ID, callback-failure, namespace-rollback, and ready-event behavior.
Testing
- Not run (automation). The repository test check passed for the reviewed head.
HAPI Bot
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.
Problem
Session
updatedAtis refreshed by an agentreadyevent after the CLI has already acknowledged prompt consumption. This moves sidebar recency from the closest observable prompt invocation time to response completion. Replayedmessages-consumedacknowledgements can also move activity even though SQLite preserves the original message invocation transition.Solution
Keep non-empty user text as session activity, but stop treating agent
readyevents as activity. Add an atomic store operation that marks fresh messages invoked and advances the namespaced session timestamp in the same transaction. Duplicate acknowledgements and rows already stamped by cancellation or session-end cleanup leave session activity unchanged, while replay can still synchronize the persisted timestamp back into the in-memory cache.Post-commit activity callback failures are isolated from queue-grace handling and the existing
messages-consumedSSE. The SSE keeps its established batch ACK timestamp contract; no wire format changes are introduced.Tests
ready, first and duplicate consumption acknowledgements, partial batches, callback-failure replay, sibling-pre-invoked rows, heterogeneous and unknown IDs, wrong-namespace rollback, and archive timestamp stability.bun test hub/src/store/messages.test.ts hub/src/sync/sessionModel.test.tsbun typecheckbun run testreadydo not move session activity after the first prompt-consumption ACK.