The label pipeline: one label → plan + code → one pull request
The built-in flows epic-questions, issue-gitflow and release-daily form a pipeline that you
drive with one label. You only step in for three things: answering questions (asked all at
once, up front), approving risky plans, and merging the pull request. (Label names below are
the ones from the example configuration; yours are whatever you set in the watcher.)
flowchart LR
G["<b>Factory_go</b><br/>you add it (to one issue<br/>or a whole batch)"] --> Q["questions check<br/>for all new issues"]
Q -->|questions| NI["Factory_needs_info<br/>you reply, or /defaults"]
NI --> W
Q -->|none| W["Factory_working<br/>Opus plans → Codex checks<br/>→ risk score"]
W -->|"risk > 75, or label<br/>Factory_review_plan"| A["Factory_waiting<br/>you reply /approve or /reject"]
A -->|/approve| C
A -->|/reject + what to change| W
W -->|risk ≤ 75| C["Sonnet codes, tests,<br/>2 Codex reviews, docs"]
C -->|"merged into develop<br/>(or the rolling PR)"| D["Factory_done"]
C -->|3 failed fix rounds or an error| E["Factory_ERROR<br/>reason on the issue"]
E -->|you remove the label| W
D --> M(["daily release PR develop → main:<br/>you merge it → issues close"])
The only label you set#
| Label | Add it when… | What happens |
|---|---|---|
Factory_go | the issue (or a batch of issues) should be built | New issues are first checked together for questions only you can answer. Then each issue is planned right before it is coded, in one run: Opus plans, Codex checks the plan against the code, both give a risk score, the plan is posted on the issue — and coding starts straight away unless the plan is risky. |
Factory_review_plan (optional) | you always want to approve this issue's plan yourself | The plan waits for your /approve, whatever its risk score |
The risk score#
Every plan gets a score from 0 to 100 from Opus, and Codex gives its own; the higher one counts.
| Score | Typical change |
|---|---|
| 0–25 | local, well covered by tests, easy to undo |
| 26–50 | several modules, or behaviour users see |
| 51–75 | persistence or migrations, concurrency, public APIs or file formats, hard to test |
| 76–100 | security or trust (signing, secrets, auth), installing/updating/deleting software or user data, irreversible steps, privacy — or assumptions the planner couldn't verify |
Above 75 a human decides: the plan is posted with the score and the reason, and the run waits
(label Factory_waiting). The comment starts with **What you need to do:** Reply /approve or /reject. and ends with: "The plan is risky and waits for your decision —
reply /approve to start coding (optionally with notes), or /reject followed by what to change — it
then plans again." Your feedback goes into the new plan. Only people with write access to the
repository can approve. (The threshold is the risk_threshold
variable, default 75.)
Issues that are too big#
When the planner finds an issue too big for one change, it proposes a split into smaller issues that can each be built and tested on their own, and scores how risky it is to split without you looking (0–100: a mechanical split along existing boundaries is low; deferring or reinterpreting scope, or anything that needs your decision, is high).
- Split risk 50 or lower: the Foundry creates the new issues by itself — with the original's
labels,
Factory_go, and a Depends on section with the real issue numbers so they are built in order — comments the list on the original and closes it. The new issues then go through the questions check and are built like any other. - Above 50, or the issue has
Factory_review_plan: the split is posted on the issue and waits (Factory_waiting). The comment starts with**What you need to do:** Reply /approve or /reject.and ends with: "The issue is split into smaller ones and waits for your decision — reply /approve and the Foundry creates these issues and closes this one, or /reject followed by what to change." - You already agreed to a split in a comment ("split it"): it creates the issues without asking.
The threshold is the auto_split_max_risk variable (default 50).
A split part (an issue with a Part N of M of #X line) is never split by itself, and neither is an issue that
still has open parts of an earlier split. The Foundry then asks you before any split, whatever the risk, and the
comment has an "Earlier splits of this issue" section with the family tree (the original, its parts, and this issue).
Its recommendation is to reply /reject: the Foundry plans the issue again against the existing parts, or
changes them. Reply /approve to split anyway. The same check runs when the split is created, so a split
without your approval creates no issues. If the Foundry cannot read the issues (or the repository has 1000 or
more open issues), it asks you too and says "could not check".
A change that is mechanical is not split for size, because splitting it would not make it smaller
(every part would touch most of the same files). A change is mechanical when it only moves, renames or
changes imports, with no behaviour change. The planner then marks the plan MECHANICAL: yes with a reason,
and the Foundry builds it as one change; the plan comment shows **Size:** over the size limit, but mechanical — built as one change.
You can also ask for it in the issue text, for example "build this as one change". That note counts as
your exception only when the issue's author or the last person who edited the issue text has write access
to the repository; a note in a comment does not count. Without that, the plan is split as usual.
When an issue is built as one change after all, and it is a split parent or its text says Build #N as one change
(N is the split parent), the Foundry closes the open parts of that split before it codes. This happens after the plan
is approved and before the code areas are locked. Each open part gets the comment "Closed as a duplicate of #P: it is
built as one change.", loses its status and trigger labels, and is closed as not planned. An open issue that depended
on a closed part then depends on #P instead, so no chain waits for a part that will never be built. A part that
cannot be closed, because it has an open pull request, a run in progress or waiting for approval, or the done label,
stays open. The comment on #P then says which part stayed open and why. The Foundry writes one summary comment on #P;
when it runs again it finds that comment and does nothing. This step never stops the run.
Questions the Foundry decides itself#
When the planner has questions, it sorts them by kind. The Foundry decides a question by itself only when both hold: it is a technical question (how the code should be done, not what the product should do) and the planner gives a recommendation for it. Everything else still waits for you: product questions, policy questions, owner action questions (things only you can do), and technical questions without a recommendation.
- What you see: a comment on the issue with the heading Decided by the Foundry. Under it is each decided question with its text and Decision:. If every question was decided, the comment says the Foundry decided them and plans the issue again, and the work goes on with no reply from you. If some were not, the comment shows the questions that still need you above the decided ones, and the run waits as before. The first line of the comment says Nothing needed from you when everything was decided.
- The planner follows the decisions. It takes them as answers. Only a later Foundry comment titled Overrule accepted changes a decision. Text copied from a decision into a comment does not change it, and a plain comment does not either.
- How to answer differently: reply
/overrule Q<n> <your answer>on the issue, where<n>is the number of the question. Only a person with write access to the repository may do this (#717, part 2 of 2 of #703). The Foundry checks the access first, then posts Overrule accepted with your answer and the decision it replaces, and plans the issue again:- Stopped, failed or waiting run: the run is resumed from its first step (
pull_ticket) and the label becomes working. - Active run that has not started merging: the run is asked to stop, with the reason "overruled". After it stops, the Foundry plans the issue again.
- Queued run, or a run that has started merging: the overrule waits for a later check. A run that has started merging is not stopped.
- Finished plan-only run: its done label is removed and a new run starts.
- Merged code: nothing changes in the code, no issue is created, no run starts and no label changes. The Foundry posts one comment with a draft follow-up issue (a title and acceptance criteria); you create that issue yourself if you want it. A run that has started merging is not stopped, and the draft comes once the run has ended merged. A merged story stays watched after its issue is closed or loses its trigger label, for 14 days after the issue's last update, at most 30 such issues per check. Excluded labels still apply: an issue with one gets no draft. GitHub search can lag a few minutes, so a draft on a closed issue can come a few minutes later. While a check for a merged story is unfinished, the issue gets no label change and no new run; the check is tried again at the next check.
- Parked or cancelled run: nothing changes.
- No run yet (the issue still needs your answers before a run starts): your overrule counts as an answer. The ack is posted, then a new run starts. Dependencies, the lock, the limits and the release pause still apply, and while the run waits, the label stays needs info.
- Read-only user: the overrule is ignored. Nothing is posted; the activity line
#n ignored /overrule from @x (no write access)is written, and the same line goes into the run's log. - Malformed command or unknown question number: the Foundry posts exactly one note, and plans nothing again.
- Failures: if the access check or a post fails, the Foundry tries again at the next check. An ack is never posted twice, and an accepted overrule is not lost.
- An
/overrulecomment is never an answer to the run's questions. A copied Overrule accepted marker without the Foundry as its author does not count.
- Stopped, failed or waiting run: the run is resumed from its first step (
- The setting: Decide technical questions itself in the repository's Run settings (field
questions.decide_technical). It is on by default. With it off, the planner's questions all wait for you, as before. A run reads the setting when it starts or resumes, so a change applies to the runs that start or resume after it. Runs read it as$FACTORY_DECIDE_TECHNICAL. See Settings and safety for the other repository settings. - Admins: in the Admin view, the run's page has a part Decided by the Foundry, below the task and its questions. It lists each round with its issue, time and outcome (decided everything and went on, decided some and asked the rest, or gave up and asked the owner). Under each round is each question with its decision; the full question text is under Full question. The card is hidden when a run has no such rounds.
- The limit: the Foundry replans at most twice in a row. After two rounds that went on, the next round that could be decided gives up instead. A round also gives up at once when a question title was already decided earlier in this issue. Giving up posts the planner's questions as a plain comment, and the run waits for you. Answer them on the issue.
Stories that fix failing tests#
A story can be written to repair tests that already fail on the branch. Without this, the run
stops at baseline_failed before it changes anything, because the tests must pass first.
Name the tests. Under a heading ## Failing tests to fix in the issue body, list one test per
line, as the JUnit XML reports print it: Class.method.
## Failing tests to fix
- `com.example.BarTest.parsesEmptyInput`
- `com.example.BazTest`
- A line with only a class name covers every test of that class. Otherwise a name must match exactly, so a part of a name never matches.
- A list item marker and backticks are fine. Code fences and blank lines are skipped. The list ends at the next heading.
- The names come from JUnit XML reports. If the test command writes none (
TEST-*.xmlorjunit*.xmlin the repository), the run stops atbaseline_failedand says so: turn on a JUnit XML reporter in the test command.
Fix a broken build: ## Build to fix. When the build itself is broken, no failing test can be
named, for example because the code does not compile and no reports are written. Put a heading
## Build to fix in the issue body (same heading rules as ## Failing tests to fix). The run then
goes on past the red baseline, whatever the reports show:
- no JUnit XML reports were written;
- a report has failures that no test case names;
- the reports name no failing test.
The run log says BASELINE: going on — this issue fixes the build, and the report on the issue says
why the tests were red. After the change, the run passes only when the build and the tests pass: a
report that shows a failing test, or has unnamed failures, fails the check. A report that names
failing tests and has no unnamed failures is not covered by this heading: the rules of
## Failing tests to fix apply as before. Without the heading, the run stops at baseline_failed
in the same cases as before.
## Build to fix
The main module does not compile after the last merge. Make the build pass.
Anyone who can put the build label on an issue can add this heading, the same as
## Failing tests to fix. The push gate still needs passing tests.
What happens when the tests fail before any change (the tests are run once more first, as before):
- Every failing test is named: the run goes on. The run log says
BASELINE: going on, and the report on the issue has a Tests before the change section with the failing tests. - A failing test is not named: the run stops at
baseline_failed. The failure summary says that the tests failed before any change, lists the failing tests that are not named, and the log shows the rest. Add them to the heading and resume the run; a resume reads the issue again. - No test is named: the run stops and lists the failing tests.
- The tests pass before the change: the run goes on as always. If the issue names tests, the report says that they already pass.
The merge rule. A run that went on past a red baseline is checked again after its change, on
test_develop and test_main (and on the hotfix path of issue-gitflow, which also starts from a
baseline commit that passed or was named). The check passes only when:
- every named test passes, and
- every test that passed before the change still passes, and
- every test that failed before the change is still reported and passes. A test that is deleted, renamed or skipped counts as a failure.
If it does not pass, the run stops at the test step, and the log lists what is not yet right.
Resume after a fix made by hand. If a run stopped at red_develop and you commit a fix on the feature branch, resume the run at merge_develop, not at test_develop:
scf resume <run-id> --from merge_develop
merge_develop merges the feature branch with the newest develop again, and test_develop tests that merge. push_develop then pushes only the commit that test_develop passed, so an untested merge never reaches develop. If you resume at test_develop or push_develop while HEAD is not on develop, or while the feature branch has a commit that the tested merge lacks, the run stops before any test runs or any push. The log then says nothing is tested or pushed and names merge_develop as the step to resume. Changes in the workspace are kept. A run saved before this change picks up the new steps when it is resumed.
Not covered. A test that fails by chance is still run only once more, not fixed by this rule. The
baseline on main for a release is not changed. You cannot switch the baseline check off for a
repository with this.
Test rules for fix agents#
The fix steps of a story (fix_tests, fix_tests_1) and the address_review steps that act on
review comments get the same short section, "Rules for tests", in their prompt. It holds what the
Foundry learned from its own test suite, so that agents in every repository fix the cause and not
the symptom:
- Before raising a timeout, run the failing test file alone. If it passes alone, the failure is load, not code: the agent says so and does not change the timeout. If the file cannot be run alone, the agent skips this check, says why, and goes on with the fix.
- A test helper does not start a new process for each call when an in-process fake works.
- Tests never write to the real Keychain, home folder or user settings: they use a temporary home folder and fakes.
- A test stops every process it starts (
afterEach/afterAll, or the runner's teardown), also when it fails. - A test that checks timing uses a generous limit or a fake clock.
The section gives example commands for vitest, jest, pytest, Gradle and Maven. It works for any test
runner: a runner-specific command that does not apply is simply not used. The section never stops a
story by itself. The prompts of these steps stay under their size limits. The section is defined
once in scripts/build-flows.mjs (TEST_RULES) and is generated into flows/issue-gitflow.yaml and
flows/issue-code-daily.yaml.
Test rules and time budget for coding steps#
The implement step and both reviews (review_1, review_2) get the same "Rules for tests" section
as the fix steps. The reviews also check the new and changed tests against it.
Before each review, the Foundry runs every new or changed test file alone and compares its time with
the budget. This check has its own step (test_budget_1, test_budget_2) and never stops a story:
- Over the budget. A file slower than
test_file_budget_sec(default20seconds) gets a medium point in the review. The fix is to make the test faster, or to add a comment line in the file that starts withtest-budget:and says why it needs the time, for example// test-budget: starts a real database once(#in Python). A reason the reviewer finds clearly wrong is still a point. - Not checked. When a file cannot be timed alone, the step says so in one line and the review goes on. Go runs a whole package, so its files are not timed. Gradle and Maven files are timed only from a new test report that names the file. Measuring stops after 3000 seconds; the files after that are listed as not measured.
- Cost. Each file runs once more before its review, in a test slot, so the check takes time and a slot like any other test run.
The settings are variables of issue-gitflow and issue-code-daily, with a label and help text on
the settings page:
test_rules(defaultyes):noturns off the "Rules for tests" section. The time budget still applies.test_file_budget_sec(default20): the budget in seconds.0turns off the budget.propose_testing_doc(defaultyes): when the repository has nodocs/TESTING.md, the story report shows a short template for one.noturns the template off.
A repository that has docs/TESTING.md follows it where it differs from the Foundry's rules.
A red base branch#
When the tests on the base branch fail, every new story would stop at the same place. The Foundry therefore holds the other stories of the repository and makes one fix story.
- What makes it red. Two runs that stop before any change, on the same commit, with the same failing tests make the branch red. One clean stop also does. A stop on an older commit is ignored.
- What waits. Each other story of the repository shows waiting — the base branch has failing
tests. Nothing to do; it starts by itself when a new commit lands on the branch. A story that
names every failing test under
## Failing tests to fixis not held, and neither is a hotfix story whenhotfix_to_mainis on. - How it ends. A clean green run of the head commit clears the state, from any run of the repository. A new commit on the branch also lets the stories start again.
- The fix story. The Foundry opens one story that lists the failing tests and starts it first. If it fails and cannot be fixed, every other story keeps waiting until a person acts. Its card says what to do: fix the tests by hand, or write a story that lists them.
- No fix story. None is made when the trigger label is a hotfix label, when the flow's autonomy level does not allow a push, or when a failing test name looks like a secret. The card says why. A secret-like name is never written to GitHub or to the log.
- Left out.
issue-code-daily, hotfix runs and repositories without JUnit XML reports have no red base branch: their stories are never held by it.
A held run is stopped at baseline_failed before the test command runs, so it does not change
anything. A false red holds the whole repository until the tests pass again on a new commit.
Labels the Foundry sets#
| Label | Means | What you do |
|---|---|---|
Factory_needs_info | Waiting for you — questions: asked up front for the whole batch, or by the planner | Reply on the issue — or just /defaults to accept the recommendations. It continues by itself. A question that needs something only you can do (a file, an account, access) is not answered by /defaults: do it, and the story goes on by itself once the file the question names is on the develop branch (or answer on the issue). |
Factory_working | Working, or paused — usage limit: planning and coding are running or paused | Wait; follow it under Changes in the app |
Factory_waiting | Waiting for you — risky plan / split: it waits for your decision | /approve or /reject + feedback on the issue |
Factory_done | Done: implemented, tested, reviewed and merged into develop (gitflow) or in the rolling pull request | Nothing — merge the release pull request (or the rolling one) when you like |
Factory_ERROR | It failed; the comment on the issue starts with what you need to do, then says what happened, why, the kind of problem, what was already tried and your options, with the failing output | Fix the cause if needed, then remove the label to start over, or resume the run on its page to continue at the failed step. If the Foundry itself failed, the comment says so and names the fix |
Issues with an excluded label (e.g. geni) are never picked up, whatever other labels they have.
How do I…?#
| I want to… | Do this |
|---|---|
| Build an issue, or a whole epic | Add Factory_go to each issue (select them all in GitHub's issue list → Labels). Give stories a Depends on section so they are built in order. |
| Answer the questions | Reply on the issue, or /defaults — or in the app, on Today |
| Change a question the Foundry decided itself | Reply /overrule Q<n> <your answer> on the issue (you need write access). See Questions the Foundry decides itself |
| Check a plan before it is coded | Add Factory_review_plan before (or together with) Factory_go |
| Approve / reject a risky plan | /approve (+ notes), or /reject + what to change — or in the app, on Today |
| Retry after an error | Remove Factory_ERROR to start over, or resume the run on its page to continue at the failed step |
| Stop the Foundry from touching an issue | Remove Factory_go, or add an excluded label |
Get the work into main | Merge the release pull request develop → main (gitflow), or the rolling Foundry pull request |
Why is nothing happening?#
A line can say "waiting — a bug story goes first": a story with a bug label is repaired before
anything new is built. It says this only while a bug story of the same repository is really queued
or running. There is nothing to do; the story goes on by itself after that.
The reason a story waits is worked out from what the Foundry knows at the time you look, in this
order: the server drains before a restart ("the server finishes its runs before it restarts"), the
run it waits for (with a link), a code area or limit, the cap on runs at the same time ("waiting —
fewer runs at once for now", when a helper lowered it), a bug story ahead, else it is simply queued.
The status comment and Your turn name the same reason. When no known reason holds, the line says
held, reason unknown and the owner has to look at the queue on the Runs page. The monitor
reports this as the held-unknown finding, once the story has been held for more than two checks of
the watcher. A stored "bug story goes first" hold with no bug story in the queue is shown as held,
reason unknown instead.
A line can say "waiting — the base branch has failing tests": the tests on the base branch fail, and the story starts by itself when a new commit lands. See A red base branch.
Look at the Dashboard (Admin view: Administration, then Dashboard under Operations):
the card Waiting — what happens next lists every labelled issue that isn't being
worked on right now (the same list is on each watcher's card on the Watchers page). Every
line starts with a badge for who has the next move (You, Foundry, Another story, A
time limit, Something is wrong), then the status name with its ? (press it for what
it means and what happens next), then the issue, what to do, why, "Continues: …" when it
continues by itself (it can say how long the run it waits for still needs, for example "after #88
(about 20 min left)", and the Changes list shows it too), and a link to the place to do it (GitHub links open in a new tab). Lines
where you have the next move come first, above the rest. The state of the watcher itself
(active, disabled or watcher error) has a ? too. Problems of the Foundry itself
(a restart wait, a usage limit, a watcher error) are in the health line on
every page. Runs that started and then paused are listed too: a usage
limit, the daily budget, a code area that another run uses, or an interruption. The same
sentences are in the failure comment on the issue and in notifications, and they also end the
Foundry's comments that ask you something (questions, a risky plan, a split, the push approval).
The comment has the fixed sentence; the Dashboard may add the number of questions or what is being
approved. Every comment that needs you starts with one bold line, **What you need to do:** …, so you
see at once what to do. For a risky plan it looks like this:
**What you need to do:** Reply /approve or /reject.
🤖 **Spaghetti Code Foundry plan**
…
_The plan is risky and waits for your decision — …_
A comment that only reports something says so too. In flows built from the push-plan,
push-result and triage blocks the plan comment starts with **Nothing needed from you**. The result comment starts
with **What you need to do:** Review and merge the pull request. when there is a pull request, else
with **What you need to do:** Open a pull request from the branch. The comment that lists the new
issues after a split starts with **Nothing needed from you**. In github-auto it starts with
**What you need to do:** Start the new issues when you want them built. when the new issues are not
picked up by themselves (auto_subtasks is no).
The label-driven flows do the same:
- The plan from
issue-planstarts with**What you need to do:** Add the code label to start coding. - The result of
issue-code-daily,issue-deliverandissue-gitflowstarts with**Nothing needed from you** — it goes to main with the release pull request. - The result of a hotfix in
issue-gitflowstarts with**Nothing needed from you** — the fix is on main and in develop.or, whendevelopcould not take the fix yet, with**What you need to do:** Merge main into develop, because the fix is not there yet. - The reply of
pr-feedbackafter review comments starts with**What you need to do:** Look at the changes. - The daily report (
daily-pr) and the release check (release-daily) start with**What you need to do:** Merge the release pull request when you like.when the checks pass, and with**Nothing needed from you** — it stays a draft until the checks pass.when they fail.
The empty line and the heading follow, as before.
In issue-gitflow, a plan that starts coding by itself starts with
**Nothing needed from you** — it is being worked on. The server gives
them for every run and issue at GET /api/next (and as next on each run). The usual reasons:
- It needs you: a question (
Factory_needs_info), a risky plan (Factory_waiting) or an error (Factory_ERROR). - It waits for another issue. If the issue has a Depends on (or Blocked by) line or
section, it starts only when those issues are done — closed (but not as not planned), or
Factory_done(in a gitflow flow, wheredevelop_branchis set; it is set after the merge into develop, but a hotfix can finish while develop is behind). You can name them as#72or by title (Story 4 — Download the update safely). An issue of another repository can be named asowner/name#72. It holds the story only when that repository is a GitHub repository you added to the Foundry under the same owner as this watcher's repository; any other repository is not waited for, and the activity log says so. The planner can write this itself: when the work needs a change in another of your repositories, it writesWAITS_FOR: owner/name#72(with#Nfor this repository; at most 10 references in all) and does not ask you whether that issue is merged. A name that is not one of your Foundry repositories is reported as a problem ("is not a repository of the Foundry") and not recorded. The other issue is read in this order (at most 20 reads per check): first with that repository's own sign-in, if it has one; then, when both repositories are under the same GitHub account or organisation (case is ignored), with the sign-in of this watcher's repository. The first readable issue is the answer, whatever its state. A 403 or 404 means "cannot read", never "done", so the story keeps waiting, unless the issue is known to be closed (see below). When it is closed as not planned, the story shows in Your turn with the reason, because it will never be done; reopen it or take it out of Depends on. A repository with no sign-in of its own (its method isnone) is read with the server's own access only when you added it and you are an admin. Anonerepository that another user or a team member added is never read, and neither is a non-admin'snonerepository, with any sign-in. When no way can read the issue and it is not known to be closed, the story waits for you. Its status comment names the issue, says it could not be read and which ways were tried, and gives the two ways out: give that repository a sign-in under My repositories, or take the line out of Depends on once that issue is done. A read that times out or fails for another reason is not taken as "no sign-in": the story keeps waiting and the next check tries again. Your turn shows one notice for it, not one on every check, and the notice goes away when the story is no longer held. The service log writes the refusal once per story and reason. Closed, but cannot be read. When an issue cannot be read in a check but the Foundry last saw it closed as completed, the story does not wait for it. That closed state comes from the last successful read of the issue or from the issue list stored for its repository, whichever is newer; nothing is read to decide it. The story starts, and its status comment has a Note line that says the issue could not be read and was counted as done because it was closed when last seen (with the date). The repair log gets oneunread-dependencyline. An issue closed as not planned, or last seen open, still holds the story, and so does one that was not read in this check because of the limit of 20 reads: it may have been reopened. If the issue was reopened and can be read again, the story holds again. A blocker in another repository is shown as anowner/name#72link to its issue on GitHub (it opens in a new tab), on the Work page, in the story panel, on the run page under "What happens next" and on the Board. A blocker in this repository is shown as#72, as before. So you can putFactory_goon a whole chain at once; each story is planned and coded on top of the code of the one before it. A story that has stopped (questions, approval, usage limit, budget) also waits there: it is not resumed and gets no automatic answers until its dependencies are done. Then it continues by itself, with the reason "its dependencies are done" in the activity log. The Foundry may add its own dependencies in a marked part just under the Depends on header, between two HTML comments, with a line that says why. You can edit or remove that part; your own text there is never changed. Those dependencies are held even whenwait_for_dependenciesis off. The questions check (epic-questions) can record such a dependency too. When a story must wait for another open issue and its Depends on does not name it yet, the check writes the wait into that marked part, prints it, and posts no question and no label. Only an invalid request becomes a question: waiting for itself, a loop with another story of the same batch or of the repository, an issue whose work already landed, or an issue that is unknown or closed. That question comes with a recommendation to plan the issue now without waiting. If the commit history cannot be read, no wait is recorded and every such request becomes a question. The planner can also ask for a wait. Inissue-planandissue-gitflow, when the planner finds that the work must wait for another open issue and that issue is not in Depends on yet, it answers with that issue instead of asking about the order. The Foundry adds the issue to the marked part of Depends on, prints it, and stops without a comment. When that issue is done, the watcher continues: it reads the issue again and plans again on the current code. The same rules as above apply. The wait becomes one question when the planner names the issue itself, an unknown issue, a closed issue with no commit, work that already landed, an issue it already waited for, or a loop, or when the check hits its limit. The question comes with a recommendation to plan the issue now. A run that you started by hand stays stopped until you resume it. - Another issue is being built. One issue at a time per repository; the rest start after it.
- New issues are being checked for questions (a few minutes, once per batch).
- The usage limit or the daily budget is reached. Runs pause and continue by themselves
later; the label stays
Factory_working. - The Foundry isn't running. Watchers only run while
scf ui/scf serveruns. - It has an excluded label such as
geni. - The story is parked. Its trigger label was removed while its run waited for your answers, you replied
/park(or a "do not build" line to a "not a coding task" stop), or the run was cancelled while stopped. Nothing is asked of you and nothing runs: the overview says "parked — not tracked by a watcher". Add the trigger label again to start the story over (see How issue watchers use labels). - The issue was closed on GitHub, but its run is still working. The line says so and links to the run's page. Cancel the run there if the work is no longer wanted; if the issue was closed by the run itself (report, split, merge) you see nothing. A run that waits for you or is stopped is not cancelled when its issue is closed: it only leaves your lists. If you reopen the issue, the watcher puts the status label back and the same run is listed again; no second run starts. Runs that an older version already cancelled stay cancelled.
- The watcher has not checked for a long time (more than three times its interval). The line says since when ("has not checked since 11:20"). Press Check now on the Watchers page; the line is gone after the next check.
Branches: gitflow (recommended) or one rolling pull request#
The pipeline can deliver in two ways; the watcher's flow decides which.
Gitflow — flow issue-gitflow, with release-daily once a day
flowchart LR
M[main] -->|"created from main (once)"| D[develop]
D --> F1["feature/86-…"] -->|"tests + reviews pass →<br/>Foundry merges"| D
D --> F2["feature/88-…"] -->|merged| D
D -->|"17:00: release PR, you merge"| M
- Every issue gets its own branch,
feature/<issue>-<title>, fromdevelop. When its tests and both Codex reviews pass, the Foundry merges it intodevelopitself, runs the tests on the mergeddevelop, pushes, deletes the merged feature branch (delete_merged_branches: nokeeps it) and closes the issue — done means merged intodevelop(close_when_merged: noleaves it open until the release reachesmain). Ifdevelopmoved meanwhile, it merges again; conflicts are resolved by an agent (keeping both changes), then tested again. The changelog never conflicts: both sides' entries are kept (union_merge_files). - A red merge does not hold develop. If the tests on the merge with
developfail, the run gives up its turn atdevelopbefore anything is fixed. The merge result is moved onto its feature branch and pushed there, and the fix is made and pushed on that branch too. Then the run merges again from the newestdevelopand tests again. Other runs can merge, test and pushdevelopin the meantime, and the run's page says "waiting for develop" while it waits for its turn. The fixer is given the names and messages of the failing tests, from the JUnit report or the test summary. Tests that fail only under load are run again without a fix. A run that is still red after 2 fixes, or 2 test runs that did not finish, stops with the reason, and its work stays on the feature branch. The hotfix path (mainintodevelop) keeps its turn through its fixes, because the fix is already onmainand there is no feature branch to carry it. developkeeps moving. Each time the run findsdevelopmoved before its push, it merges again at once. The count is kept in the run folder (develop-moves), so a resume keeps it. After the 3rd move, the run gives up its turn atdevelop, waits for a quiet moment, and tries merge, test and push once more. The quiet moment means: no other run holds or waits fordevelop, anddevelopon the remote stays on the same commit for a settle time (default 120 seconds). The wait has a cap (default 30 minutes). Ifdevelopmoves again on that last try, the run stops, the work is kept on its feature branch, and one item Needs you says "develop kept moving". Resume the run whendevelopis quiet, and it gets one more wait and try. When the work lands, the item is marked done. These environment settings change the times:FACTORY_DEVELOP_SETTLE_SEC(default120),FACTORY_DEVELOP_QUIET_MAX_SEC(default1800, at most2100) andFACTORY_DEVELOP_QUIET_POLL_SEC(default15).- Several issues are coded at the same time when they change different parts of the code:
each plan names its code areas (
AREAS:), and a run waits only while another run holds an overlapping area — without holding a slot: it steps aside and continues as soon as that run is done. Docs, the changelog and whole test folders are never locked (they merge safely). Issues in a Depends on chain are still built one after the other. - No waiting when nobody needs to act: when a run ends, the Foundry checks that repository at once, so the next story, a resume or a retry starts right away instead of at the next interval.
- No more rounds than the work needs. Opus plans at high effort. Only a plan with a risk score
above 75 — one a person approves anyway — is rewritten by Opus (at its highest effort) after
Codex's review (
revise_above_risk); for every other plan Codex's notes go straight to the coder. Each code change gets one Codex review. Setreview_twice_above_riskto a number (for example50) to get a second review after a[high]finding or for stories riskier than that; the default isoff. - No test run twice on the same code. The tests before a change and the tests after a merge are
skipped when exactly that code already passed them in another run — which is the normal case for
the tests before a change: the story starts from the
developthe previous story just tested. The log says "not run again". Setreuse_test_results: noto always run them. - Test tiers: one full test run per story. A story checks its code in three tiers:
- Static checks (
static_check_cmd, defaultauto): a type check, lint or schema check, run after every agent change (the coding step and each fix), before the tests of that loop. A failed check goes to the same fix step as a failed test.autofinds the command from the project files: atypecheckorlintscript,go vet,cargo clippy,./gradlew check,mvn verify -DskipTestsorruff. Empty oroffturns them off. When no command is found, the log says so in one line and the story goes on. Checks that already fail on the untouched code are switched off for that story, and the log says why. - Flow check (
flow_check, defaultyes): when a story changes flow files, the static check of #1058 runs on them after each agent change, before the static checks, and lists the warnings in one short block (at most 15 rows; the rest is named by a count). Flow files are.claude-factory/flows/*.yaml, and in the Foundry's own repository alsoflows/andblocks/, which are generated into a temporary folder first. Warnings never stop a story. A file that cannot be checked (a link, a file over 1 MB, or one that is not a valid flow) is named as not checked, and the full suite runs. When the check cannot run at all, the full suite runs and the log says why in one line.noturns it off, and so doesflow_check: noin.claude-factory/config.yaml. The check does not depend on the test runner.issue-code-dailysays in one line that it has no flow check. - Quick tests (
quick_test_cmd): the tests inside a story, in every fix loop, in the re-tests of fixed tests and before the merge (pretest_tests). For example only the tests the change touches (npx vitest run --changed --passWithNoTests). Empty oroffuses the fulltest_cmd. When the quick command cannot run, the full suite runs instead, and the log says so. Before the merge withdevelop(test_developnot yet run in the run), a full test run that an agent starts itself is swapped for the quick command too (see Tests an agent starts itself below). - The full suite (
test_cmd):test_developruns it once, on the merge withdevelop, and nothing is pushed todevelopwithout it passing. The baseline before the change reuses a full pass on the same commit or tree (also one an earlier story recorded), and runs the suite only when there is none. A repository without a quick or static command keeps the steps it had before; each affected step says so in one line. - Slow tests (
slow_test_cmd, T4): large and slow tests, such as end-to-end or load tests. They never run in a story. They run in the daily release check, after the full suite and the build check, and in the nightly run (Run the slow tests nightly). Empty (the default) oroffmeans none.autofinds no command from the project files: it uses only aslow_test_cmdpinned in.claude-factory/config.yaml. A failure blocks the release like a failed test.
- Static checks (
- The merge is tested ahead of its turn. A finished story tests its merge with
developbefore it takes its turn atdevelop(stepspretest_mergeandpretest_tests), with the quick tests, so several stories test side by side.test_developthen runs the full suite on that merge. Ifdevelopdid not move meanwhile, the turn needs no test run and the story is pushed at once. - A few test runs at a time. At most
test_slotstest commands (default2) work on the machine at once, over all runs and repositories; the others wait their turn. Many test runs at once make each of them slow and let timing-sensitive tests fail.0switches the limit off. Under load the governor also lowers the workers of each test run (see "The load governor"). Test runs work at a lower priority (nice10;FACTORY_TEST_NICEchanges it,0keeps the normal priority), so the server, its pages and the agents stay responsive while tests work. Four environment variables tune the slot runner for the daily checks.FACTORY_TEST_SLOT_LIMIT_SECis the working time of a command in seconds, counted from its start after the slot wait. At the limit the command's whole process tree is stopped (SIGTERM, then SIGKILL 5 s later, at most 6 s in all), the slot is freed, the last line saystest-slot: stopped after <n> s — the time limit is <m> sand the exit code is 124. With no limit nothing changes.FACTORY_TEST_SLOT_STARTED_FILEgets the epoch seconds just before the command starts.FACTORY_TEST_SLOT_TRACK_FILEturns on the stopping of processes the tests leave behind (see the next item), andFACTORY_TEST_SLOT_TRACK_MS(default2000) sets how often they are noted while a limit or a track file is set. - Processes the tests leave behind (#994). When a test command ends, the slot runner stops every
process the command started that is still running, also those that left its process group: SIGTERM,
then SIGKILL after 5 s. A process is stopped only when its process ID and start time still match, so
a process that took over the same ID is never touched. Each stopped process gets one line in the
step log with its command and age, and the step's evidence records the count (
leftovers). The exit code does not change. The same check runs at a time limit. A shared build daemon (Gradle, Kotlin,mvnd) and what runs under it are left running and named, because other runs may use them. When a check cannot finish (for example, the process list does not answer), the step goes on and the log says why. Limits: on macOS the Foundry cannot see the environment of system programs such asshorsleep, so a process that leaves the command's group and loses its parent before the check sees it can be missed, without a warning. On Linux the check finds any process that keeps the inherited mark. Reading the process list at a time limit can take more than 1 s; past that, processes are still stopped, but the log only says the list could not be read. The monitor reports a GitHub repository whose last 3 checked runs all left processes behind (test-leftovers, in the table below). Time-limit stops and checks that stopped nothing do not add to or end that streak. Runs without a GitHub repository are ignored, and the finding clears once the newest checked run is over 30 days old. - Failing tests first after a fix (#983). When a test run fails, the Foundry writes the failing
tests to
failed-tests.txtin the run folder: the test file and the test name, from the test output (vitest, jest, pytest, Go, Maven and Gradle with a test filter are read). The test step that follows a fix step first runs only those test files, with the test command limited to them. If one still fails, the step fails at once with that output, and the next fix step starts; the whole suite does not run. If they pass, the whole suite runs as before, and a story still merges only after a passing full run. A run that passes clears the list. When the test command is not a known runner, or the list has no usable target (or more than 50), the step runs the whole suite as before. - Time of each test file (#988). Every test step writes
test-times.jsonto the run folder: one entry per test file, slowest first, withfile,tests,time(seconds) andresult(passed,failedorskipped), and atotalwith the sums and the worst result. The Foundry reads the report that the tests of this step wrote: a JUnit XML report (TEST-*.xmlorjunit*.xml), or a vitest or jest JSON report. Under the Foundry, the vitest run writes its JSON report there too, next to the usual output, which does not change. For pytest's default output, the file is worked out from the test class name. Without a report nothing is written. A report that cannot be read prints onetest-times:line. The file never changes the step's result or exit code. - Tests that did not really run are never green. A test step first checks Docker when its tests
need it: a Testcontainers or Docker Compose dependency in a build file (up to 3 folders deep), or a
dockercommand intest_cmd. If Docker does not answer, on macOS the Foundry starts Docker Desktop and waits up to 3 minutes. If Docker still does not come up, the step fails withDocker did not start. After the tests, the step reads the output and the JUnit reports: a container test that was skipped because no Docker environment was found, or because Docker refused the API version, counts as not tested, and so does a skip by@Testcontainers(disabledWithoutDocker = true). Such a step is not green. In both cases the run ends at that step, and the AI fix step is not started, because an agent cannot repair the machine.- A refused API version also files one bug story in that repository (class
auto). It names the Testcontainers version in use and the first version that works with the installed Engine, from a built-in table (for API 1.44: 1.21.4 for Testcontainers 1.x, 2.0.2 for 2.x). The story is is tried again by the watcher when filing fails, and a lost reply from GitHub does not file it twice. A run of a user or a team files it with its own GitHub sign-in only, never with the server's. - A hung test run has no output for
test_silence_minutes(flow variable "Test silence limit (minutes)", default20,0switches it off, up to 720). It is stopped and run once more. A second silence fails the step with that reason. The retry starts only when every process of the first run is gone. Time spent waiting for a test slot is not silence. - Limit. Inside a Docker sandbox the step can only see the "no Docker environment" and API-version messages; it cannot see other skipped tests or hangs there.
- A refused API version also files one bug story in that repository (class
- A wait for a slot does not use up a step's time limit. While a step waits for a test slot, its
time limit stops: the wait is moved back, at most
FACTORY_TEST_SLOT_WAIT_SECseconds (default5400, 90 minutes). A step never runs longer than its limit plus that bound, so a step that waits forever still ends. The step log and the run's page say how long it waited, for examplewaited 18 min for a test slot. If the step still ends on its limit, the message says that it waited, and whether the wait counted:timed out (waited 18 min for a test slot, which did not count). A read-only Codex session cannot write the record of its wait, so its limit counts every second. - The run page counts the full suites. Every test run records whether it ran the full suite or a tier below it, and the run page's timeline shows the number of full suites and the total wait for test slots (see Steps above). A read-only Codex step cannot write that record, so a run with such a step with the test gate shows "not known" for both numbers.
- Tests an agent starts itself count too. In an agent step,
npm/pnpm/yarn/buntest scripts,npx vitest(and jest, mocha, playwright …),pytest,python -m pytest,gradle/mvntest, check, build or verify, andgo test/cargo testgo through the same test slots and run at the same low priority (the small commands intools/agent-bincome first on the agent'sPATH). The wrappers of Gradle and Maven,./gradlewand./mvnw(also assh ./gradlewor with an absolute path), count too when they run a test goal:test,check,build,verify,integrationTest,connectedCheck,install, or a task such as:app:test. A Gradle run in a slot gets a low-priority Gradle daemon. Other goals, such as./gradlew assemble, run unchanged. Quick tests before the merge. Beforetest_develophas run in the run, a full run an agent starts (for examplenpm test,pytest,./gradlew testorgo test ./...) runs the quick commandquick_test_cmdinstead, in the project folder, with no wait for a test slot. The gate prints onetest gate:line naming the quick command and saying that the full suite runs once on the mergeddevelop(test_develop). The exit code of the quick command is the agent's exit code. A quick command that exits 126 or 127 falls back to the full run. The full run stays as it was, with onetest gate:line giving the reason, when:- no
quick_test_cmdis set; - the step is
fix_develop,resolve_backorfix_back, ortest_develophas already run in this run (the full suite runs there); - the run is a hotfix (its full suite runs on
main); - the setting
agent_quick_testsisnofor the repository (the default isyes, a flow variable set per repository in the watcher'svars); - the call selects tests or does more than run the whole suite: a name or pattern filter, a
single file or package, an option that changes what runs (such as
--prefix,--filteror-Dtest), or a runner command the gate does not recognise. A quick command in a package-manager form the gate cannot check keeps the full run. Writeyarn run test:quickornpm run test:quick(the script must exist inpackage.json). Narrow runs, other commands and runs inside a test slot are unchanged. A flow without atest_developstep prints nothing. An agent waits at most 5 minutes for a slot (FACTORY_AGENT_TEST_WAIT_SEC). A full test run that gets no slot in that time does not start: the command exits with code 75 and tells the agent to run single test files instead (for examplenpx vitest run tests/foo.test.ts) or to try again later, so two full suites never run at once. A narrow run takes no slot and never waits: a few test files (up to 5, each a path with its folder, such astests/foo.test.ts) or only what changed or is related (--changed,--onlyChanged,--findRelatedTests,vitest related). Narrow runs still run at low priority and follow the worker limit. Every other command runs unchanged. Not covered: other test scripts started by path, such as./scripts/test.sh, and steps of a user's run in the OS sandbox.
- no
- Small sessions for easy steps. Writing the docs and resolving a merge conflict each start a fresh session with only what they need, instead of continuing the whole coding conversation. If the tests fail after a resolved conflict, the coding session takes over.
- Every day at 17:00 (
release-daily) the Foundry runs the full tests and build ondevelop(then the slow tests, whenslow_test_cmdis set; without it the checks are the same as before and the log says so in one line) and opens (or updates) one pull requestdevelop→mainthat lists and closes the day's issues — a draft while the checks fail. A red run opens a new pull request as a draft from the start; for an existing one it switches the pull request to a draft. If that switch fails, the run sayschecks failed — could not mark PR #<n> as a draftinstead of hiding it. You merge it once a day. When the tests pass on a clean checkout, the run also records that pass in the data folder, so that self-update can skip its own test run on the same code. - The time limit of the daily checks. The full tests and build of
release-dailyanddaily-prmay work forverify_timeout_minminutes (flow variable, 1 to 720, default180). The wait for a test slot does not count: the limit starts when the tests start, and the build gets the time that is left. A check never fails just for waiting.release-dailywaits up to 90 minutes for a slot by default (FACTORY_TEST_SLOT_WAIT_SEC,5400) and never runs its tests without one; if none comes free, the check is postponed to the next daily run. The wait does not count against the time limit, and the wait is capped at 6 hours in all. When the limit runs out, the processes are stopped, the run still succeeds, and the pull request is a draft with the line⏱ **Checks did not finish in time** — the time limit of … (verify_timeout_min) ran out before …. A time-out writes notested-v2/record, so self-update runs its tests again. Set another limit in the watcher'svars(see the watcher examples in 6. Automate with watchers). The server environment variableFACTORY_CHECK_LIMIT_SEC(1 to 43200 seconds) replaces the limit of these checks; a value that is not a whole number is ignored with a message. - Reuse of test results.
release-dailyskips the full tests when this exact code already passed them in a story run or in an earlier daily check: the same clean tree and the same test command. The log and the checks then saynot run again: this exact code already passed these tests (run <id>, <time>). The build still runs. The reused result is still passed on: the run writes the release record in the data folder for this tree, naming the run that tested it, so self-update can skip its own tests. A story result written before this change is reused but not passed on. Set the flow variablereuse_test_resultstonoto run the tests every day.daily-pralways runs its tests. Self-update still runs its own tests unless the daily check recorded them, as described there. developis created frommainthe first time, and kept up to date withmain(for example after a hotfix) before new work starts.developmust not be in Protected branches (Settings, section Safety), since the Foundry pushes to it;mainstays protected (the one exception is the hotfix path below, and only when you switch it on).- Hotfix — bug stories go to
mainat once. An issue with a label inhotfix_labels(defaultbug, any case) is built as a hotfix when an admin has switched on Hotfixes in Settings, section Safety (off by default). Without the setting, or in a changed copy of the flow, it is built as a feature and the report says why in one line. The plan, plan review, size and risk checks, code areas, build, tests, reviews and docs are the same. What differs:- The branch is
hotfix/<issue>-<title>(hotfix_prefix), made from themaincommit the tests passed on before the change. - After the reviews the Foundry merges it into
main(no fast-forward), runs the tests on the merge result and pushesmainonly when they pass. Ifmainmoved meanwhile, it merges and tests again. The issue is closed as soon as the fix is onmain; it does not wait for the release. No pull request, no tag. - Then
maingoes intodevelop(conflicts are resolved by an agent and tested, like for a feature), so the release has no conflicts from hotfixes. The mergedhotfix/…branch is deleted (delete_merged_branches: nokeeps it; a branch that got new commits after the merge is kept). - A hotfix is never split by itself, and a plan above the risk threshold still waits for you.
- The comment on the issue says: fixed on
main(with the commit), merged intodevelop, and whether the running Foundry already has the fix (only when the issue belongs to the Foundry's own repository).
- The branch is
flowchart LR
M[main] --> H["hotfix/42-…"]
H -->|"tests + reviews pass →<br/>merge, test, push"| M
M -->|"merge, test, push"| D[develop]
If develop cannot take the fix (conflicts the agent cannot resolve, or red tests), the fix is
still on main; the comment starts with Merge main into develop and says why. The Foundry
tries again when it starts the next story (without conflicts only). To be sure, merge main
into develop yourself — until then the daily release pull request can show conflicts.
- Size limit: a plan over 15 files or about 800 lines of production code (tests and docs
don't count) is split into smaller issues instead — automatically when the split risk is low
(
max_files,max_code_lines).
The human-in-the-loop pipeline#
For work where you want to see and approve every plan before any code is written:
issue-plan (label Factory_ready) plans the issue and posts the plan; you read it and add
Factory_code; issue-code-daily codes it on the day's branch; daily-pr opens the day's pull
request to main at 17:00, and no new coding starts while it is open.
Which flows ship#
Two delivery pipelines, what supports them, and the standalone refinement flow: epic-questions,
issue-gitflow and release-daily (gitflow), issue-plan, issue-code-daily and daily-pr
(human in the loop), and refine-brief (the architect's context brief, see
Refinement; it can't be deleted, because Refinement uses it) and refine-round
(the architect's question round, same section). Build anything else yourself in the editor, with ✨ Draft flow with Claude, or with any
AI assistant (Let any AI write a flow). A flow that a watcher uses —
enabled or disabled, or as its questions check — or that another flow runs as a step can't be
deleted; the Foundry says which watchers or flows use it.