Skip to content

fix(hub): preserve invocation activity timestamps - #1249

Merged
tiann merged 1 commit into
tiann:mainfrom
junmo-kim:fix/hub-invocation-activity-timestamp
Jul 30, 2026
Merged

fix(hub): preserve invocation activity timestamps#1249
tiann merged 1 commit into
tiann:mainfrom
junmo-kim:fix/hub-invocation-activity-timestamp

Conversation

@junmo-kim

Copy link
Copy Markdown
Contributor

Problem

Session updatedAt is refreshed by an agent ready event after the CLI has already acknowledged prompt consumption. This moves sidebar recency from the closest observable prompt invocation time to response completion. Replayed messages-consumed acknowledgements 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 ready events 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-consumed SSE. The SSE keeps its established batch ACK timestamp contract; no wire format changes are introduced.

Tests

  • Added Hub coverage for user text versus 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.ts
  • bun typecheck
  • bun run test
  • Isolated Hub, Vite, fake CLI, and Playwright trace confirming duplicate consumption and ready do not move session activity after the first prompt-consumption ACK.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@tiann
tiann merged commit 6174016 into tiann:main Jul 30, 2026
2 checks passed
@junmo-kim
junmo-kim deleted the fix/hub-invocation-activity-timestamp branch July 30, 2026 17:15
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.

2 participants