ci(deploy): fail fast when FLY_API_TOKEN is absent - #29
Merged
Conversation
`Deploy Worker` has never succeeded. All 9 runs, from 2026-03-02 to
2026-03-19, failed at the same step -- `flyctl deploy`. The cause is that
`FLY_API_TOKEN` does not exist: not as a repository secret, not as an
organization secret, and not as a secret on the `production` environment the
deploy job declares. `flyctl` has been handed an empty token every time.
Nothing in the repository can supply that credential, so this does not fix the
deploy. What it fixes is the cost and the diagnosis. The workflow ran the full
`ci` reusable workflow first -- duplicating the `CI` run that `ci.yml` already
performs on the same push -- and only then failed on the last line, with an
error that named flyctl rather than the missing secret.
A preflight job now checks for the credential before anything expensive runs,
and both `ci` and `deploy` depend on it. A missing token costs seconds instead
of a duplicated build matrix, and the run reports the exact command to fix it
in the job summary and as an annotation. The preflight declares the same
`production` environment as the deploy job, so an environment-scoped secret is
visible to it once added.
It fails rather than skipping, deliberately. `wright-worker.fly.dev` answers
HTTP 200, so the worker is currently deployed by hand; a green run here would
report a deploy path that is not wired. To clear the red:
fly tokens create deploy --app wright-worker
gh secret set FLY_API_TOKEN --repo OpenAdaptAI/openadapt-wright \
--env production
Follow-up, not addressed here: once the token exists, a push touching
`apps/worker/**` will again run the identical CI job twice, once from `ci.yml`
on push and once through `workflow_call` here. Deduplicating that without
weakening the green-CI gate on deploys is a separate change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NyCHrzA1psrKMFfroYbzaM
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.
The failure
Deploy Workerhas never succeeded. All 9 runs, 2026-03-02 → 2026-03-19, failed at the same step:The cause is that
FLY_API_TOKENdoes not exist:ADMIN_TOKEN,DOCS_DISPATCH_TOKENproductionenvironmentflyctlhas been handed an empty token on every run. Meanwhilewright-worker.fly.devanswers HTTP 200 — the worker is real and deployed, just by hand.What this PR does and does not do
It does not fix the deploy. Nothing in the repository can mint a Fly token. It fixes the cost and the diagnosis.
Today the workflow runs the full
cireusable workflow first — duplicating theCIrun thatci.ymlalready performs on the same push — and only then fails on the last line, with an error namingflyctlrather than the missing secret. Apreflightjob now checks for the credential before anything expensive runs, and bothcianddeploydepend on it. A missing token costs seconds instead of a duplicated build matrix, and the run states the exact fix in the job summary and as an annotation.The preflight declares the same
environment: productionas the deploy job — otherwise an environment-scopedFLY_API_TOKENwould be invisible to it and the gate would keep failing after the secret was added. That environment has no protection rules, so this adds no approval step.Why it fails instead of skipping
Skipping would make the run green and
bin/oa-greenwould call this repository healthy. It is not: the deploy path is not wired, and the worker is deployed manually. A green run would report a capability that does not exist. The red is the accurate signal — it now just says why, in five seconds instead of nine minutes.To clear it:
This is also registered in
NEEDS_YOU.md.Verification
The preflight script was extracted from the YAML and run both ways: empty token → exit 1 with the annotation and the summary block; non-empty token → exit 0. The YAML parses and the job graph is
preflight → ci → deploy.Follow-up, not in this PR
Once the token exists, a push touching
apps/worker/**will again run the identical CI job twice — once fromci.ymlon push, once throughworkflow_callhere. Deduplicating that without weakening the green-CI gate on deploys is a separate change.🤖 Generated with Claude Code
https://claude.ai/code/session_01NyCHrzA1psrKMFfroYbzaM