Repository navigation
feat: add change cursors for messages, tasks, actions, events and voice calls - #242
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (46)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds ChangesChange Cursor Feeds
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Client
participant SessionChangesRoute
participant SessionStore
participant MessageRepository
Client->>SessionChangesRoute: Request message changes after cursor
SessionChangesRoute->>SessionStore: Fetch changes for session and limit
SessionStore->>MessageRepository: Query rows in cursor order
MessageRepository-->>SessionStore: Return changed message rows
SessionStore-->>SessionChangesRoute: Return message records
SessionChangesRoute-->>Client: Return rows, active leaf, and next cursor
Merge Risk: ⚪ Minimal · up to The change feeds appear ready to merge after normal checks; no unresolved issue is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The inspected read paths retain authentication, ownership checks, and administrator restrictions. No introduced authorization bypass was established. Synchronization remains best-effort: transaction timestamps do not guarantee commit-order delivery, and voice restart marking can fail without blocking startup. Production upgrade and failure-recovery behavior remain only partially established. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 30.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 201 functions across 43 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
🧰 Additional context used📚 Code guidelines (4)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 |
…ce calls
A host reconciling the runtime's records needs to read what changed since
its last pass. Message rows are updated in place after creation (tool
results recorded later, accepted host results), and tasks, agent
messages, actions and events change status afterwards. No table recorded
when a row last changed, so an id cursor missed those changes.
Migration 0039 adds updated_at, set by every write, and an (updated_at, id)
index to messages, tasks, agent_messages, actions, events and voice_calls
(voice calls also get created_at). Existing rows are backfilled from the
latest time they already record.
- GET /api/sessions/{id}/messages/changes?after=<cursor>: changed tree
rows, the next cursor, and the active leaf
- updated_after=<cursor> on tasks, agent messages, actions and events,
in (updated_at, id) order
- GET /api/voice/calls?updated_after=, and voice calls in /api/counts
- a confirmation's change moves its action past the cursor
A cursor is "<ISO updated_at>|<id>" or a bare time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stored call the restarted process does not hold is reported as interrupted, but its updated_at never changed. So a reader that had seen it active never saw it end. Startup now gives unfinished stored calls a new updated_at, best effort, and leaves their snapshots as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
93647f7 to
ffc6d51
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Follow-up to #240. A host that reconciles the runtime's records into its own index needs to read what changed since its last pass. Message rows are updated in place after creation, for example when tool results are recorded later or a host result is accepted on an existing assistant row. Tasks, agent messages, actions and events change status afterwards. No table recorded when a row last changed, so an id cursor missed those changes.
Changes
updated_at timestamptz NOT NULL DEFAULT now()and an(updated_at, id)index onmessages,tasks,agent_messages,actions,eventsandvoice_calls. Messages also get(session_id, updated_at, id).voice_callsalso getscreated_at.updated_at. That includes Core updates and upserts, and a confirmation's write also updates its parent action.<ISO 8601 updated_at>|<id>, or a bare time meaning strictly after it. Records are returned in(updated_at, id)ascending order. A malformed cursor returns 422.GET /api/sessions/{id}/messages/changes?after=<cursor>&limit=Nreturns{messages, next_cursor, active_leaf_id}. The messages are tree rows withparent_idandupdated_at, and the client rebuilds the display path locally.updated_after=<cursor>onGET /api/tasks,/api/agents/{id}/messages,/api/actionsand/api/events. Combining it withbefore, or withafteron events, returns 422. Records carryupdated_at. Actions and events addnext_cursoronly whenupdated_afteris given; tasks and agent messages stay bare lists.GET /api/voice/calls?updated_after=<cursor>&limit=Nreturns{calls, next_cursor}, with the same access rule asGET /calls/{id}./api/countsnow includesvoice_calls.updated_at, so readers see them reported as interrupted. Their snapshots are left unchanged.docs/api.md(a new "Change cursors" section, including the overlap note for transaction-time stamps),docs/persistence.md,docs/voice.md.When the new parameters are absent, existing responses are unchanged, apart from the additive
updated_atfield.Not covered: the
agentstable has noupdated_at, and delivered steering is not in the message change feed (it is still in/messagesand the single-message route).Verification
make check: 3008 passed, 1 skipped; ruff and format clean.tests/databasepassed, and a smoke script checked that every update movesupdated_atand that cursor filtering and ordering work.gpt-6-astra, high effort, separate read-only context, 2 rounds.Part of #83
🤖 Generated with Claude Code
Summary by CodeRabbit