Skip to content

fix: send every pay-per-event charge to the platform, even past the budget - #1307

Open
Pijukatel wants to merge 4 commits into
masterfrom
claude/nice-brown-kvd0wb
Open

Pijukatel wants to merge 4 commits into
masterfrom
claude/nice-brown-kvd0wb

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Actor.charge() now sends the full requested count of a priced event to the platform on every call, including when the run is already over budget. The platform bills only up to max_total_charge_usd and aborts the run, so it alone decides what is billed.
ChargeResult.charged_count reports only the events within the budget, without the former extra event. Synthetic events, local runs, multi-tenant runs, and the push_data limits are unchanged.

…udget

`Actor.charge()` used to cap the count it sent at the events that fit the
remaining budget plus one, and to skip the API call once the run was over
budget. It now sends the full requested count of a priced event on every call.
The platform bills events only up to `max_total_charge_usd` and aborts the run
once its own counts reach it, so it decides what is billed.

The returned `ChargeResult` is unchanged: `charged_count` and
`event_charge_limit_reached` are still computed from the remaining budget, and
the locally tracked counts still register `charged_count`. Synthetic, unknown,
and tier-priced events, local runs, and multi-tenant runs behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAJqma86JbvfSpTQCwX
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 3, 2026
@Pijukatel
Pijukatel requested a review from vdusek December 3, 2026 09:47
`charged_count` no longer includes the extra event over the budget, since every
charge now reaches the platform in full. The locally tracked counts take the
full count, matching what the platform records. A push without an explicit
event reports only the items within the budget as charged, like a push with
one. `push_data` still lets one item through when the budget can't cover any,
so that the platform detects the exhausted budget.

The charge-limit e2e test waits until the platform accounts the charges and
checks that only the events within the budget are billed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAJqma86JbvfSpTQCwX
The platform doesn't bill an Actor's owner for its own runs, and the e2e tests
run the Actor with the account that owns it, so the accounted counts stay at 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ocuAJqma86JbvfSpTQCwX
@Pijukatel
Pijukatel marked this pull request as ready for review December 4, 2026 14:23
@Pijukatel
Pijukatel requested a review from szaganek as a code owner December 4, 2026 14:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants