Repository navigation
feat(scaling): auto scaling groups, rules and approvals, with This machine as the first provider - #556
Merged
Conversation
Providers with sealed credentials, scaling groups with target, step and schedule rules, approvals only a web session gives, budgets as Lens budgets, a scaler loop with a lease, REST routes, schemas, settings and tables. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3
…chine as the first provider Scaling groups launch units on a provider between min and max, by target, step and schedule rules, within a monthly budget, and launch nothing until a person signed in to the web app approves their terms. Agents propose and manage groups over the API, MCP and the assistant, and never approve. The scaler holds a lease, accrues each unit's cost into the activity ledger as an estimate, stops a group at its budget's cap, drains busy workers before letting them go, and pauses a group after three failures. This machine runs more lens worker processes at no cost. Threat model: P-SCALING. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3
…h group's terms The web app gets an Auto scaling section under System: the master switch, the scaler's timings, and each group with its terms in words, an Approve button for a group waiting on the person, and Pause or Resume. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALjNbLobvPe7VwvDL8j7V3
…-azm2mb # Conflicts: # fastapi_backend/app/api/v1/router.py # fastapi_backend/app/domain/ai_tools.py # nextjs-frontend/app/openapi-client/sdk.gen.ts # nextjs-frontend/app/openapi-client/types.gen.ts # nextjs-frontend/openapi.json # threat-model.md
18 of 23 tasks
This was referenced Oct 18, 2026
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: Lens ran a fixed number of workers. When jobs piled up nothing added capacity, and nothing let idle capacity go.
After: auto scaling groups add workers when work waits and let them go when it doesn't, like a cloud's auto scaling groups. A group launches units on a provider between min and max, picked by target, step and schedule rules, within a monthly budget. Every launch, join, drain, termination and hour of cost lands in the activity ledger. It is off until an admin turns it on, and a group launches nothing until a person approves its terms in Settings › Auto scaling. Agents propose and manage groups over the API, MCP and the assistant, and never approve one.
How:
domain/scaling.pyholds providers (credentials sealed per provider and field), groups, rules, approvals and the scaler loop. The scaler holds a lease in one process, reconciles each unit with its provider and its worker's heartbeat, drains busy workers before letting them go, stops a group at its budget's cap, and pauses a group after three failures.domain/scaling_drivers.pyis the driver interface. Its first driver, This machine, runs morelens workerprocesses at no cost. Cloud, Proxmox, SSH and model-host drivers are planned and build on this interface. A unit gets a one-hour, one-use mesh join token when the mesh is on, never a long-lived secret.Motivation and Context
Adeel asked for auto scaling providers for models and worker nodes, with AWS-style rules, all auditable and agent-native. This PR is the core plus the first provider. Design:
/mnt/project-files/autoscaling/design.mdin the project.Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md. (n/a: the title and docs/scaling.md say it)Done questions (AGENTS.md)
/api/v1/scaling, MCP toolsscaling,propose_scaling_group,change_scaling_group,set_scaling_desired,pause_scaling_group,terminate_scaling_unit, and the same in the assistant's server tools.scale_group:<id>), and theallbudget stops groups too.docs/scaling.md, README, requirements, budgets and the threat model are updated. The OpenAPI client was regenerated withmake openapi.docs/scaling.md.Local checks: the full backend suite passed (1649 passed, 23 skipped), along with ruff, mypy,
mkdocs build --strict,check_requirements,validate_threat_modeland jest for the new section.ci/local-ci.sh --prfollows on this PR.Generated by Claude Code