Repository navigation
feat(scaling): find units Lens lost track of, and let them go on a person's yes - #666
Merged
Merged
Conversation
…rson's yes Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3
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.
Description
Before: if a launch started a machine but its answer never reached Lens (a timeout, a crash between the call and the write), or a terminate half failed, that machine kept running and billing at the provider, and nothing in Lens showed it. Each driver's
listingexisted but nothing called it.After: while scaling runs, the scaler asks each provider every ten minutes for the units it runs with Lens's tag. A unit that no unit of Lens's stands for is a stray. It shows on its provider (
straysandlist_errorinGET /api/v1/scaling/providers, and a red line in Settings › Auto scaling) and goes in the activity ledger once, asscaling.stray. Lens lets none of them go itself. A person signed in to the web app does, with Let go (Undo stays for a few seconds) orPOST /api/v1/scaling/providers/{id}/strays/let-go. The assistant can only ask (let_go_scaling_stray), and its ask waits for that yes on the Approvals page. An API key or an app gets 403.How:
Scaler._straysruns each tick and lists only providers not asked in the last ten minutes. A unit that runs is known by its id or its name. One let go in the last hour is known by its id only, since the provider may still show it while it goes. A failed launch (no id came back) is not known, so a machine it left behind is reported at once. Letting one go calls the driver's ownterminatewith the stray's id (every driver keys onexternal_id), and first refuses if a live unit now matches it.Motivation and Context
Adeel asked for auto scaling that "setups and manage every single thing", auditable and agent native. Machines that cost money with nothing in Lens to show them are the gap a manager has to close.
Types of changes
!in the title)Checklist:
test_units_lens_lost_track_of_show_on_their_provider,test_a_person_lets_a_stray_go_and_an_agent_cant,test_the_assistant_asks_to_let_a_stray_go_and_the_person_says_yes, and two web tests).docs/scaling.md"Units Lens lost track of" and Agents,docs/requirements.md, README).changelog.d/scaling-strays.md.Done questions (AGENTS.md)
scaling(assistant and MCP) and the API. The assistant asks to let one go, and a person approves.scale_providertable only. Old rows read as no strays.make openapi.listingandterminate, the activity ledger, the Approvals flow and the panel's Undo pattern.Generated by Claude Code