Skip to content

codeSplitters: cost caps still missing in code (hosted agents, site-wide container budget, unruled Artifacts writes) #797

Closed

Description

@QuinnsCode

Found while surveying what can run up a bill (#796 fixed the worst one: MCP tool calls skipped every rate limit). These gaps remain in code:

  1. Hosted agent runs have no hard cap (admin-only).

    • HOSTED_RUN_MS (15 minutes, src/agent-routes.ts:82) is only shown as a deadline (:101). Nothing stops a run when it passes.
    • A run can call the CLI up to 8 times: 1 run, 2 conflict retries (src/agent-run.ts:130) and 5 note runs (NOTE_RUNS, agent-run.ts:82). Each call can last up to AGENT_TIMEOUT_MS, 10 minutes (sandbox/server.mjs:33), so about 80 container-minutes plus API spend.
    • The agent rule (20 a day) never fires, because only admins can start runs and admins are exempt (src/limits.ts).
    • Possible fix: enforce HOSTED_RUN_MS across the whole run, and add a daily per-site count of hosted runs that applies to admins too.
  2. Container checks have no daily or site-wide budget. The checks rule is 30 an hour per owner, and anyone can sign up and own repos. maxInstances: 2 bounds the worst case at about $41 a month (REFERENCE.md "Checks in a container"), but many accounts can keep both containers busy all the time. Possible fix: a site-wide daily cap on container minutes in CiRunner.alarm (src/ci-runner.ts), falling back to "run it on the desktop" the way the per-owner charge does.

  3. Unruled writes to Artifacts. ruleFor (src/limits.ts) doesn't cover these:

    • branch create and merge (a merge pushes to git)
    • fresh starts (src/fresh.ts)
    • webhook creation

    Repos made with create_repo and level forks never expire. Only the repo rule (10 a day per user) limits how many there are.

  4. The scheduled dependency doctor: every_hours is set by the user, and the number of watched repos per user is uncapped. Each tick does registry lookups for every watched repo (src/deps.ts, bounded by a 12-minute budget per cron tick).

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions