Repository navigation
Conversation
An omitted num_instances now fails with a required-key error instead of reading as zero, so only an explicit 0 can stop a service. Miren disks and single-writer addons accept 0 alongside 1, since a stopped service holds no writer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launcher creates or resets their pool at zero, skips the one-instance boot it does for deploy verification, and doesn't wait for readiness on a pool with nothing to boot. The minutely resync leaves them at zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pool manager clears ConsecutiveCrashCount and CooldownUntil once a sandbox has run long enough, but hands the change back through Encode(), which drops zero values. The reset never reached the store, so the pool kept its old streak and the next crash backed off from the stale count. Write both fields explicitly, as the status counters already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sandbox that dies young while a num_instances = 0 service stops would be counted as a crash. Cooldown then floors a referenced pool's desired count to one, reviving the service the operator just stopped, and status reads crashed for up to fifteen minutes. Clear crash state instead. The config lookup only runs for a zero-desired pool that has crash state to clear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The activator returned the pool at its zero cap and left the caller waiting for capacity until the 120s pool timeout. It now returns ErrServiceStopped up front, which httpingress serves as 503 and internal requests report as the error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every-service-at-zero used to classify as starting, so miren deploy waited out its timeout on a successful deploy. A new stopped health state covers it: deploy finishes with a stopped verdict, app list shows it, and app status marks the stopped services. A service fixed at zero no longer counts as a pinned fixed service, so beside an idle autoscale web service the app still reads as idle. Deploy events publish it as scaled_to_zero rather than adding an outcome to that vocabulary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@jcasimir Interesting! I think I'd rather have an explicit "disabled" state rather than setting num_instances to 0. That allows the system to know that the user has disabled the app rather than there is some sort of broken state. |
|
Test runners 3 and 4 failed with |
|
@evanphx Agreed, an explicit state is better: it records that the operator turned the app off, which an app at zero instances can't tell you. I've reworked this as #1322, |
Why
There's no way to keep an app deployed but not running. Autoscaled
webservices already drain to zero, but the next request wakes them. Fixed services can't go to zero at all:num_instances = 0is rejected at parse time.miren sandbox-pool set-desired <pool> 0is undone within a minute, because the launcher's resync raises fixed pools back to their configured count.That leaves
miren app deleteas the only way to park an app with a worker or an in-app database. Deleting throws away routes, env, and history.Our case: we're moving apps between machines and want to keep the old copy deployed but stopped as a fallback, without deleting it.
What
Allow
num_instances = 0for fixed-mode services. The service stays deployed (its pool, disks, addons, routes, and env stay in place) and nothing boots until a deploy raises the count:Design choices worth flagging
miren app suspend/resume(a flag on the App that the launcher and activator respect) would give a resume that skips a deploy. That's a bigger change, and I'm happy to open a proposal for it separately. This PR is the smaller step that makes zero reachable at all.NumInstancesbecomes*intin appconfig, somode = "fixed"with nonum_instancesfails with "required" instead of reading as 0. A forgotten line can't silently stop a service.MaxInstances() == 0is the signal.FixedStrategyalready returns its count fromMinInstances/MaxInstances, so the launcher, activator, and pool manager each ask the strategy rather than parsing config again. Before this PR, fixed with 0 couldn't be stored: the client rejected it, hydration defaults to 1, and the empty-concurrency migration only fills blanks. So no existing app changes behavior.stoppedhealth state. When every service is fixed at zero, health had nowhere to go butstarting, somiren deploywaited out its timeout on a successful deploy.stoppedis terminal for deploy, shows inapp list, and marks services inapp status. A service fixed at zero no longer counts as a pinned fixed service, so an app with an idle autoscaleweband a stopped worker still reads asidle. Deploy events publish it asscaled_to_zerorather than adding a value to that vocabulary, the same way the no-service outcome maps ontotask_only.Touch points
appconfigNumInstances *int; fixed mode requires it and allows 0; disk and single-writer checks accept 0controllers/deployment/launcher.gocontrollers/sandboxpool/manager.gocomponents/activator,servers/httpingressErrServiceStoppedup front instead of waiting out the 120s pool timeout; served as 503servers/app,pkg/apphealth,cli/commandsstoppedhealth state, deploy verdict, list and status renderingdocsA separate fix along the way
9ebc795fixes an existing bug. When a sandbox proves healthy, the pool manager clearsConsecutiveCrashCountandCooldownUntil, but it saves its changes throughEncode(), which drops zero values. The reset never reached the store, so the next crash backed off from the stale streak.TestManagerHealthySandboxResetPersistsfails onmainand passes with the fix. The stopped-service guard depends on the same persistence, so it's in this PR. I'm happy to split it out if you'd rather take it on its own.Tests
Each new test fails without its change and passes with it. I checked by reverting each production change and re-running.
appconfig: 0 accepted, an omitted key rejected as required, negative rejected; disks and miren-sqlite accept 0 and still reject >1controllers/deployment: a new pool starts at 0; running → 0 stops without a verification boot; the resync leaves it at 0; raising the count starts it againcontrollers/sandboxpool: a stopped pool with prior crash state and a young dead sandbox stays at 0 and clears its crash state; healthy-reset persistence (above)components/activator:AcquireLeaseon a stopped service returnsErrServiceStoppedin well under a secondservers/app,cli/commands: classify table (stopped alone and beside idle, starting, and running services),noteSpec, and the deploy decisionAll touched packages pass locally with
TZ=UTC. Two caveats: tests that need the etcd dev environment didn't run here.TestManagerLongStartupFailureBackofffails onmainoutside UTC because it compares a UTC time against a Local one. golangci-lint v2.12.2 is clean on the touched packages.🤖 Generated with Claude Code