The daily spend breaker now pauses all compute g1t would pay for, not only agent runs on g1t's hosted models. Once PLATFORM_DAILY_SPEND_CAP_MICROS ($75) of g1t's own spend is reached in a UTC day, new workflow, check, merge-queue and agent sandboxes that g1t would pay for wait until midnight: with hosted agents going away, the breaker had stopped protecting anything. Workspaces paying with real money are still left alone, and so are comped accounts, which their own monthly budget holds. Sudo's Costs page, the staff email and the refusal say so.
5 files+25−210/5 viewed
| 16 | 16 | settings: "Guardrails saved. They apply from the next run.", | |
| 17 | 17 | mapping: "Mapping saved. It applies from the next run; read the bill now to see it.", | |
| 18 | 18 | removed: "Mapping removed.", | |
| 19 | − | lifted: "Breaker lifted for the rest of today (UTC). Hosted-model runs start again; it is recorded in the audit log.", | |
| 19 | + | lifted: "Breaker lifted for the rest of today (UTC). Runs g1t pays for start again; it is recorded in the audit log.", | |
| 20 | 20 | paused: "Paused across g1t. Every service sees it within 30 seconds; it is recorded in the audit log.", | |
| 21 | 21 | resumed: "Resumed across g1t. Every service sees it within 30 seconds; it is recorded in the audit log.", | |
| 22 | 22 | }; |
| 278 | 278 | const parts: string[] = []; | |
| 279 | 279 | if (caps.tripped) { | |
| 280 | 280 | parts.push( | |
| 281 | − | `the daily breaker is open (${usd(caps.todayMicros)} of ${usd(caps.dailyCapMicros)} today), so new hosted-model agent runs g1t pays for wait until 00:00 UTC`, | |
| 281 | + | `the daily breaker is open (${usd(caps.todayMicros)} of ${usd(caps.dailyCapMicros)} today), so new runs g1t pays for wait until 00:00 UTC`, | |
| 282 | 282 | ); | |
| 283 | 283 | } | |
| 284 | 284 | for (const budget of caps.comped) { |
| 393 | 393 | className="mt-6" | |
| 394 | 394 | id="spend" | |
| 395 | 395 | title="g1t's own spend" | |
| 396 | − | description="What g1t pays for itself this calendar month, today included: accounts on a 100% discount, the trial and open-source pools, free workspaces' overruns, and usage charged without real money behind it. Each is what the work cost g1t, never its price, counted as each charge settled: the model providers' cost, and the price book's cost of sandboxes and builds. Two caps hold it: each 100%-discount account's monthly budget, and a daily breaker on all of it that pauses new hosted-model agent runs g1t would pay for." | |
| 396 | + | description="What g1t pays for itself this calendar month, today included: accounts on a 100% discount, the trial and open-source pools, free workspaces' overruns, and usage charged without real money behind it. Each is what the work cost g1t, never its price, counted as each charge settled: the model providers' cost, and the price book's cost of sandboxes and builds. Two caps hold it: each 100%-discount account's monthly budget, and a daily breaker on all of it that pauses new compute g1t would pay for: workflows, checks, the merge queue and agents." | |
| 397 | 397 | > | |
| 398 | 398 | <div className="grid gap-3 lg:grid-cols-2"> | |
| 399 | 399 | <CapMeter | |
| ⋯ | |||
| 403 | 403 | hint={ | |
| 404 | 404 | caps.tripped ? ( | |
| 405 | 405 | <span className="text-danger"> | |
| 406 | − | Breaker open{caps.trippedAt ? <> since <When at={caps.trippedAt} time /></> : null}: new hosted-model runs g1t pays for wait until 00:00 UTC. | |
| 406 | + | Breaker open{caps.trippedAt ? <> since <When at={caps.trippedAt} time /></> : null}: new runs g1t pays for wait until 00:00 UTC. | |
| 407 | 407 | </span> | |
| 408 | 408 | ) : caps.liftedBy ? ( | |
| 409 | 409 | <> | |
| 3687 | 3687 | pub today_micros: i64, | |
| 3688 | 3688 | /// `PLATFORM_DAILY_SPEND_CAP_MICROS`. Zero: no breaker. | |
| 3689 | 3689 | pub daily_cap_micros: i64, | |
| 3690 | − | /// The breaker is open: new hosted-model agent runs that g1t would pay | |
| 3690 | + | /// The breaker is open: new compute that g1t would pay | |
| 3691 | 3691 | /// for wait until tomorrow (UTC) or until staff lift it. | |
| 3692 | 3692 | pub tripped: bool, | |
| 3693 | 3693 | pub tripped_at: Option<String>, | |
| ⋯ | |||
| 3758 | 3758 | #[derive(Debug, Default, Serialize, Deserialize)] | |
| 3759 | 3759 | pub struct AdminSpendCapsArgs {} | |
| 3760 | 3760 | ||
| 3761 | − | /// `admin_lift_breaker`: lets hosted-model runs start again for the rest | |
| 3761 | + | /// `admin_lift_breaker`: lets runs g1t pays for start again for the rest | |
| 3762 | 3762 | /// of today (UTC), with why. Recorded in the audit log. Returns | |
| 3763 | 3763 | /// `Outcome<SpendCaps>`. | |
| 3764 | 3764 | #[derive(Debug, Serialize, Deserialize)] | |
| 21 | 21 | //! month; at 100% new work on it is refused until staff raise it or the | |
| 22 | 22 | //! month turns. Work already running finishes. | |
| 23 | 23 | //! 2. **The daily breaker**: when g1t's part across every workspace today | |
| 24 | − | //! (UTC) reaches `PLATFORM_DAILY_SPEND_CAP_MICROS` ($75), new agent runs | |
| 25 | − | //! on g1t's hosted models that g1t would pay for are paused for the rest | |
| 26 | − | //! of the day: everyone's except workspaces paying with real money on | |
| 27 | − | //! the plan or an enterprise contract. Staff are emailed at once and sudo | |
| 24 | + | //! (UTC) reaches `PLATFORM_DAILY_SPEND_CAP_MICROS` ($75), new compute | |
| 25 | + | //! that g1t would pay for (sandboxes for workflows, checks, the merge | |
| 26 | + | //! queue and agents alike) is paused for the rest of the day: everyone's | |
| 27 | + | //! except workspaces paying with real money on the plan or an enterprise | |
| 28 | + | //! contract, and comped accounts, which have their own monthly budget. Staff are emailed at once and sudo | |
| 28 | 29 | //! shows a red bar; staff can lift it for the day. | |
| 29 | 30 | //! | |
| 30 | 31 | //! Zero for either variable turns that cap off. | |
| ⋯ | |||
| 133 | 134 | cap > 0 && today >= cap && !lifted | |
| 134 | 135 | } | |
| 135 | 136 | ||
| 136 | − | /// Whether the breaker is about this start: an agent run on g1t's hosted | |
| 137 | − | /// models (an agent run that does not say is taken to be one). | |
| 138 | − | pub(crate) fn breaker_applies(kind: ComputeKind, hosted_model: Option<bool>) -> bool { | |
| 139 | − | kind == ComputeKind::Agent && hosted_model.unwrap_or(true) | |
| 137 | + | /// Whether the breaker is about this start: any compute g1t would pay | |
| 138 | + | /// for. Every kind costs g1t sandbox time, whatever model an agent uses, | |
| 139 | + | /// so none is left out; a workspace whose spend is covered is left out by | |
| 140 | + | /// [`covered_by_revenue`] instead. | |
| 141 | + | pub(crate) fn breaker_applies(_kind: ComputeKind, _hosted_model: Option<bool>) -> bool { | |
| 142 | + | true | |
| 140 | 143 | } | |
| 141 | 144 | ||
| 142 | 145 | /// Whether a workspace's spend is covered by revenue, so the breaker | |
| ⋯ | |||
| 175 | 178 | /// What a hosted-model start is told while the breaker is open. | |
| 176 | 179 | pub(crate) fn breaker_refusal(today: i64, cap: i64) -> String { | |
| 177 | 180 | format!( | |
| 178 | − | "g1t's daily spend breaker is open: g1t has paid {} of its {} a day for work today, so new agent runs on g1t's hosted models wait until 00:00 UTC. Agents on the workspace's own model provider still run, and so does work on the paid plan.", | |
| 181 | + | "g1t's daily spend breaker is open: g1t has paid {} of its {} a day for work today, so new runs g1t pays for wait until 00:00 UTC. Work on the paid plan still runs.", | |
| 179 | 182 | cents(today), | |
| 180 | 183 | cents(cap) | |
| 181 | 184 | ) | |
| ⋯ | |||
| 290 | 293 | let lifted = self.breaker_row(day).await?.and_then(|row| row.lifted_by); | |
| 291 | 294 | let mut lines = vec![ | |
| 292 | 295 | format!( | |
| 293 | − | "g1t paid {} for work today ({day}, UTC), its daily cap of {} (PLATFORM_DAILY_SPEND_CAP_MICROS). New agent runs on g1t's hosted models that g1t pays for are paused until 00:00 UTC; workspaces paying with real money, and agents on their own model provider, are not affected. Runs already going finish.", | |
| 296 | + | "g1t paid {} for work today ({day}, UTC), its daily cap of {} (PLATFORM_DAILY_SPEND_CAP_MICROS). New compute that g1t pays for (workflows, checks, the merge queue and agents) is paused until 00:00 UTC; workspaces paying with real money, and comped accounts, are not affected. Runs already going finish.", | |
| 294 | 297 | cents(total), | |
| 295 | 298 | cents(self.caps.daily) | |
| 296 | 299 | ), | |
| ⋯ | |||
| 324 | 327 | return Ok(None); | |
| 325 | 328 | } | |
| 326 | 329 | let comped = account.terms.full_discount(); | |
| 327 | − | if covered_by_revenue(plan, comped, account.allowances.plan, self.live()) { | |
| 330 | + | // A comped account is held by its own monthly budget instead. | |
| 331 | + | if comped || covered_by_revenue(plan, comped, account.allowances.plan, self.live()) { | |
| 328 | 332 | return Ok(None); | |
| 329 | 333 | } | |
| 330 | 334 | let day = today(); | |
| ⋯ | |||
| 680 | 684 | } | |
| 681 | 685 | ||
| 682 | 686 | #[test] | |
| 683 | − | fn the_breaker_is_about_hosted_model_agent_runs() { | |
| 687 | + | fn the_breaker_is_about_all_compute_g1t_pays_for() { | |
| 684 | 688 | assert!(breaker_applies(ComputeKind::Agent, Some(true))); | |
| 685 | 689 | assert!(breaker_applies(ComputeKind::Agent, None)); | |
| 686 | − | assert!(!breaker_applies(ComputeKind::Agent, Some(false))); | |
| 687 | − | assert!(!breaker_applies(ComputeKind::Check, None)); | |
| 688 | − | assert!(!breaker_applies(ComputeKind::Workflow, Some(true))); | |
| 690 | + | assert!(breaker_applies(ComputeKind::Agent, Some(false))); | |
| 691 | + | assert!(breaker_applies(ComputeKind::Check, None)); | |
| 692 | + | assert!(breaker_applies(ComputeKind::Workflow, Some(true))); | |
| 689 | 693 | } | |
| 690 | 694 | ||
| 691 | 695 | #[test] | |
Comments
Sign in to comment.