Commit Graph
55 Commits
Author SHA1 Message Date
aiongg c9ebc603a4 rust-stable toolchain image adds the wasm32-unknown-unknown target that pipeline repos' toolchain files list; offline build pods cannot install it 2026-11-23 01:09:53 +00:00
aiongg 7cdc397e9e Workspaces of repos with a warm target work at the CI paths and start from their node's warm version: layout 2 (checkout at the runner path, CARGO_HOME /cache/cargo, gate env and checkouts), node choice from warm status, warm-copy before the workspace (Cargo.lock check for pvc), volume sized for the target to grow, checkout mtimes from the files changed since the warm commit, warm note on the item page 2026-11-23 00:57:03 +00:00
aiongg b04dcdea44 Workspace helper: call timings from the monotonic uptime clock
date +%s%3N can step back by up to a second (the seconds and nanoseconds are read separately), which made exit durations negative.
2026-11-22 20:29:23 +00:00
aiongg 741ed4b58b Workspace fixes: shell keeps the image PATH, deterministic base commit, call file pruning, sweep of calls stuck running 2026-11-22 16:39:00 +00:00
aiongg c623b7acfa Merge runner-ha: leader election for the runner and the periodic chores
# Conflicts:
#	src/build/workspace-session.ts
#	src/runner/runner.ts
2026-11-22 16:07:20 +00:00
aiongg d41ee02774 Merge ws-resume: workspace sessions survive parking, restarts and node loss
# Conflicts:
#	src/build/workspace-tools.ts
2026-11-22 15:21:20 +00:00
aiongg 91b5bf763d Workspace resume never loses a kept volume's work
- The row records whether the volume was made empty for the current start
  (volume_fresh). A kept volume is only checked for its base commit, never seeded
  or wiped; a kept volume that is gone or being deleted is replaced by a fresh one
  before the pod is made.
- A resume that cannot start or seed (pull failure, pending or seed limits, pod
  gone, create tries, a kept volume without its base commit) goes back to parked
  with its kept volume and checkpoint, up to 3 tries (resume_tries); after that it
  stays parked with the reason in its error and is not resumed again.
- A kept volume is dropped only when its node is gone: the node is missing or not
  ready for 5 min, or, when nodes cannot be read, every node refused the pod for the
  volume's node affinity. Never while the last checkpoint failed.
- A failed checkpoint is recorded (checkpoint_error); while set, the parked volume
  is kept past its keep time. The keep-time deletion lets go of the volume on the
  row before deleting it.
- The lease's resume note keeps the queued stdin (remote_calls.base_stdin) and says
  what the last resume did: kept tree, rebuilt from the checkpoint of hh:mm, or
  rebuilt with no checkpoint.
- `ws init` removes a stale git index lock.
2026-11-22 15:20:08 +00:00
aiongg 0a28438d8e ws app helper: env reaches only the app, display errors reach the job
The session's env goes to the app through env(1), so no value can stop the
wrapper recording the pid and exit code. An app with no pid 5 s after its start
no longer counts as running, and app-stop records one as ended. ensure_display
no longer has its error header redirected. A handed-back app-start skips the
argument checks and waits for the app it started. The Xvfb pid is checked to
be Xvfb before it is waited on or killed; pids must be above 1. Map State is
matched on its own line, and a window a running app's .win names is never
taken by another app.
2026-11-22 15:17:50 +00:00
aiongg 8a688a2260 Leader election for the runner and the periodic chores on Postgres
Two copies of the runner or of the periodic chores can run on one Postgres database: the copy that holds the
role's session-level advisory lock leads, the other waits as a standby and takes over when the leader's
session ends. A new leader moves the role's epoch and fences its writes, and those of its jobs, to it: every
write transaction checks the epoch after the writer lock, so writes of a leader that lost its lock fail. The
old leader kills its jobs and exits when its lock connection fails or a check of the lock fails. A standby
runner answers /readyz with 503; /healthz/checks gains runner-leader and periodic-leader. The periodic loop
moves to deploy/periodic.sh, run by autocraft-server periodic.
2026-11-22 15:12:23 +00:00
aiongg a1e9888d5e Workspaces survive parking, restarts and Task Runner loss
- The launcher keeps a workspace's pod while a background command the session has
  not seen end may still run, and counts idle time from the end of a lease.
- A parked workspace comes back when its bound call is queued or leased, or when a
  session's tool call or a try session asks for it: a new pod on the kept volume,
  or a new volume rebuilt from the base and the stored checkpoint (git apply).
  Session tool calls wait for the workspace to be ready.
- A resume onto a volume whose node takes no pod within 3 min drops the volume and
  rebuilds. Resumed pods and rebuilt volumes get their own names, so an old pod still
  shutting down on a lost node never blocks them; the exec check ignores such pods.
- `ws init` marks calls an earlier pod on the volume left without an exit as killed.
- Try sessions get two attempts. A lease after an earlier lease of the same call
  worked in the workspace adds a note to the prompt with the checkpoint's diff stat;
  the launcher checkpoints a workspace whose bound call went back to the queue.
2026-11-22 15:05:11 +00:00
aiongg 68d063fdbb Workspace app tools: app_start, app_stop and screenshot on the pod's Xvfb display
The ws helper gains app-start (restarts Xvfb if it died, at most 4 apps, lavapipe
env, waits up to 30 s for the window found by _NET_WM_PID or as a new unclaimed
window; a call number already started is waited on, not started again),
app-stop (SIGTERM, SIGKILL after 5 s) and shot (root capture cropped to the
window and region, full size kept in .ws/shots, scaled like read's images).
The tool table gains array, env and rect fields. Sessions drive apps through
their own CLI with shell.
2026-11-22 15:03:47 +00:00
aiongg f3c97f6843 Workspace tools: put keeps modes and writes through links, shell time by the job's clock, image caps, restart and race fixes 2026-11-22 13:21:05 +00:00
aiongg 688aa4fd02 Workspace tools: shell, shell_status, shell_kill, read, write, edit, glob and grep run in the pod through ws, with per-session limits kept in the call rows 2026-11-22 13:08:34 +00:00
aiongg 604307d4f9 Build pods read the CI runners' compile cache (sccache, read-only)
Offline steps that mount the build dirs run rustc through sccache against the
read-only WebDAV endpoint set with --sccache-url, when the repo has a CI gate.
sccache keys a compile on the compiler, its own release, the arguments, every
CARGO_* variable and the working directory, so a cached step matches the gate's
job: the CI checkout path with its default target dir, CARGO_HOME, the gate's
job env (CARGO_TERM_COLOR given to rustc only), dev-strip, and the store
sccache/<cache-version>. The pod carries craft.build/cache=read; the step ends
with sccache --show-stats. The rust-stable image pins Rust 1.100.0 and installs
the checksum-verified sccache 0.18.0 release.
2026-11-22 07:09:33 +00:00
aiongg 55af69e232 Merge ws-helper: workspace pods in-pod helper ws 2026-11-22 03:54:14 +00:00
aiongg 27c8914310 Toolchain image: Xvfb, Mesa software rendering, ImageMagick, ripgrep and fallback fonts for workspace pods 2026-11-22 03:54:14 +00:00
aiongg f738259d45 ws: a 124 or 137 exit counts as timed out only when the run lasted its whole limit 2026-11-22 03:52:19 +00:00
aiongg 37facfbdb2 Add the in-pod workspace helper ws 2026-11-22 03:49:16 +00:00
aiongg 776d59c758 Run every process on AUTOCRAFT_DB_URL: the dashboard, runner, worker threads and job processes open dbTarget() (job processes get dbEnv(), only the variable that names the database); the GitHub identity read uses the process handle in read transactions on Postgres; AUTOCRAFT_DATA_DIR (default: the SQLite file's directory; the image sets /data) holds reference documents, artifacts and the item snapshot; lock files are named by dbLockName(); the item snapshot, backup.sh, the predeploy snapshot and the periodic loops say that Postgres has no SQLite snapshot instead of succeeding; db.attempt(fn) runs fn under a savepoint on Postgres so a caught statement error leaves the write usable 2026-11-21 18:08:33 +00:00
aiongg 930e7e3415 Build pods: dashboard kind label and pod details, rust-stable toolchain Containerfile, operations docs, AUTOCRAFT_IMAGE in the example manifest 2026-11-21 16:13:04 +00:00
Dylan M. Taylor 87a8dd7bb9 Pin workflow, base images, and k8s manifest; harden runner securityContext 2026-11-20 23:16:03 -05:00
aiongg c77b23a302 Rename the server admin CLI to autocraft-server; document the MCP Connector, Task Runner login, long-polling claims, model call queue and Manual only 2026-11-20 02:17:48 +00:00
aiongg 0bc5e463fc Backups copy with VACUUM INTO, which never restarts under concurrent writes 2026-11-19 21:33:39 +00:00
aiongg 80f9ba8f4c Each deploy installs the post-receive hook its commit carries 2026-11-15 02:26:30 +00:00
aiongg f5bdb64c5e Runner hardening: per-repository installation tokens, a github.com-only credential helper, an allow-listed jev environment, pinned git attribute source and explicit repositories, absolute deny rules, a wider output scrub, and a deploy of the pushed commit
- Installation tokens for a write are minted for the write's repository (a transfer's also for its target); reads across repos and pushes to a contributor's fork keep the installation-wide token. Reading the app's keys checks the secrets file's mode like every other reader.
- The app's git credential helper is set for https://github.com only, after every configured helper is dropped.
- jev children get only the search path, home, locale, temp, cache, TLS and proxy variables and Jev's own.
- Git on the cached clones names the repository with GIT_DIR, runs with safe.bareRepository=explicit and reads attributes from the empty tree.
- The sandbox denies /proc and the credential directory in the absolute (//path) form as well.
- The scrub hides hex keys that are not digests, URL user:password, three-part dotted tokens and credentials inside hex or base64.
- The dashboard unit sees the settings file, releases, the bare repo and .local read-only.
- post-receive resolves the pushed commit once and the hook deploys that commit; the image build runs pnpm installs without install scripts.
2026-11-14 23:23:21 +00:00
aiongg f9ca82f460 Bind author logins to account ids for existing history, route the remaining views through the visible-repo allow-list, and tighten link, path and reply parsing 2026-11-11 13:18:40 +00:00
aiongg 3ceb8f0504 Worker hardening: artifact uploads re-check the task after the body, plain-http coordinators must not be single-label, warm keys are one-to-one, pinned worker SSH host keys, formatter refuses symlinked paths, deploy skips install scripts 2026-11-11 12:52:31 +00:00
aiongg f9c7520b0e Nightly, part B: toolchain image Containerfiles, nightly API and live topic, Nightly report page with grid, benchmark sparklines and selection 2026-11-09 14:45:37 +00:00
aiongg 72b1a4edfa One instance-wide GitHub identity (box account or GitHub App) replaces the per-repo identity and the login-app variable; app keys are read again when the keys file changes 2026-11-08 20:56:53 +00:00
aiongg 186676a708 Container image: add the shell and core utilities the scripts and spawned programs need; /data owned by the app user; stricter rootfs self-test 2026-11-08 00:45:01 +00:00
aiongg 0b155846f7 Merge GitHub main: hardened container image and image publishing 2026-11-08 00:33:13 +00:00
aiongg 4aef9eac62 Backup schedule from the newest snapshot, job log carry-over, local environments disabled at cut-over, account directories by id, disk sizing and runner hardening 2026-11-08 00:29:59 +00:00
aiongg 554398d7b6 Add a Docker Compose stack and a VPS runbook; list the files and settings a systemd install keeps 2026-11-08 00:19:12 +00:00
Dylan M. Taylor c7912fe402 Drop volatile paths before the rootfs is copied into the runtime base
Debian's /var/lock is a symlink, which cannot overwrite the runtime image's
directory during COPY, and apt state has no business in the production layer.
2026-11-07 15:52:09 -05:00
Dylan M. Taylor 73211a2725 Provide gzip for the GitHub CLI archive and /dev/null for the chroot check
The dev image ships neither, so the extraction failed and git's self-test could
not open /dev/null.
2026-11-07 15:49:22 -05:00
Dylan M. Taylor e37245fc0b Install curl for the GitHub CLI fetch and verify the unpacked tool tree
The dev image has no curl, and the dependency closure was lost to apt-cache's
indented output. Flatten it, download every package, and chroot the result so a
missing library fails the build instead of the container.
2026-11-07 15:46:30 -05:00
Dylan M. Taylor b4313ae395 Build on Docker Hardened Images with a runtime-only production stage
The dev variant of dhi.io/node:26 supplies bash, apt and npm in the build stages;
the production stage is the runtime variant, which has no shell, so the packages
the process needs are unpacked into a rootfs by a tools stage and copied in as
files. Whatever the image runs is now Node plus those exact binaries.
2026-11-07 15:40:04 -05:00
Dylan M. Taylor 777ee88844 Build on a Docker Hardened Image for Node 24
The dev variant is deliberate: the image needs bash for its entrypoint and apt to
install git, gh, bubblewrap and sqlite3 for the pipeline, which the runtime
variant does not carry. CI now logs in to dhi.io to pull the base.
2026-11-07 15:37:35 -05:00
aiongg 820f3b2c57 Fix migration and deployment docs after review 2026-11-05 17:38:02 +00:00
aiongg 53eb8c5ab5 Add build-push script for the container image 2026-11-05 17:16:44 +00:00
aiongg 52f726cfb8 Container review fixes: stale lock of a reused pid, gh in the image, source commit, stop handling; Kubernetes manifest 2026-11-05 15:44:50 +00:00
aiongg 5bc99fb813 Container image for the dashboard and runner; health endpoints, bounded runner stop, container docs 2026-11-05 15:30:53 +00:00
aiongg 36ba1a87bc Deploy restarts the runner only when its code changed; the runner's release is kept while it runs 2026-11-04 18:39:55 +00:00
aiongg 4dd4d93800 Rename remaining craft-auto names to autocraft (command, env vars, paths, key label) 2026-11-03 16:48:10 +00:00
aiongg 096b295d15 Defer sandbox worker updates until its tasks finish 2026-11-03 05:12:37 +00:00
aiongg 58f20bddaa Deploy hook: a redeploy of the live commit reuses its release; pruning with no old releases succeeds; warn when a sync run outlasts the wait 2026-11-03 03:11:41 +00:00
aiongg 8fd8fd4988 Merge branch 'prod-deploy' into claude-accounts 2026-11-03 03:04:20 +00:00
aiongg 9925092fba Claude accounts page: add, sign in with a code, status, usage without tokens, sign out 2026-11-03 03:03:04 +00:00
aiongg 16e1356e8a Deploy into releases with an atomic symlink switch; snapshot and pause sync first; units load the settings as the app user; checks after restart; commit from .source-commit; pin pnpm 2026-11-03 03:01:39 +00:00
aiongg ba4677d406 Runner unit: drop NoNewPrivileges so bwrap can create user namespaces 2026-11-03 02:51:00 +00:00