Include platform_cost in cloud agent credit totals#10672
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds platform_cost to ambient task usage, centralizes cloud-run credit summing through AmbientAgentTask::credits_used(), and simplifies the details panel to display a single Credits used total.
Concerns
- Task-backed conversation entries can still hide the credits row when the raw task is not loaded, even though the entry already carries a normalized total.
- This is a user-visible details-panel behavior change, but the PR has no screenshot/screen recording and the manual testing checkbox is unchecked; manual testing evidence or a justification is required.
Verdict
Found: 0 critical, 2 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| /// Credit usage information for a conversation or task. | ||
| #[derive(Debug, Clone)] | ||
| enum CreditsInfo { | ||
| LocalConversation(f32), | ||
| AmbientConversation { inference: f32, compute: f32 }, | ||
| } |
There was a problem hiding this comment.
Instead of splitting everything out by cost bucket, we're just going to sum up to one overall number. The API always exists for more detailed breakdowns.
Co-Authored-By: Oz <oz-agent@warp.dev>
9599306 to
42d5341
Compare
Co-Authored-By: Oz <oz-agent@warp.dev>
42d5341 to
bf4b2d1
Compare
Description
The conversation details panel often rendered no
Credits usedfield at all, even when the Oz web app showed a non-zero total for the same run. Two compounding bugs were responsible:ConversationDetailsData::from_taskused the?operator inside anand_thenclosure, so if eitherinference_costorcompute_costwasnullonRequestUsage, the entirecreditsvalue becameNoneand the row was dropped from render. Oz web handled the same data with?? 0and still rendered a number.RequestUsagestruct was missing the server'splatform_costfield entirely, so even after the Oz-webfix/oz-credits-include-platform-costchange, the local panel would still under-count by whatever was sitting in the platform bucket.What changed
platform_cost: Option<f64>(with#[serde(default)]for forward compat with older server responses) to the client'sRequestUsageinapp/src/ai/ambient_agents/task.rs.AmbientAgentTask::credits_used()to suminference + compute + platform, each defaulting to0.0when null. This is the single helper every cloud-agent surface (details panel, tombstone, conversation list entries) now goes through.CreditsInfoenum inconversation_details_panel.rsdown tocredits: Option<f32>and deleted the inference/compute split renderer (render_credits_with_split/render_cost_sub_rowand the two info-tooltip mouse states). Per product direction we now want a singleCredits used: X.Xline everywhere; no split UI.conversation.credits_spent()(already sums platform credits at the controller).task.credits_used()(now also sums platform).Linked Issue
ready-to-specorready-to-implement.Testing
Updated
conversation_details_panel_tests::test_from_conversation_populates_local_conversation_fieldsto assertdata.credits.is_some()after dropping theCreditsInfoenum.Updated
conversation_ended_tombstone_view_teststo populateplatform_coston the testRequestUsageand to expectinference + compute + platformin the formatted credits string (catches future regressions if a bucket gets dropped from the sum again).cargo clippy -p warp --all-targets --tests --no-deps -- -D warningsis clean.cargo nextest run -p warp -E 'test(conversation_details_panel) or test(conversation_ended_tombstone_view)'— 15 passed.I have manually tested my changes locally with
./script/runScreenshots / Videos
N/A — purely additive to an existing row in the details panel; the row now appears (with the correct total) for runs that previously rendered no credits at all.
Agent Mode
CHANGELOG-BUG-FIX: Cloud agent run details now include platform cost in the "Credits used" total (and no longer drop the field entirely when one cost bucket is null).
Co-Authored-By: Oz oz-agent@warp.dev