Commit Graph
11 Commits
Author SHA1 Message Date
aiongg 0a39282973 GitHub App keys live in the database, sealed; a secrets file's app keys are imported once
Registration stores the app's keys in the github_app table, sealed with the
token box derived from session_key, so dashboard replicas and the runner read
the same keys without a shared filesystem, and the secrets file can be a
read-only mount. A secrets file that still holds github_app_* keys is imported
while no row exists; a removed app keeps its row (keys null) so the file does
not bring it back. Processes reread the row at most every 10 seconds.
2026-11-22 15:01:32 +00:00
aiongg 14ae2ee719 Workspace try: an operator's end-to-end test session in a workspace pod
- Table workspace_sessions (kind, repo, base, item, prompt, environment, keep, time limit, state, outcome, workspace,
  remote call, job), general enough for later implementation sessions; kind 'try' for now.
- `autocraft-server workspace try <repo> <sha> --item N --prompt TEXT [--workspace ID] [--env ID] [--keep]
  [--deadline-sec N]` records the session and queues a workspace-try job with {repo, session}; the prompt stays out of
  job params and logs.
- Step workspace-try (Fix stage, no lane, so the planner never queues it; 160 min): creates or takes the workspace,
  waits for it to be ready (registered as the external wait "Workspace start"), queues the bound call with the fix-issue
  patch prompt's model, effort and tier and only the workspace tools, awaits it, then logs the outcome and cost, tool
  calls and shell time from workspace_calls, and the diff stat against the base commit with new files. The workspace
  is ended unless kept.
- The job's own diff-stat exec is recorded as tool `report` and does not count toward the session's limits.
2026-11-22 13:39:41 +00:00
aiongg 0ca6b27ef8 Workspace relay: a session's workspace tool calls go from the dashboard to the job that owns the workspace
- workspaces.remote_call_id binds a workspace to the remote call whose session uses it; workspace_calls.run_id records
  the lease run a relayed call came from.
- Dashboard: the workspace server on /mcp/task/workspace and the tool route queues each call as a workspace_calls row
  with its arguments whole and waits for the row's result with keep-alive ticks; a call still queued when the lease ends
  is refused. Workspace tool bodies may be up to 12 MiB.
- Job: awaitCall serves the workspace bound to its call, runs claimed rows side by side on the job's WorkspaceSession
  (which settles each row), hands rows still running after a restart back to the session, and refuses queued rows when
  the call ends.
- Wake: Db.notify and Db.listen, Postgres NOTIFY on one listening connection per handle that reconnects; the relay polls
  every 10 s behind it, and at the model queue's interval on SQLite.
- Tool replies carry image content after the text: protocol 5 (3 and 4 still accepted); Task Runner 1.3.6 falls back
  through 4 and 3 and prints a line for images in autocraft tool.
- queueWorkspaceCall queues a session call with the workspace server and binds the workspace in one transaction.
2026-11-22 13:12:46 +00:00
aiongg 0a236e4b94 Workspace pods: review fixes
- A running call within its time limit (plus 30 s) keeps a workspace from parking; calls record their deadline and
  touch last_call_at when they start as well as when they finish.
- Checkpoints use a copy of the index (GIT_INDEX_FILE), never the session's index or its lock.
- The checkpoint is read only where it is needed; a parked workspace whose volume is gone ends 24 h after parking.
- A failed pod create keeps the workspace starting with its pod and volume names, so the sweep leaves them; creates are
  tried again on later passes up to CREATE_TRIES, and a 409 for a pod still being deleted waits for it to go.
- The lavapipe ICD file follows the environment's architecture.
- Call arguments are cut before they are encoded, so the stored JSON is always whole.
2026-11-22 04:21:33 +00:00
aiongg 1f2f2768da Workspace pods: records, pod and volume specs, and their lifecycle in the launcher
- Tables workspaces and workspace_calls (SQLite and the generated Postgres schema).
- src/build/workspace-pods.ts: the PVC ws-<id> and pod ws-<id>, labelled autocraft-workspace and network none;
  restricted Pod Security, no service-account token, the helper copied from the AutoCraft image by an init container,
  required anti-affinity against the AutoCraft pods, priority class craft-workspace, resources from the environment's
  workspace settings.
- src/build/workspace-launch.ts: a workspace pass after the build-task pass. requested -> starting -> seeding ->
  ready, with git archive of the base commit from AutoCraft's clone streamed into ws untar; parked after 30 min
  without a call (checkpoint, pod deleted, volume kept for 1 h); checkpoints every 10 min while ready; failures delete
  pod and volume; an orphan sweep of workspace pods and volumes no live row owns.
- src/build/workspaces.ts: execWs checks the pod against its workspace label, takes the call number from the row,
  records the call and returns the parsed helper header with cleaned output.
- KubeApi.exec takes a stream as stdin.
- CLI: autocraft-server workspace start | list | show | run | end, and the workspace settings on envs add/set.
2026-11-22 04:09:18 +00:00
aiongg 8d18f4915b Postgres schema: NOCASE text columns are citext COLLATE "C", so they compare, sort and give min and max as SQLite NOCASE does (ASCII folded, then by code point) 2026-11-22 01:00:39 +00:00
aiongg 8794761830 Merge main: restart without draining, resumable jobs and once-per-job creating writes; the runner tests read audit details as JSON in the test, so they run on Postgres too 2026-11-21 21:38:38 +00:00
aiongg 17d666ebde Merge pg-e5: planner and runner SQL portable to both dialects
# Conflicts:
#	src/classify/settled.ts
#	src/schema.pg.sql
2026-11-21 19:39:09 +00:00
aiongg de266e97cd item_settled is a real table per classification run: triggers on classifications mark changed items, settledTable builds a run once and then works out only the marked items under one write, before the caller's read; the per-connection temp tables are gone 2026-11-21 19:15:50 +00:00
aiongg d0ad1cf17d Postgres decision_items trigger: CASE guard so the JSON cast never sees invalid text 2026-11-21 18:44:04 +00:00
aiongg 7e268b01ba Postgres schema: src/db/pg-schema.ts translates schema.sql and the added columns and indexes into src/schema.pg.sql with a strict allowlist (bigint identity keys, identity rowid on rowid tables, text COLLATE "C", citext for NOCASE, tsvector columns with GIN for FTS5, hand-written plpgsql triggers pinned to their SQLite text, compat functions instr/julianday/json_valid/group_concat); pnpm check fails when the file is stale; applyPgSchema runs it under pg_advisory_xact_lock; scripts/pg-schema-compare.ts lists the differences from the SQLite schema 2026-11-21 17:57:16 +00:00