Skip to content

ci: run one fake-claude session through cargo xtask dev - #86

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/42-can-you-look-into-if-https-github-com-hy
Oct 18, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/42-can-you-look-into-if-https-github-com-hy

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

CI never started the local stack, so cargo xtask dev broke twice for people starting fresh without CI noticing (#34, #41). Nothing else in CI runs the control plane either. cargo xtask check compiles and lints it for wasm, crates/fctl-control has no tests, and the deploy job is the first to apply the migrations (to the production D1) and start the Worker.

This adds cargo xtask dev --smoke and a CI job that runs it from a fresh checkout.

cargo xtask dev --smoke

It does everything cargo xtask dev does: installs the Node packages and worker-build when they are missing, builds, applies the migrations to the local D1, starts wrangler, bootstraps the owner, credential, runner and Playground project, then starts Vite and the host. Then it:

  • checks that Vite serves the API through its proxy (localhost:5173/api/v1/health);
  • runs fctl --json run --project playground --detach "write notes.md" with the CLI it built;
  • follows the session's events until the agent's turn ends with a successful result and a commit on the branch (60 s);
  • stops the session through the API and waits for stopped (60 s);
  • exits 0.

It fails when a child exits, an API call fails, the session fails or a wait times out, and then prints the session's transcript (fctl logs). It reads the event log, not GET /sessions/{id}, because the session row in D1 is written at most every 5 s.

CI

A new dev job, "cargo xtask dev --smoke", runs next to check on every pull request and push to main, with its own rust-cache. It skips npm ci, so cargo xtask dev installs everything as it would on a new machine. deploy now needs both jobs: a stack that can't run a session doesn't reach app.fctl.sh.

Stopping the stack

On failure (and now when --smoke ends), cargo xtask dev killed its children with SIGKILL. That only killed wrangler's launcher: wrangler and workerd kept serving on 8787, and the next run's health check passed against the old Worker. Children now get SIGINT first, as with Ctrl-C, and SIGKILL after 10 s.

Vite now starts directly (node_modules/.bin/vite in web/) instead of through npm run dev. npm ignores SIGINT, and SIGTERM stops npm but leaves Vite serving on 5173. The health wait now also fails as soon as wrangler exits, instead of after 300 s.

One process can still outlive --smoke locally: the stopped session's idle fctl-agent. The host stops a sandbox about 6 s after the session reports stopped, and --smoke stops the host before that. Plain cargo xtask dev leaves sessions running on Ctrl-C too ("sessions keep running in their sandboxes"), and in CI the runner removes it.

What it costs

Measured on this pull request's runs, on GitHub's 2-core runners:

  • With its cache: 1m57s (run 39153623020). That is 33 s of setup and 78 s for cargo xtask dev --smoke: 13 s to build xtask, 11 s for npm ci, 20 s for the binaries, 27 s for the migrations, the wasm build and wrangler's start, and 2 s for the session itself. In the same run, cargo xtask check took 2m16s, so a pull request waits no longer.
  • Without a cache: 8m16s (run 39152872985), 4m18s of it compiling worker-build. This happens on the first run on main after the merge, and again when Cargo.lock or the toolchain changes. Its cache is 424 MB. The repository's Actions cache is already at 10.49 GB of its 10 GB, so GitHub evicts the least recently used entries.

Billed per job and rounded up, that's 2 minutes per run. Today CI ran 103 times (58 pull request runs, 41 pushes to main, 4 dispatches), for about 351 runner-minutes, about 451 once rounded up. At today's pace this adds about 200 billed minutes a day, roughly 45% more. The repository is private, so those minutes are billed.

Running it as a step after cargo xtask check instead, in the same job, would save the setup, npm ci and the xtask build: about 1 billed minute a run instead of 2. But each pull request would wait about a minute longer, and the check cache key would need a bump to keep worker-build. This is a separate job because waiting matters too: agents wait for CI in the same turn.

Verification

  • On main (d3ae832), a fresh clone with no build cache: cargo xtask dev reached "fctl dev is running" in 166 s, 74 s of it compiling worker-build. fctl run -p playground "write notes.md" then went to idle with a commit in about 2 s. Nothing is broken today.
  • cargo xtask dev --smoke from a fresh state (no node_modules, web/dist, .fctl-dev or .wrangler), with cached dependencies and 2 build jobs: passed in 41 s, with ports 8787 and 5173 free afterwards.
  • With cargo xtask dev can't add its Claude credential on a fresh state #34's bug put back (the credential posted to /me/claude): exit 1 after 10 s with adding a Claude credential: HTTP 404: {"code":"not_found","message":"Endpoint not found"}, and nothing left on 8787.
  • With the prompt changed to fake-claude's crash: exit 1, "the session didn't finish its turn with a commit", and the transcript.
  • cargo xtask check passes.

Fixes #53

Session: https://app.fctl.sh/s/ses_01M58136GJ7HPPRNVW2YR21TX0

fctl-sh Bot added 2 commits October 18, 2026 18:09
CI never started the local stack, so cargo xtask dev broke twice for
people starting fresh without CI noticing (#34, #41). Nothing else in CI
runs the control plane either: the deploy job is the first to apply the
migrations and start the Worker.

cargo xtask dev --smoke starts the stack as cargo xtask dev does, runs
`fctl run -p playground "write notes.md"`, follows the session's events
until the agent has committed and finished its turn, stops the session,
and exits. A new CI job runs it from a fresh checkout, and deploy needs it.

cargo xtask dev now stops its children with SIGINT before SIGKILL, and
runs Vite without npm: killed outright, wrangler's launcher left wrangler
and workerd serving on 8787, and npm left Vite serving on 5173.

Fixes #53
@kalaspuff
kalaspuff merged commit c177e4c into main Oct 18, 2026
6 checks passed
@kalaspuff
kalaspuff deleted the fctl/42-can-you-look-into-if-https-github-com-hy branch October 18, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

CI never starts cargo xtask dev, so its bootstrap breaks unnoticed

1 participant