Skip to content

AI-3756: no sandbox for a suspended or unpaid organization - #2410

Merged
martinmitrevski merged 7 commits into
mainfrom
martinmitrevski/ai-3756-high-paid-daytona-sandboxes-bypass
Nov 25, 2026
Merged

martinmitrevski merged 7 commits into
mainfrom
martinmitrevski/ai-3756-high-paid-daytona-sandboxes-bypass

Conversation

@martinmitrevski

@martinmitrevski martinmitrevski commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Nothing asked whether an organization could pay before a sandbox was made on Stream's shared Daytona account. Enforcer.Sandbox (internal/policy/sandbox.go:154-195) checks only the sandbox limits (size, network, concurrency), and only once, when the session opens. metered.Sandboxes.Open and daytona.Sandbox.create (daytona.go:495) and revive never call Admit. A suspended organization, or one with no credit or past its spend hard limit, could pair a free custom/* LLM with sandbox: daytona and run paid Daytona VMs for as long as it liked. A sandbox already running when money ran out also billed on until it went idle, and code could run in it for up to 30 minutes (timeout_ms).

How it works

The sandbox now goes through the same Gate.Admit as an LLM response (internal/llmrouter/session.go:613), with the same rule for Admission.Spend. Daytona asks before any work that starts billing, and again every minute while the sandbox runs, idle or running code.

daytona.Sandbox.use  (Run, Write, Ready; the gate held)
├─ started: admitted(running)            running = box made and not lapsed
│  ├─ admitted -> create / revive as before
│  └─ refused  -> running: halt (Daytona stop, slot back, meter.Stopped)
│                 refusal returned; nothing made or started
└─ watched(call)                         one goroutine per call, joined before it returns
   ├─ every AdmitEvery: Admit(running=true)
   │  └─ refused -> cut call's context with the refusal
   └─ call ended, refused: finished -> its result; cut -> the refusal
      done (files read, gate still held): halt (not once Close ran: the
      delete follows)

halt: Daytona stop failed -> read the state
   ├─ not found / destroyed(ing)          -> forgotten, meter told it is gone
   ├─ stopping / stopped / archiv(ing|ed) -> billed as stopped
   └─ else                                -> running; stopped at the next check

lifecycle timer (arm/lapse), every AdmitEvery while the sandbox idles
└─ session open:  admitted(running=true) -> halt on a refusal
   session closed (an orphan whose delete failed): unchanged,
                  deleted once it idles

metered.Sandboxes.admit(owner, meter.config())   (the Admit hook)
├─ running: Gate.AdmitRunning (money spent), else Gate.Admit (money held too)
├─ Gate.Admit error (suspended)                -> refuse
├─ Admission.Spend && Recorder.Billable(config) -> refuse   (LLM path's rule;
│     BYOK included: its fee is billed; no Recorder counts as billable)
└─ running && policy.Transient(err)            -> admit: a running sandbox
                                                  waits out an unchecked balance
  • One admission path. The hook calls Gate.Admit and nothing else, so limits mode comes from the enforcer. Off allows. Shadow allows and counts "would refuse" (LimitHit, Enforced=false). Enforce refuses.
  • The LLM path's money rule. admission.Spend != nil && recorder.Billable(config), as llmrouter/session.go:619, with config the one the sandbox's meter bills under (sandboxMeter.config(): daytona, running, its region, BYOK). A BYOK sandbox is billable at its 20% fee (pricing.BYOKModalities), so it is refused like a BYOK model. A Stream sandbox stays billable: vendor.json's sandbox entries name a class, so an item with no attributes matches none, and an unmatched item is billable. Only a price list that makes sandboxes free admits one with no credit.
  • Every billing path. create (daytona.go:589) and wake's start (:743) are the only calls that make Daytona bill, and both run behind started(). metered.Sandboxes.Open is the only caller of daytona.New.
  • While code runs. The lifecycle timer waits for the gate, which a run holds for up to its timeout, so use wraps the call in watched. Its goroutine only calls Admit and cuts the call's context. The stop is made after the goroutine is joined, under the gate the call holds, so it never races Close, the idle stop or the timer. The goroutine is owned by the call, ends with it, and is not started for a sandbox with no Admit. It starts through goroutine.Go, so a panic in it ends that call, not the router.
  • A running sandbox is stopped for money spent, not set aside. Starting or restarting one goes through Enforcer.Admit, which counts reservations, as new work does. One already running goes through Enforcer.AdmitRunning (routing.RunningGate), which takes the balance as a low-balance warning reads it (settledBalance: this router's recorded work, no reservations, its own lease included) and the spend hard limit and the customer's limits by their ledgers alone, and records no grant draw. So a reservation elsewhere never cuts a run while the organization has credit; suspension and money actually spent still do.
  • A stop that failed is read. Daytona's stop posts and then waits, so its answer can be lost after the sandbox stopped. halt then reads the state: stopped, stopping or archived is billed as stopped and started again by the next run that is allowed; not found or destroyed is forgotten and its meter told it is gone; anything else stays running and is stopped at the next check.
  • A run that finished keeps its result. A refusal that lands as the code answers returns the run's result, and the sandbox is stopped in done, once its files have been read, under the same gate.
  • Stop, not delete. halt does what the idle stop does (stoppedAt, letGo, meter.Stopped) and also calls Daytona's stop. The files stay, and only disk bills. The next run its organization may pay for starts the same sandbox again. StoppedDelete and the session's close delete it as before.
  • The caller sees the refusal. Run returns the policy error unchanged, also when it cut the run. The agent and the harness hand its text to the model ("the organization has no credit left; …"), as they already do for ErrSandboxLimit.
  • Wiring. newSandboxes (cmd/router/sandboxes.go) takes the *policy.Enforcer and sets SandboxesOptions.Gate from it, as metered.Knowledge takes its gate. AdmitEvery is SandboxesOptions.Every, which production leaves at zero: a minute.

Decisions to check

Decision Why
A BYOK sandbox is refused on Admission.Spend, as a BYOK LLM call is Its fee rows are billed to Stream's organization balance, so a zero-credit organization's BYOK sandbox would take the balance below zero. The rule is the LLM path's (Recorder.Billable on the meter's config), not a sandbox-specific one.
Recorder.Billable is checked for every sandbox, not just BYOK Same rule as the LLM path. Production is unchanged for Stream's sandboxes: they are billable because no when-less entry matches them. A deployment whose price list marks them free admits them with no credit.
A SandboxesOptions with no Recorder takes the sandbox as billable Fails closed: Daytona bills it whether or not the router records it. No production caller has a nil recorder with a gate.
A router with no usage service applies the customer's own spend limits to sandboxes That is what Admit does for LLM calls there. No suspension, credit or hard limit exists there, so only a spend limit the customer set can refuse. Untested.
Admission is not added to Enforcer.Sandbox (the ticket's suggestion) That check runs once, at session open. It turns any error into "the session runs without its sandbox", and api/configs.go:1022 shares it on config save. Money can run out long after the session opens, so the check sits where billing starts.
A transient refusal leaves a running sandbox running, also mid-run policy.Transient says work under way should wait for the check rather than end. A new or stopped sandbox is still refused, as an LLM call is.
A run is watched by a goroutine of its own, not by routing.Slices lease refusals (the ticket's step 2) A lease refusal would still need a way into the run that holds the gate, so it would need this cut too, plus a callback from the lease's goroutine. Reserve, which refuses a lease, checks what Admit checks, and the watch asks every minute rather than on the 30 s renewal. One difference: Admit counts the sandbox's own lease hold, so a sandbox stops when less than about a minute of its cost is left, as the organization's other billable work is refused then too.
A refusal that lands during a run's downloads (after the code ended) is not checked until the timer's next minute watched covers use's call, not the downloads after it, which are bounded by the 60 s check timeout.
The start is not watched, only the call after it use wraps the call (the run, a write), not started(). Create, the wait for start, a revive and the setup are admitted once, just before, and then hold the gate unwatched for up to Timeout: 20 minutes for a built image's first start, 60 seconds otherwise. A refusal in that window is seen by the call's first check or the timer's next one.
A refused run in a sandbox whose session closed is cut but not stopped Close gave up waiting and its delete follows as the run lets the gate go. A stop would set stoppedAt, so if that delete failed the timer would never try it again (it retries only an idle running orphan), as lapse already skips admission once closed.

Validation

Test Defect it catches Fails before the fix
MeteredSuite/TestASuspendedOrganizationNeitherMakesNorStartsAgainASandbox A suspended organization makes a sandbox, or starts its stopped one again yes
MeteredSuite/TestAnOrganizationWithNoCreditNeitherMakesNorStartsAgainASandbox A zero-credit organization makes or starts again a sandbox; the refusal's text does not reach the caller yes
MeteredSuite/TestAnOrganizationOverItsSpendHardLimitNeitherMakesNorStartsAgainASandbox An organization past its daily spend hard limit makes or starts again a sandbox yes
MeteredSuite/TestASandboxInTheOwnersOwnDaytonaOrganizationIsRefusedWithNoCredit A BYOK sandbox is exempt from Admission.Spend, unlike a BYOK model yes (against the first version of this branch, which exempted it)
MeteredSuite/TestASandboxThePricesMakeFreeIsMadeWithNoCredit Spend refuses a sandbox the price list makes free (the Billable half of the rule is missing) yes (same)
MeteredSuite/TestASandboxRecordedNowhereIsRefusedWithNoCredit A Sandboxes with a gate and no recorder admits, or panics on, a zero-credit owner no (pins the fail-closed default)
MeteredSuite/TestASandboxInTheOwnersOwnDaytonaOrganizationIsRefusedWhileTheyAreSuspended A suspended organization's BYOK sandbox is made yes
MeteredSuite/TestARunRefusedForMoneyStopsTheRunningSandboxAtOnceUntilItsOrganizationMayPayAgain A refused run leaves the running sandbox billing until it idles; it is not billed as stopped; it never starts again after a restore yes
MeteredSuite/TestARunningSandboxIsStoppedOnceItsOrganizationRunsOutOfCredit A running sandbox nobody runs code in bills on after the money ran out yes
MeteredSuite/TestInShadowASandboxOfAnOrganizationWithNoCreditIsMadeAndCountedAsWouldRefuse Shadow refuses a sandbox, or the sandbox is never admitted at all (no would-refuse) yes
MeteredSuite/TestWhileMoneyCannotBeCheckedARunningSandboxRunsOnAndNoOtherIsMade An unchecked balance stops a running sandbox, or lets a new one be made yes
MeteredSuite/TestASandboxWhoseSessionClosedIsStillDeletedOnceItIdlesThoughItsOrganizationIsRefused An orphan of a refused organization is stopped and left for Daytona's timer instead of deleted no (pins the orphan path)
LifecycleSuite/TestASandboxStoppedForItsOwnersMoneyGivesBackItsSlot A sandbox stopped for money keeps its max_concurrent slot no (needs the new hook)
LifecycleSuite/TestARefusalWhileCodeRunsEndsTheRunAndStopsTheSandbox A refused organization's code runs on for up to its 30-minute timeout, its sandbox billing as running, because the timer waits for the gate the run holds yes (the run had not ended 5 s after the refusal)
LifecycleSuite/TestARefusalWhileCodeRunsInAClosedSandboxLeavesItToBeDeleted A refusal during a run Close gave up on stops the sandbox, so its failed delete is never tried again yes (the run had not ended)
LifecycleSuite/TestARunGoesOnWhileItsOwnersMoneyOnlyCannotBeChecked The check during a run asks as for a sandbox not running, so an unchecked balance cuts the run yes (no check ran during the run)
LifecycleSuite/TestASandboxNobodyAdmitsRunsAsBefore A sandbox with no Admit starts the watch and calls a nil hook (a panic once a run outlasts AdmitEvery) no (pins the guard)
LifecycleSuite/TestARunningSandboxIsAdmittedAgainEveryMinuteUnlessToldOtherwise AdmitEvery left at zero, as production leaves it, re-arms the timer at once: admissions in a loop no (pins the default; synctest)
cmd/router TestTheSessionsSandboxesAreAdmittedByTheGate newSandboxes builds its sandboxes with no gate from the router's policies no (needs the new parameter)
  • The metered and router tests run the real enforcer over a usage service of their own (policytest). Suspension, credit, the hard limit and shadow are set through its management API, and Daytona is daytonatest. The daytona tests use the in-process Daytona and an Admit hook; a code run is held in a client-side RoundTripper, since daytonatest answers one request at a time and a run held there would hold the stop too. The slot test uses the real slots on Redis.
  • A funded organization's sandbox is made: the first run in each of the three "neither makes nor starts again" tests proves it, so a fix that refuses everything fails them.
  • Fails before the fix: the first-pass tests were checked with a mutant in which metered.Sandboxes.admit returns no hook, which is the code before the fix. The three run tests were checked against the first version of daytona.go on this branch with go test -overlay, and the BYOK and free-price tests against its first metered/sandbox.go.
  • Mutants: each was applied alone with go test -overlay, then the touched suite was run under -race.
Mutant Caught by
no hook (the code before the fix) every new metered test but the free-price and orphan ones
BYOK exempt from Spend …OwnDaytonaOrganizationIsRefusedWithNoCredit
Recorder.Billable dropped (Spend refuses whatever the prices say) TestASandboxThePricesMakeFreeIsMadeWithNoCredit
no-recorder clause dropped (nil dereference) / a missing recorder admits TestASandboxRecordedNowhereIsRefusedWithNoCredit
Admit's error ignored (suspension) the suspended, BYOK-suspended and run-refused tests
Spend ignored no credit, BYOK no credit, recorded nowhere, hard limit, stopped-when-credit-runs-out, unchecked-money
transient stops a running sandbox / transient admits a new one TestWhileMoneyCannotBeChecked…
use does not watch the call TestARefusalWhileCodeRuns…, TestARunGoesOn…
the watch's refusal does not cut the call TestARefusalWhileCodeRuns…
no halt after a refused call TestARefusalWhileCodeRuns…
halt after a refused call though the session closed TestARefusalWhileCodeRunsInAClosedSandbox…
a refused call returns its cut error, not the refusal TestARefusalWhileCodeRuns…
the watch admits with running=false TestARunGoesOn…
the watch started with no Admit TestASandboxNobodyAdmitsRunsAsBefore (panic)
no AdmitEvery default TestARunningSandboxIsAdmittedAgainEveryMinute… (admitted at 0 s, 0 s instead of 1 min, 2 min)
newSandboxes builds no gate (if policies != nil → if false) TestTheSessionsSandboxesAreAdmittedByTheGate
newSandboxes sets a typed-nil gate (guard deleted) survives: equivalent, as a nil *policy.Enforcer admits everything; only a watch and a timer run for nothing
buildSessions passes nil instead of policies caught: a test opens a sandbox through buildSessions and Manager.Run with a model that calls run_code
  • halt now has a second caller, so its mutants were re-run, all caught: without meter.Stopped (TestARefusalWhileCodeRuns…, the slot test, TestARunRefusedForMoney…, TestARunningSandboxIsStoppedOnce…), without letGo (the slot test), without stoppedAt (TestARunRefusedForMoney…'s restore), without Daytona's stop (TestARefusalWhileCodeRuns…, TestARunRefusedForMoney…, TestARunningSandboxIsStoppedOnce…). The first version's mutants for started() and the lifecycle timer (no admission in started, arm or lapse, a lapsed sandbox taken as running, the timer admitting an orphan) were not re-run: that code is unchanged.
  • Passed locally (-tags integration -race; after the goroutine.Go change, internal/sandbox/daytona three times and internal/metered once more): internal/metered and internal/sandbox/... in full, the cmd/router sandbox tests, go vet -tags integration ./..., gofmt. The new daytona tests passed 20 runs in a row under -race (the closed-session one 10), the new metered ones 5. One full run failed egress's TestProxySuite/…IsClosedAtTheIdleTimeout/neither_reads on its memory bound while other tests ran beside it; egress imports none of the changed packages, and it passed on the rerun. internal/policy is unchanged and was not rerun.
  • After review: internal/policy, internal/metered, internal/sandbox/daytona in full, unit tests of routing, policy, daytona, metered, and cmd/router -run 'Sandbox|BuildSessions', all with -race; each new test checked against its mutant (8 in policy, 3 in metered, and the halt, watched, arm and wiring ones), also on a trial merge with origin/main. archiving, archived and destroying have no test of their own.
  • Not verified: Not run against real Daytona: whether Daytona answers with an error when asked to stop a sandbox it is already stopping. If it does, halt logs a warning and tries again at the next admission. A refusal that cuts a revive while Daytona is starting the sandbox leaves it to Daytona's own idle stop.
  • Merges cleanly with main at 8c4910e0d (git merge-tree), and go vet -tags integration ./... passes on the merged tree. None of those commits touches the sandbox, metered, policy or routing code.
  • Open PRs (git merge-tree against this commit):
    • fix(router): bill a BYOK sandbox only to an app that keeps its key #2252 merges cleanly in cmd/router/sandboxes_test.go, main.go and the README. It conflicts in cmd/router/sandboxes.go, in customerDaytonaKeys, which conflicts against main already; this PR's change to newSandboxes is not part of that conflict.
    • [AI-3699] Fix the flaky daytona Close test and its race #2338 rewrites the daytona test files and merges cleanly. The helpers admit_test.go uses (slotsFor, held, told, run, the suite's meter, logs, daytona) are unchanged there, and none of its names (stallingRuns, running, unpaid) is taken. With its four test files laid over this branch, the package vets and the new tests pass.

Follow-ups, not in this PR

  • A free price entry with a class condition is not matched: the sandbox's billing config carries no attributes, so such an entry still leaves the sandbox billable and refused with no credit.
  • On running work, the spend hard limit and the customer's limits see this router's recorded spend only at the next ledger read (about 5 s), and a grant's remaining room still counts reservations.

Fixes AI-3756

🤖 Generated with Claude Code

martinmitrevski and others added 3 commits November 25, 2026 00:11
A Daytona sandbox on Stream's account was made, and started again, with
no admission: a suspended organization, or one with no credit or past its
spend hard limit, could run paid VMs next to a free custom LLM.

The sandbox now goes through Gate.Admit as an LLM response does, before it
is made, started again or used, and on its lifecycle timer every slice
while it runs. A running sandbox refused is stopped as at an idle stop, and
starts again on the next run its organization may pay for. A suspended
organization is always refused; one that may spend no money is refused
unless the sandbox is in its own Daytona organization. A refusal that only
means the money could not be checked leaves a running sandbox running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The once-a-minute admission rode the lifecycle timer, which waits for the
gate a run holds for up to 30 minutes, so a refused organization's code ran
on. Each call in the sandbox is now watched: a goroutine owned by the call
admits the owner every AdmitEvery and cuts the call on a refusal; the
sandbox is then stopped under the gate and the run returns the refusal. One
whose session closed is not stopped, as its delete follows.

A BYOK sandbox is refused on Admission.Spend as a BYOK model is: the LLM
path's rule (Spend and Recorder.Billable), on the config the sandbox's meter
bills under. A sandbox with no recorder is taken as billable.

newSandboxes takes the *policy.Enforcer, so its test covers the nil guard
and the gate it builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martinmitrevski
martinmitrevski marked this pull request as ready for review November 25, 2026 08:00

@thesyncim thesyncim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed at 6a79381 merged with main 0e5197a. Every path I found that makes or wakes a sandbox goes through the new check, and a race probe of 8 callers with refusals flipping was clean under -race. Two should-fixes are inline; both are about stopping a running sandbox.

Tests that would hold rules nothing holds now (each mutant passes): passing nil for policies in main.go; the second call after a vanished sandbox left unwatched (daytona.go:441); arm using admitEvery when the idle stop is sooner; halt ignoring the stop's error.

Questions

  • A customer's own sandbox account is refused with no credit here, where #2406 serves a customer's own vendor account. Is the difference meant?
  • watched drops the result of a run that finished in the moment the check refuses, so the model is told it was refused though the code ran. Return the result and still halt?

Nit: a free price entry with a class condition, as the priced entries have, is not matched in metered/sandbox.go since the config has no attributes, so such a sandbox is refused with no credit. Pass the attributes, or say in the README that only an entry without conditions counts.

func (s *Sandbox) halt(ctx context.Context, refusal error) {
stop, end := context.WithTimeout(context.WithoutCancel(ctx), s.check)
defer end()
if err := s.box.Stop(stop); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should fix: Stop can return an error after Daytona stopped the sandbox: the SDK posts the stop and then waits for stopped, so a lost answer or a wait that times out ends here. The sandbox then stays recorded as running, with stoppedAt zero. I let daytonatest stop the sandbox but dropped the answer: the meter kept running, and once the owner was admitted again every run failed with "sandbox sandbox-1 is not started", because lapsed() is false and revive is never reached. Each failed run moves used, so it stays that way until the sandbox idles out. With the sandbox deleted by someone else, halt fails every minute with not found and the meter is never told it is gone. Could this read the state after a failed stop, and take stopped/stopping/archived as stopped and not found/destroyed as lost? Ignoring the stop's error also passes the tests, so a failing stop needs one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 99c40cd (tests in d642a06). After a failed stop, halt now reads the sandbox's state (the read is shared with vanished as deleted). Stopped, stopping or archived is billed as stopped and started again by the next run that is allowed. Not found or destroyed is forgotten and its meter told it is gone, so nothing is stopped every minute. A stop that never reached Daytona leaves it running until the next check. admit_test.go covers the lost answer, the sandbox deleted by someone else, a stop that did not happen, and the stopping and destroyed states; ignoring the stop's error fails the would-not-stop test.

return nil
}
return func(ctx context.Context, running bool) error {
admission, err := s.options.Gate.Admit(ctx, owner)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should fix: Admit counts what is set aside as well as what is spent, so a running sandbox is stopped, and its code cut, while the organization still has credit. With 1,000,000 of credit and one other reservation of 1,500,000, the running sandbox was stopped at its next check as no credit left; releasing the reservation admitted it again at once. An uncapped response near the end of a balance, or several at once, does that. For new work the caller can retry, but here a run of up to 30 minutes is lost. It also counts the sandbox's own lease, which Reserve leaves out on purpose ("never refused for its own last minute"). Could a running sandbox be stopped only for suspension or for money spent, not held?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in f39af6c. A running sandbox is now checked with Enforcer.AdmitRunning (routing.RunningGate), which counts money spent, not set aside: the balance as a low-balance warning reads it (settledBalance), and the spend hard limit and the customer's limits by their ledgers alone. Neither another reservation nor its own lease stops it; suspension and money actually spent still do. Starting or restarting one still uses Admit, so new work can still be refused for held money. With your numbers the running sandbox keeps running and a new one is refused (metered/sandbox_admission_integration_test.go, plus five cases in policy/money_test.go).

martinmitrevski and others added 4 commits November 25, 2026 12:02
…keeps its result

A stop whose answer was lost, or whose wait ran out, reads the sandbox's state: stopped,
stopping or archived is billed as stopped and started again by the next admitted run, and one
someone else deleted is forgotten, its meter told it is gone, rather than stopped again every
minute. A stop Daytona did not make leaves it running, to be stopped at its next admission.

A refusal that lands as a run finishes no longer drops the run's result: the code ran, so its
output and files come back, and the sandbox is stopped once they are read, under the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…set aside

Admit counts every hold, so a reservation of other work, or the sandbox's own lease, stopped a
running sandbox and cut its run while its organization still had credit. The enforcer's
AdmitRunning (routing.RunningGate) counts what was spent instead: the balance a warning reads
(settledBalance), and the spend hard limit and the customer's limits on their ledgers alone, as
their holds keep no reservation apart. A new or stopped sandbox is still admitted with Admit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rganization may pay for

A test through buildSessions and Manager.Run, with a model that calls run_code: an
organization with no credit has no sandbox made, one with credit does. It fails when
buildSessions hands newSandboxes no policies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a refusal stopping it once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martinmitrevski

Copy link
Copy Markdown
Collaborator Author

Thanks. Both inline points are fixed (replied there). On the rest:

Tests for the surviving mutants: each now has a test that fails with it. The nil policies wiring goes through buildSessions and Manager.Run with a model that calls run_code (57d1585): an organization with no credit gets no sandbox, a funded one does. The second call after a vanished sandbox (TestARunMadeAgainInANewSandboxIsWatchedToo), arm with an idle stop sooner than the next check (TestASandboxThatIdlesBeforeItsNextAdmissionIsStoppedForIdling) and halt ignoring the stop's error are in admit_test.go.

watched dropping a finished run: changed as you suggest (99c40cd). A run that had finished when the refusal arrived returns its result, and the sandbox is stopped in done, once its files are read, under the same gate; a run the refusal cut still returns the refusal.

Nit (free entry with a class condition): not in this PR, listed under follow-ups in the description.

@martinmitrevski
martinmitrevski merged commit 05b4cb3 into main Nov 25, 2026
13 checks passed
@martinmitrevski
martinmitrevski deleted the martinmitrevski/ai-3756-high-paid-daytona-sandboxes-bypass branch November 25, 2026 13:00
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