Skip to content

Include platform_cost in cloud agent credit totals#10672

Merged
jefflloyd merged 2 commits into
masterfrom
jlloyd/fix-credits-include-all-cost-buckets
May 12, 2026
Merged

Include platform_cost in cloud agent credit totals#10672
jefflloyd merged 2 commits into
masterfrom
jlloyd/fix-credits-include-all-cost-buckets

Conversation

@jefflloyd
Copy link
Copy Markdown
Contributor

Description

The conversation details panel often rendered no Credits used field at all, even when the Oz web app showed a non-zero total for the same run. Two compounding bugs were responsible:

  1. ConversationDetailsData::from_task used the ? operator inside an and_then closure, so if either inference_cost or compute_cost was null on RequestUsage, the entire credits value became None and the row was dropped from render. Oz web handled the same data with ?? 0 and still rendered a number.
  2. The client's RequestUsage struct was missing the server's platform_cost field entirely, so even after the Oz-web fix/oz-credits-include-platform-cost change, the local panel would still under-count by whatever was sitting in the platform bucket.

What changed

  • Added platform_cost: Option<f64> (with #[serde(default)] for forward compat with older server responses) to the client's RequestUsage in app/src/ai/ambient_agents/task.rs.
  • Updated AmbientAgentTask::credits_used() to sum inference + compute + platform, each defaulting to 0.0 when null. This is the single helper every cloud-agent surface (details panel, tombstone, conversation list entries) now goes through.
  • Collapsed the CreditsInfo enum in conversation_details_panel.rs down to credits: Option<f32> and deleted the inference/compute split renderer (render_credits_with_split / render_cost_sub_row and the two info-tooltip mouse states). Per product direction we now want a single Credits used: X.X line everywhere; no split UI.
  • Both code paths land on that single total:
    • Local conversations: conversation.credits_spent() (already sums platform credits at the controller).
    • Cloud agent runs: task.credits_used() (now also sums platform).

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • Updated conversation_details_panel_tests::test_from_conversation_populates_local_conversation_fields to assert data.credits.is_some() after dropping the CreditsInfo enum.

  • Updated conversation_ended_tombstone_view_tests to populate platform_cost on the test RequestUsage and to expect inference + compute + platform in 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 warnings is 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/run

Screenshots / 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

  • Warp Agent Mode - This PR was created via Warp's AI 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

@cla-bot cla-bot Bot added the cla-signed label May 11, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 11, 2026

@jefflloyd

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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

Comment thread app/src/ai/conversation_details_panel.rs Outdated
Comment on lines -191 to -196
/// Credit usage information for a conversation or task.
#[derive(Debug, Clone)]
enum CreditsInfo {
LocalConversation(f32),
AmbientConversation { inference: f32, compute: f32 },
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@jefflloyd jefflloyd requested a review from tylerlam-warp May 11, 2026 21:30
Comment thread app/src/ai/ambient_agents/task.rs Outdated
Co-Authored-By: Oz <oz-agent@warp.dev>
@jefflloyd jefflloyd force-pushed the jlloyd/fix-credits-include-all-cost-buckets branch from 9599306 to 42d5341 Compare May 12, 2026 16:35
@jefflloyd jefflloyd enabled auto-merge (squash) May 12, 2026 16:35
@jefflloyd jefflloyd disabled auto-merge May 12, 2026 16:35
@jefflloyd jefflloyd enabled auto-merge (squash) May 12, 2026 16:36
Co-Authored-By: Oz <oz-agent@warp.dev>
@jefflloyd jefflloyd force-pushed the jlloyd/fix-credits-include-all-cost-buckets branch from 42d5341 to bf4b2d1 Compare May 12, 2026 17:27
@jefflloyd jefflloyd merged commit b07f62c into master May 12, 2026
24 of 25 checks passed
@jefflloyd jefflloyd deleted the jlloyd/fix-credits-include-all-cost-buckets branch May 12, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants