Skip to content

feat: mint Vault child tokens, resolve host credential paths, run prepare steps and host suites - #8

Merged
seamusabshere merged 4 commits into
mainfrom
seamus/zero-ceremony-test-runs
Nov 16, 2026
Merged

seamusabshere merged 4 commits into
mainfrom
seamus/zero-ceremony-test-runs

Conversation

@seamusabshere

@seamusabshere seamusabshere commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Background

aviary gives each git worktree its own Docker Compose project, volumes, and host ports. In repositories like fdy, running a stack or test suite still required per-shell setup outside aviary: minting and exporting a VAULT_TOKEN in every shell, exporting a host path to Google Application Default Credentials, copying gitignored OpenAPI/codegen artifacts in fresh worktrees, re-seeding the database from scratch for minutes in every new worktree, and translating repo-root file paths to package-relative paths by hand.

Problem

  1. Coding agents run every tool call in a fresh non-interactive shell, so environment exports vanish between commands and inherited VAULT_TOKEN values go stale.
  2. Fresh worktrees fail during init or test when gitignored build artifacts have not been copied yet, and pay minutes re-seeding Postgres even when another worktree already seeded the same data.
  3. Services whose tests run on the host against an isolated container database (pnpm / uv with per-worktree ports) could not be defined as aviary test suites, and repo-relative test paths (aviary test model_train-file -- workers/model_train/tests/foo.py) failed because the runner's working directory is the subpackage.
  4. docker compose health-wait spinners flood non-TTY agent logs (Second cold walkthrough of fdy under aviary: image pull gaps, noisy run output, TOKEN_FILE undefined #7), compose pull fails non-interactively on gcloud reauth (Cold walkthrough of fdy under aviary: doc gaps and friction (colima, Rosetta check, image pull, OOM) #6, Second cold walkthrough of fdy under aviary: image pull gaps, noisy run output, TOKEN_FILE undefined #7), and Apple silicon laptops without Rosetta or with low VM memory run linux/amd64 containers 4-6x slower without warning.

Abstract Solution

Add native zero-ceremony primitives to aviary.yml and the CLI so aviary test <suite> works from a cold shell with zero environment exports:

  • vault (internal/vault): checks an ambient VAULT_TOKEN via lookup-self; when unset or expired alongside a ~/.vault-token, mints a non-renewable child token, caches it under $XDG_STATE_HOME/aviary/vault-token.json (0600, flock-locked, fsynced), and reuses it across worktrees and shells until less than half of ttl remains.
  • host_env and prepare (internal/config, internal/stack): fills unset host variables from ~/-expanded host paths (failing early with hint when required: true and missing), and runs prepare commands once under the stack lock before up, init, run, and suites (unless prepare: false).
  • Host suites and workdir path normalization (internal/config, internal/stack): runs host: true suites directly on the host in workdir with ${AVIARY_PORT_*} expanded in suite.env, and strips workdir prefixes from path arguments for both host and container suites while preserving :line and ::test selectors.
  • Volume snapshots (internal/snapshot, internal/stack): caches seeded volumes under $XDG_CACHE_HOME/aviary/snapshots keyed by volume names, mounting images, init steps, and key_files, stamped by stamp_files. Restores exact matches directly, or restores a prior stamp and runs after_restore before saving the updated snapshot.
  • Docker Desktop diagnostics (internal/dockerdesktop): warns once on Apple silicon when linux/amd64 compose services run without Apple Virtualization framework + Rosetta or with < 8192 MiB VM memory.
  • aviary pull and quiet non-TTY progress: pulls across --profile * using CLOUDSDK_AUTH_ACCESS_TOKEN from Google ADC when available, and sets COMPOSE_PROGRESS=quiet when stderr is not a terminal.

seamusabshere and others added 4 commits November 16, 2026 12:44
…d host suites

Co-authored-by: Cursor <cursoragent@cursor.com>
…lock

- Use a cached child token by its recorded expiry without asking Vault, and
  reuse it until half of the lease Vault granted has passed, so a login near
  its end no longer mints a token on every command.
- Pass VAULT_TOKEN through unchecked when there is no ~/.vault-token to fall
  back to; warn when Vault grants less than vault.ttl.
- Name the shared child token "aviary" and say plainly that it carries every
  policy of the parent login.
- Run prepare steps at most once per command and under the stack lock, so
  `aviary test` no longer prepares twice and parallel commands never race.
- Pass container suite env through compose's environment with `--env KEY`,
  keeping values out of the process list; `$$` is a literal `$`, and env
  values no longer depend on map order.
- `aviary pull` only runs gcloud when an ADC file exists.
- README and `aviary test --help` cover pull, prepare, host suites and Vault.

Co-authored-by: Cursor <cursoragent@cursor.com>
A first init can sit for several minutes with no output, which looks like a hang.

Co-authored-by: Cursor <cursoragent@cursor.com>
…top warnings

Co-authored-by: Cursor <cursoragent@cursor.com>
@seamusabshere
seamusabshere merged commit 106454a into main Nov 16, 2026
4 checks passed
@seamusabshere
seamusabshere deleted the seamus/zero-ceremony-test-runs branch November 16, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant