Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh

Commit

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.

syntaqxcommitted Parent986ef0dBrowse files
5 files+25−210/5 viewed
+1−1
1616 settings: "Guardrails saved. They apply from the next run.",
1717 mapping: "Mapping saved. It applies from the next run; read the bill now to see it.",
1818 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.",
2020 paused: "Paused across g1t. Every service sees it within 30 seconds; it is recorded in the audit log.",
2121 resumed: "Resumed across g1t. Every service sees it within 30 seconds; it is recorded in the audit log.",
2222 };
+1−1
278278 const parts: string[] = [];
279279 if (caps.tripped) {
280280 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`,
282282 );
283283 }
284284 for (const budget of caps.comped) {
+2−2
393393 className="mt-6"
394394 id="spend"
395395 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."
397397 >
398398 <div className="grid gap-3 lg:grid-cols-2">
399399 <CapMeter
403403 hint={
404404 caps.tripped ? (
405405 <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.
407407 </span>
408408 ) : caps.liftedBy ? (
409409 <>
+2−2
36873687 pub today_micros: i64,
36883688 /// `PLATFORM_DAILY_SPEND_CAP_MICROS`. Zero: no breaker.
36893689 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
36913691 /// for wait until tomorrow (UTC) or until staff lift it.
36923692 pub tripped: bool,
36933693 pub tripped_at: Option<String>,
37583758 #[derive(Debug, Default, Serialize, Deserialize)]
37593759 pub struct AdminSpendCapsArgs {}
37603760
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
37623762 /// of today (UTC), with why. Recorded in the audit log. Returns
37633763 /// `Outcome<SpendCaps>`.
37643764 #[derive(Debug, Serialize, Deserialize)]
+19−15
2121 //! month; at 100% new work on it is refused until staff raise it or the
2222 //! month turns. Work already running finishes.
2323 //! 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
2829 //! shows a red bar; staff can lift it for the day.
2930 //!
3031 //! Zero for either variable turns that cap off.
133134 cap > 0 && today >= cap && !lifted
134135 }
135136
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
140143 }
141144
142145 /// Whether a workspace's spend is covered by revenue, so the breaker
175178 /// What a hosted-model start is told while the breaker is open.
176179 pub(crate) fn breaker_refusal(today: i64, cap: i64) -> String {
177180 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.",
179182 cents(today),
180183 cents(cap)
181184 )
290293 let lifted = self.breaker_row(day).await?.and_then(|row| row.lifted_by);
291294 let mut lines = vec![
292295 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.",
294297 cents(total),
295298 cents(self.caps.daily)
296299 ),
324327 return Ok(None);
325328 }
326329 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()) {
328332 return Ok(None);
329333 }
330334 let day = today();
680684 }
681685
682686 #[test]
683− fn the_breaker_is_about_hosted_model_agent_runs() {
687+ fn the_breaker_is_about_all_compute_g1t_pays_for() {
684688 assert!(breaker_applies(ComputeKind::Agent, Some(true)));
685689 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)));
689693 }
690694
691695 #[test]

Comments

Sign in to comment.