Skip to content

v2.0.0 — Per-Caller State, Safer Credentials & Account Deletion

Latest

Choose a tag to compare

@Tarcroi Tarcroi released this 18 Nov 00:11

Highlights

  • Agent state is private to each caller, and it expires. An agent with state: { type: kv } now keeps one notebook per caller by default (scope: per_caller; scope: shared keeps the old behaviour), and state.ttl finally applies: a notebook expires ttl after its last write. What one client stored is no longer replayed into the next client's prompt.
  • Refused before it costs anything. A push whose bundle no run could load, whose agent.yaml declares a setting no code honours, or that is too large or too complex to read is refused before anything is stored. A run nobody holds a model key for is refused before it starts — each refusal with its own error code and a message saying what to do.
  • Credentials, hardened end to end. API keys take a scanner-recognisable format (skrun_sk_…), reading runs, stats, files or an agent's source takes a full-access credential, the sign-in cookies are host-locked, the CLI keeps one session per server and never sends a token elsewhere, neither the CLI nor the SDK follows a redirect, outbound requests refuse every reserved address range, redirects are held to an agent's allowed_hosts, and log lines no longer carry error messages, model output or full URLs.
  • Accounts can be deleted. DELETE /api/account deletes an account with its keys, sessions, agents, bundles, attached model keys and notebooks — its runs stay, their content cleared; DELETE /api/admin/accounts/:id lets an administrator do the same. An optional deletion journal (SKRUN_DELETION_JOURNAL) records deletions and key revocations so they can be done again on a database restored from an earlier copy.
  • Per-account limits, off until the operator sets them. Runs in progress, compute seconds per window, bundle storage and live uploads, an instance-wide capacity, and per-account plans an administrator assigns (PUT /api/admin/accounts/:id/plan). Each account reads its own consumption with GET /api/usage, client.usage() in the SDK, or the dashboard's usage strip.
  • A sturdier Fly.io runtime (SKRUN_RUNTIME=flyio). Every machine carries a label and a lifetime, a creation whose outcome is unknown is looked for instead of sent again, runner machines destroy themselves when they stop, the run stream beats while a machine is prepared, and the server ends its runs in flight cleanly on SIGTERM.

Breaking

This is a major release: the full list, with every error code, is in the CHANGELOG. What you must do:

  • If you self-host: upgrading deletes every agent's state (export agent_state first if you need it), and every instance on one Postgres database must be upgraded together. The Docker Compose stack reads infra/.env (Docker Compose ≥ 2.24). @skrun-dev/runtime, @skrun-dev/api and @skrun-dev/cli need Node ≥ 22.19. On Postgres, a statement stops after 10 s by default (SKRUN_DB_STATEMENT_TIMEOUT_MS); the server refuses to start on a malformed SKRUN_DB_STATEMENT_TIMEOUT_MS, SKRUN_DELETION_JOURNAL, SKRUN_PRIMARY_FAILOVER_MS or BUNDLE_MAX_DECOMPRESSED_MB. In production, the session cookie is now __Host-skrun_session: users sign in once more. Log events carry error_name / error_code / error_status instead of error: queries and alerts reading error stop matching.
  • If you run on Fly.io (SKRUN_RUNTIME=flyio): flyctl machine stop or restart on a runner machine now destroys it; skrun admin cleanup-machines has no default age — a schedule that relied on one must pass --older-than; a synchronous POST /run is refused 400 SYNC_MODE_UNSUPPORTED — use the event stream or a webhook_url; an allowed_hosts entry the sandbox cannot enforce (a pattern, a port, a path) is refused 400 EGRESS_HOST_UNSUPPORTED.
  • If you write agents: state.type defaults to none — an agent that relied on the old kv default must declare it; state.scope needs a 2.0.0 server. Validation and push refuse by name the settings no code honours (an MCP auth other than none, a non-empty environment.secrets, a meta model without model.base_url, a timeout out of range), YAML aliases, !!omap, a %YAML version other than 1.2, and an agent.yaml over 128 KB. environment.sandbox and environment.filesystem are retired. A fallback now takes over only before any tool has run.
  • If you call the API, the CLI or the SDK: API keys minted before this release are refused — mint replacements after the upgrade, then revoke the old ones; run skrun login --registry <url> again (the CLI's sign-in file changed). A reduced key reads only what it launched or uploaded. The body of POST /run must carry input; a missing input is 400 MISSING_INPUT (REQUIRED_INPUT_MISSING is retired); a run nobody holds a model key for is 400 LLM_KEY_REQUIRED.
  • If you embed @skrun-dev/api or write an adapter: DbAdapter and StorageAdapter gain and change methods (state, account deletion, run admission and final writes); the CHANGELOG lists each.

Migration

  1. Before upgrading, if you need the agents' state: SELECT * FROM agent_state.
  2. Stop every instance that shares the database, then upgrade them together; the migrations apply at boot.
  3. Docker Compose: move your file to infra/.env (keep POSTGRES_PASSWORD and the storage keys as they are), then docker compose -f infra/docker-compose.yml up -d. See Self-hosting with Docker.
  4. After upgrading, each account mints new API keys and revokes the old ones; everyone runs skrun login --registry <url>.
  5. Agents that kept state without declaring it: add state: { type: kv } and publish a new version.

Stats

  • 7108 unit + integration tests pass (was 1973 at v1.2.1)
  • 346 E2E in-memory (was 144), plus the live multi-provider suite
  • OpenAPI 3.1 spec at 2.0.0

Install

npx @skrun-dev/cli@2.0.0 --version
# or
npm i -g @skrun-dev/cli@2.0.0

Full changelog: CHANGELOG.md