Repository navigation
SCA-324: stop idle RUNNING omi-agent VMs in the reconciler - #11755
Merged
Git-on-my-level merged 2 commits intoAug 17, 2026
Merged
Git-on-my-level merged 2 commits into
Git-on-my-level merged 2 commits into
Conversation
Healthy no-session RUNNING omi-agent VMs had no server-side stop path, so the TERMINATED-only reaper never saw them and the fleet leaked. The reconciler now records idleSince and stops after a documented TTL. Failure-Class: new Co-authored-by: Cursor <[email protected]> Co-authored-by: multica-agent <[email protected]>
Required by Failure-Class: new on the idle-stop reconciler fix. Co-authored-by: Cursor <[email protected]> Co-authored-by: multica-agent <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Aug 17, 2026
## What changed and why Signed-in macOS launch warmup (`ensureProvisioned`) now only adopts an existing Agent VM (`ready` / `stopped` / `provisioning`). A missing VM or a failed status check logs and returns instead of falling through to `provisionAgentVM` / `runPipeline`. Onboarding still calls `startPipeline()` for explicit first create. There is no first-open Agent chat/tool path that assumed a VM already exists, so no extra create site was added. Closes SCA-328 Please merge with a regular merge commit (do not squash). This is the low-hanging create-rate cut. Do not duplicate #11755 (idle-stop in the reconciler, already merged). Reaper LIVE / public IP / #7326 / provision architecture are out of scope. ## Product invariants affected none ## How it was verified Focused desktop Swift tests after a clean package build: ```text ./scripts/dev-feedback.py --once swift 'AgentVMWarmupAdoptionTests|AgentVMLifecycleFenceTests|AgentVMCompressionRatioTests' Executed 14 tests, with 0 failures Iteration 1: PASS ``` `python3 scripts/check_desktop_test_quality.py` stayed at the source-inspection baseline (54 files / 147 sites). Did not exercise a live GCE provision; the production create call is now unreachable from the warmup path. ## Tests - `testWarmupAdoptsAReadyVMWithAnIP` / `testWarmupPollsProvisioningAndStoppedVMs` — adopt-only happy path - `testWarmupDoesNotCreateWhenStatusIsMissing` — missing VM on warmup does not create - `testWarmupDoesNotCreateWhenStatusCheckFails` — status error never provisions - `testWarmupDoesNotCreateForUnrecognizedOrErrorStatus` - `testStartPipelineStillCreatesWhileWarmupOnlyAdopts` — create stays off the warmup decision - `testLaunchWarmupNeverCallsTheCreatePipeline` — static contract: `ensureExistingOrProvision` never calls `runPipeline` / `provisionAgentVM`; home warmup still calls `ensureProvisioned`; onboarding still calls `startPipeline` ## Failure class (fixes) Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11759?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Line-Count-Exception: backend/jobs/agent_vm_reconciler.py | 1814 -> 1912 | idle-stop predicate and no-drift RUNNING path stay next to the existing stop/preserve CAS; splitting would hide the stop-vs-restart invariant
What changed and why
Idle RUNNING
omi-agent-*VMs had no server-side stop path: guest idle-stop is fail-silent, the reconciler only stopped on drift (then restarted), and the reaper deletes TERMINATED only. The reconciler now recordsidleSinceon a healthy no-session RUNNING VM and stops it afterAGENT_VM_IDLE_STOP_SECONDS(default 1h). The existing TERMINATED reaper remains the delete backstop.Closes SCA-324
Closes #6611
#7326's public-IP residual is out of scope (firewall still
applyEnabled: false). This PR covers the cost half only.Product invariants affected
none
How it was verified
Ran the agent-vm unit files after
make setup:including the new leak matrix (RUNNING+stale stops once and does not restart; RUNNING+lease and start-demand do not stop; TTL-not-reached persists
idleSince; idle is never a drift reason; README no longer claims RUNNING>2d; gueststop_instance()failures are logged).Did not exercise live GCE or the prod CronJob. Existing 1,151 prod VMs are operator cleanup after merge; ownerless VMs are unreachable by this path (
python3 backend/scripts/agent_vm_reaper.py --inventory).Tests
test_idle_running_vm_past_ttl_is_stopped_without_restart— the leak itselftest_idle_running_vm_with_active_session_is_not_stoppedtest_idle_running_vm_with_start_request_starts_not_stopstest_idle_ttl_not_reached_persists_idle_since_without_stoptest_idle_is_never_a_drift_reasontest_readme_does_not_reap_running_by_creation_agetest_stop_instance_is_observable_when_audience_missingtest_stop_instance_is_observable_when_broker_failsFailure class (fixes)
Failure-Class: new
Failure-class transition narrative (only when needed)
Violated contract: a healthy RUNNING
omi-agent-*VM with no unexpired session lease must be stopped after a documented idle TTL so the TERMINATED reaper can delete it. The guest 30-minute self-stop is fail-silent and is not a fleet backstop.Canonical guard:
idle_stop_due()inbackend/jobs/agent_vm_reconciler.py, used only on the no-drift RUNNING path (never folded intodrift_reasons, which would stop-then-restart). Tests inbackend/tests/unit/test_agent_vm_reconciler_job.pypin stop-once / lease-defer / start-demand / TTL-wait / not-a-drift-reason.Registry lifecycle for the new class is a follow-up PR after this instance fix merges.