Repository navigation
ci: run one fake-claude session through cargo xtask dev - #86
Merged
kalaspuff merged 2 commits intoOct 18, 2026
Merged
Conversation
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
1 task
kalaspuff
deleted the
fctl/42-can-you-look-into-if-https-github-com-hy
branch
October 18, 2026 18:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI never started the local stack, so
cargo xtask devbroke twice for people starting fresh without CI noticing (#34, #41). Nothing else in CI runs the control plane either.cargo xtask checkcompiles and lints it for wasm,crates/fctl-controlhas no tests, and thedeployjob is the first to apply the migrations (to the production D1) and start the Worker.This adds
cargo xtask dev --smokeand a CI job that runs it from a fresh checkout.cargo xtask dev --smokeIt does everything
cargo xtask devdoes: 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:localhost:5173/api/v1/health);fctl --json run --project playground --detach "write notes.md"with the CLI it built;stopped(60 s);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, notGET /sessions/{id}, because the session row in D1 is written at most every 5 s.CI
A new
devjob, "cargo xtask dev --smoke", runs next tocheckon every pull request and push tomain, with its own rust-cache. It skipsnpm ci, socargo xtask devinstalls everything as it would on a new machine.deploynow 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
--smokeends),cargo xtask devkilled 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/viteinweb/) instead of throughnpm 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
--smokelocally: the stopped session's idlefctl-agent. The host stops a sandbox about 6 s after the session reportsstopped, and--smokestops the host before that. Plaincargo xtask devleaves 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:
cargo xtask dev --smoke: 13 s to build xtask, 11 s fornpm 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 checktook 2m16s, so a pull request waits no longer.mainafter 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 checkinstead, in the same job, would save the setup,npm ciand the xtask build: about 1 billed minute a run instead of 2. But each pull request would wait about a minute longer, and thecheckcache 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
main(d3ae832), a fresh clone with no build cache:cargo xtask devreached "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 --smokefrom a fresh state (nonode_modules,web/dist,.fctl-devor.wrangler), with cached dependencies and 2 build jobs: passed in 41 s, with ports 8787 and 5173 free afterwards./me/claude): exit 1 after 10 s withadding a Claude credential: HTTP 404: {"code":"not_found","message":"Endpoint not found"}, and nothing left on 8787.crash: exit 1, "the session didn't finish its turn with a commit", and the transcript.cargo xtask checkpasses.Fixes #53
Session: https://app.fctl.sh/s/ses_01M58136GJ7HPPRNVW2YR21TX0