(MOT-4184) fix(session-manager): persist assistant usage updates - #602
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesTerminal usage propagation
Sequence Diagram(s)sequenceDiagram
participant UpdateMessageRequest
participant SessionService
participant AgentMessage
UpdateMessageRequest->>SessionService: provide optional usage
SessionService->>AgentMessage: set_usage(new_usage)
AgentMessage-->>SessionService: return role support
SessionService-->>UpdateMessageRequest: persist or return InvalidEntryKind
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
skill-check — worker0 verified, 49 skipped (no docs/).
Four for four. Nicely done. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
session-manager/src/service.rs (1)
692-700: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd an integration test for usage rejection.
Line 692 adds the public non-assistant validation path, but current tests only call
set_usagedirectly. Add asession::update-messagecase that suppliesusageto a user message and asserts the error plus unchanged persisted content.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@session-manager/src/service.rs` around lines 692 - 700, Add an integration test for the session::update-message flow that submits usage for a user message, verifies the request returns the expected invalid-entry-kind error, and confirms the message’s persisted content remains unchanged. Exercise the public update path rather than calling set_usage directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@session-manager/src/service.rs`:
- Around line 692-700: Add an integration test for the session::update-message
flow that submits usage for a user message, verifies the request returns the
expected invalid-entry-kind error, and confirms the message’s persisted content
remains unchanged. Exercise the public update path rather than calling set_usage
directly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cccd6274-63a4-49e2-abf7-1cb4018d0864
📒 Files selected for processing (8)
harness/tests/e2e/src/scenarios/dsl.rsharness/tests/e2e/src/scenarios/exactly_once_function.rsharness/tests/e2e/src/scenarios/multi_turn_traces.rssession-manager/src/functions/update_message.rssession-manager/src/service.rssession-manager/src/types.rssession-manager/tests/features/update_message.featuresession-manager/tests/golden/schemas/session.update-message.json
Summary
session::update-messagefinalizes an assistant messageRoot cause
The Harness included provider usage in its final
session::update-messagecall, but Session Manager did not model that field in the request. Deserialization ignored it, so the call succeeded while the durable assistant message lost its token accounting. As a result,harness::metricshad no persisted usage to aggregate.Validation
cargo test— 62 unit tests, 127 BDD scenarios, and 4 schema tests passedharness::sendwithopenai-codex/codex/gpt-5.6-lunasession::messagesandharness::metricsboth reported input, output, and reasoning tokensRefs MOT-4184
Summary by CodeRabbit
New Features
Bug Fixes