Changes and the gate
Use Changes to see whether a pull request, branch, or reported commit has enough test evidence to pass. Mainworthy calls this check the gate. Read its verdict to see what needs attention, or use the command line to decide whether CI can continue.


Open a change #
To inspect a change's verdict, follow these steps.
- Press g c to open Changes.
- Select a change from the list.
- Read its verdict and reason.
- Open a question that needs an answer.
Use j and k to move between changes. Enter opens the first question shown for the selected change. See the keyboard guide for navigation keys.
A report identifies the tested commit. Branch or pull request metadata groups
commits into a change. For example, pr:482 identifies a pull request.
The change shows the gate for its head, the commit the branch or pull request points to.
A commit gate is for one commit.
An older report arriving late does not move the change back to an earlier commit.
A report can also carry the current head read from the code host, so a reset or force-push
can move the change back. That head's gate stays pending until it has counted evidence.
See report results for --head and target.head.
A report with only a commit hash gives Mainworthy no branch or pull request for that commit. If a pipeline or person later names one, Mainworthy evaluates failures in that scope and keeps earlier answers in the ledger as outdated. If someone typed a result for the commit, the results keep their original scope, question IDs, and answers. Every environment shares the same commit gate.
The list says "Each head's verdict". The detail shows the head's gate, its reason and
nonzero counts, how the change ended if it did, and then "Open questions", "Settled and
excused", and "Results". When a report gave the pull request's address, the detail starts
with that address in full, for example github.com/example/shop/pull/482, as a link. A
report supplies it, so read where it goes before you follow it.
Changes shows each section after the sections above it have loaded. That keeps later sections from moving the one you are reading. While a section loads, Changes shows its heading and a message like "Reading the open questions…". The gate is the exception: the detail shows the verdict the list read at once, says it is the list's, and replaces it with the change's own gate and its counts when that read arrives. On a phone, a title in the list takes up to two lines.
If a failure needed a fix and the tests pass on another commit of the change where they
never failed with that cause, "Settled and excused" records the fix.
For example, it shows "Fixed by another commit of pr:482, which merged".
A passing retry of the original commit leaves the fix unconfirmed.
See when the fix arrives.
Once impact loads, "Impact" and "Uncovered files" show the related cases and paths,
or say that there are none.
Impact lists related cases and review information. It is not a code coverage measurement.
The counts cover the full selection of cases. The list starts with at most
200 cases. To see the rest, choose More affected cases until the list is complete. Project
updates refresh the loaded pages together. "Uncovered files" shows the first 50 paths. The
API's counts.uncovered reports the full count.
The default demo's pr:482 selects checkout test files so you can try paging its affected cases.
Read the results behind the verdict #
"Results" lists every test the latest commit's gate counted, linked to a case or tracked without one. Each row says how the gate counted the test and names who reported it. It also shows the file, job, duration, and failure message when present, and the attempt number after the first attempt. To see a test's latest results under its row, choose its name. Choose the name again to close the results. "Open in Tests" there opens the test's page. A run's results work the same way. A row links to its case and failure question when available. It also links to the CI build when the report supplied an HTTP or HTTPS URL.
Each result row uses one of the following labels.
| The row says | The gate counts it as | Why |
|---|---|---|
| unexplained | unexplained | It failed and nobody has said why. Its question blocks the gate. |
| needs a fix | attributed | It failed and a decision says the change needs a fix. |
| excused | excused | A decision excuses the failure, for example as flaky. The row says "quarantined" if a quarantine excuses it. |
| could not run | missing | The runner reported it blocked. |
| skipped | skipped | The runner chose not to run it. It proves nothing. |
| passed | pass | It passed. |
Failures come first. To filter by how the gate counts tests, choose a count or a button above the list. To find a test by name or file, type in the filter. The rows add up to the counts. Results from different producers, jobs, or environments have separate rows, even for the same test. The producer is the person, pipeline, or agent that reported the result. A retried test shows the attempt the gate counts.
Flaky tests #
A test that both passed and failed on the same commit, in the same job, is flaky, whether the pipeline ran the job again or the test runner retried the test inside one run. Its row says "flaky" under its label and "passed and failed on this commit". A failing test that flipped between passing and failing on any commit in the policy's detection window (14 days by default) also says "flaky", with how many times it flipped. The count is the one Reports shows for the same days.
The note above the list counts both types of flakiness for the whole commit, even when you filter the list. If you suspect a flaky failure, run its job again before you fix it. A passing or failing retry replaces the old result. A skipped or blocked retry leaves the failure in place. A flaky failure prevents the gate from passing until a retry passes or a decision excuses the failure. Other failures can still prevent a pass. Mainworthy omits a flip if its producer corrected either result. In Runs, a change run's row shows how many of its tests were flaky.
The command line and the API return the same rows. For example, these commands list results for a change or unexplained results for a commit:
$ mainworthy find --in results --change pr:482
$ mainworthy find --in results --commit 1111111111111111111111111111111111111111 --state unexplained
--state takes the words in the second column. --unlinked keeps the tests with no
case and --text filters by name or file. The reply's tally counts every row, whatever
the filter. Pass the reply's cursor, with the same filter, to read the next page. A new
result, decision, or case link can change which rows match or how the gate counts them.
If the filtered list changes, the server refuses its earlier cursor with conflict.
Read again from the first page. The web UI then offers "Read the results again".
A planned run's results are its slots: mainworthy find --in slots --run R-2.
The diagram follows the default policy, which requires counted evidence. A project can separately allow an explicit CI declaration that no tests are required.
Follow a change from push to push #
Each commit a person or pipeline reports on a change gets its own run. Under "Results", "Runs, newest first" lists the commit, verdict, reason, and age of each run. Choose a row to see the results the gate counted and the total time spent testing. When every counted report gives a test span, you can also see the reported test span. Choose "More runs" to read the next hundred.
From the command line:
$ mainworthy find --in runs --change pr:482
Act on the verdict #
passed means the gate has counted evidence and no current failure, dispute, missing requirement,
or open question prevents a pass. A gate can also pass if the project's policy
accepts an applied CI report that declares no tests are required. To see each outcome, read
"Results". To see which failures a decision excused, read "Settled and excused".
failed means a decision attributes a failure to the target.
Fix the product, fix the test, or update the case and test for an intended change.
Then report the new evidence. If the judgment was wrong, withdraw or replace it.
blocked means an unexplained failure, a dispute, or an open blocking question
needs a decision. Open the question, read its evidence, and answer it.
Re-running alone is not a substitute for explaining a failure that still counts.
pending means the gate cannot give a completed verdict yet.
Report missing evidence, wait for Mainworthy to apply an accepted upload, or renew an
expired decision. A run with only skipped results has proven nothing and stays pending.
A planned run can also wait for a required job or an unfilled slot.
A commit whose job reports in shards waits for every shard of that job.
See report from sharded jobs.
An unexplained failure can make a run blocked even when it also has missing results. The reason names the condition that currently determines the verdict. See runs for planned-run requirements.
A quarantined automated test keeps its failures in the run and history. The gate's
reason says how many quarantined failures were recorded and are not blocking,
including when other evidence keeps the gate blocked or pending. The quarantined
field gives that count when nonzero. A passing verdict with quarantined failures
therefore does not claim those tests passed. See
quarantine an unreliable test.
Read the gate in CI or a shell #
$ mainworthy gate
$ mainworthy gate --commit 1111111111111111111111111111111111111111
$ mainworthy gate --change pr:482
$ mainworthy gate --run R-2
With no target flag, gate uses CI or Git detection.
Choose one commit, change, or run per call.
If a commit was reported for several repositories, use --repo to identify the one
whose gate you need. Mainworthy refuses to guess between repositories.
The verdict sets the exit code:
0meanspassed.1meansfailed.2meansblocked.3meanspending.4means the command encountered an input, connection, or operation error.
Use --wait <seconds> to wait while the verdict is pending.
It does not wait for a person to answer a blocked question.
Use --json for structured output. The CLI guide lists every flag.
When a change ends #
If a pull request merges or closes without merging, report that it ended to stop questions about the change.
$ mainworthy change --change pr:482 --state merged --compact
{"change":"pr:482","state":"merged","questions":["Q-115"],"already":false}
--state takes merged, closed or open. The reply lists the failure questions that were open
about the change and are no longer asked. Nobody will act on an answer about a pull request that has ended. A failure
introduced by the merge also appears on trunk and raises its own question there.
If the pull request merged, include its head, the exact commit that landed, and the trunk branch where it landed.
$ mainworthy change --json '{"change":"pr:482","state":"merged","head":"2222222222222222222222222222222222222222","landing":{"commit":"1111111111111111111111111111111111111111","branch":"main"}}'
head is the commit the code host merged, the pull request's last commit. It becomes
the change's head even if CI has not reported it yet, and the change's gate is its gate.
Its gate is pending until results arrive. Without head, the change keeps the head its
reports recorded.
landing.commit is the commit on trunk. A rebase or squash merge writes a commit the
pull request never had, so the landing is not the head and has a gate of its own.
Changes shows it below the head's gate: "Merged. It landed on main as another commit,
which has a gate of its own", with that commit's verdict. Until a report names that
exact commit, its gate is pending. A pipeline that tests only the newest commit of a
push leaves a landing inside a stack without a report.
When change --state merged arrives, Mainworthy records the head's gate before moving
any landing to trunk. The web page shows Head H when the merge was reported
beside the current head gate, with the report time. Expand Counted results to see
what counted and how each result stood then, including the decision and answer behind its standing.
Read another page with More counted results.
The receipt records pending, failed and blocked gates too. It describes what Mainworthy
knew when the report arrived, not the actual merge time or permission to merge.
Repeating the merge report for the same head preserves the receipt, even after late jobs
or new decisions change the live gate. Correcting head records another receipt at that
new report time. Correcting only landing keeps the receipt. Reopening or closing without
merging removes the active receipt. A later merge takes a new one. Audit exports retain
all these observations. impact --change includes the active receipt's bounded manifest as
change.mergeReceipt: gate summary, report time, result count and snapshot hash. Each impact page repeats the manifest. Use impact's next to page through affected cases.
To read the immutable result snapshot, use separate calls that return at most 50 rows and 64 KiB of evidence each.
mainworthy find --in receipt-results --receipt 12 --limit 50
mainworthy find --in receipt-results --receipt 12 --cursor 12.results.49 --limit 50
Use the returned cursor, which stays valid through later reports and reopening. Identical
result pages share storage across merge observations, including when question refs change. A small result
update copies only its path in the result tree. Mainworthy reuses unchanged trees without rereading every result. Shard details and blocking-question refs
are retained in paged audit evidence, alongside the decision ledger.
The gate command and its exit code keep describing the current head gate.
A merge recorded before this feature has no receipt. Reporting it again records a receipt of today's gate, labelled with today's report time. Archives omit receipts with the change's end, so an imported change is open and has no merge receipt.
If a fast-forward lands the head itself, Changes says "Merged as its head". Mainworthy evaluates that commit's gate on trunk. All the landed commit's environments belong to trunk, including environments reported later. Reports that still name the pull request count for this commit and raise unexplained failures on trunk. The commit keeps its one gate, and planned runs that count it are recomputed. Pull request answers remain attributable in history and still cover its older commits. They do not carry to trunk. An excuse the policy gave automatically because the test already failed on the base commit ends when the commit lands. Mainworthy no longer compares that commit to the pull request's base. Existing trunk answers apply. If this commit gate is the newest run in trunk, its unexplained failures raise trunk questions immediately, even before another report arrives. An older gate can remain blocked without an open question. Planned runs that count the commit still ask about their unexplained failures.
Archives keep the resulting target and run scopes but omit the history of scope moves. To transfer older data, upgrade the source database and export it again as described in data.
If the merge or rebase lands a different commit, the head keeps its existing scope.
Omitting landing ends the change and keeps its recorded head. You can supply the
landing later by repeating merged with the metadata.
Mainworthy names a merged change beside a trunk result only when the report gives a landing
with the same repository, branch, and exact commit. Older merges without a stored landing show only
the branch and commit until the landing is reported again. Repeating merged without metadata preserves an
already recorded landing. Archives omit the landing with the change's end, so imported changes are open and
trunk results name no landing.
landing.branch takes main, master or trunk. Reopening a change does not move a
commit back from trunk.
A merged change keeps its recorded head until a change request supplies a different head.
An ordinary report for another commit or a report with target.head leaves the head in place. Reports
still count evidence, so late results for that head can change its verdict. A landing
sent later places its commit on trunk and leaves the head alone.
A change closed without merging continues to follow reports and code-host head observations. Explicitly reopening a merged change lets it follow reports again. A landed commit keeps its trunk scope.
The following records remain after a change ends.
- The merged change's head. Its row and
gate --changekeep showing that commit's gate. Without new evidence, an unexplained failure still readsblocked, with no open question behind it. - Answers already given. They stay under "Settled and excused".
- Findings about the change. A finding is about a case, and is still worth an answer.
- A question that an open planned run shows unexplained. That run waits for the answer whatever became of the change.
A report that arrives after the end, from a job that finished late, is recorded and counted. It raises no question in the ended scope. A head that landed by fast-forward is on trunk, so its late failures are evaluated and asked about there.
When a pull request reopens, report the new state. Unexplained failures on its observed head raise questions at once if that commit's run belongs to the pull request. An unreported landing commit supplies no evidence to re-ask about earlier failures:
$ mainworthy change --change pr:482 --state open
To report that a change ended, use a pipeline or person with record. This capability
lets you report results and attachments, report that a change ended, and announce deployments.
Mainworthy refuses an agent's report that a change ended or that a commit belongs to a scope. In Changes, an ended change is marked "merged" or
"closed". See report results for the
workflow that sends this from GitHub Actions.
Distinguish uploads from gates #
A successful report records evidence and prints a receipt.
Its exit code does not decide whether the commit passes.
Call mainworthy gate after mainworthy report in your pipeline.
See report results.
A test can gate a commit even when it has no case. An invalid automated case annotation does not discard a failing outcome. A newer decisive attempt can replace the previous result from the same producer, job, target, and test. A pass from a different job cannot clear that failure.
Understand agent evidence #
A commit reported only by an agent has no counted commit gate. Reading its gate returns pending with nothing proven. An agent's results are recorded and visible, and failures can raise questions. Those results do not move the change's counted head or its commit verdict.
Agent results count only in a planned run that asks for agents on a case that admits them. A review is still not a runtime pass. See agents.
Change a verdict with a decision #
Answering a failure recomputes the gates that show that cause. Choose "Infrastructure" to excuse the target you are looking at, or "Flaky" to excuse it while the hold lasts. The gate can then pass without another upload if it has no other outstanding condition.
Choose "Defect in the product", "The test is wrong", or "Expected: behaviour changed" to attribute the failure. The gate becomes failed until passing evidence replaces that failure or the judgment changes.
The result stays recorded in either case. The decision changes what the failure means for the gate. Withdrawing an excuse can block the gate again. See decide for duration and later occurrences.
Publish the gate as a GitHub commit status #
The token's user needs push access to the repository. Use either a fine-grained
personal access token with Commit statuses: write permission or a classic
token with the repo:status scope. If you also send GitHub defect requests, a
fine-grained token needs Issues: write permission.
To enable status publication, follow these steps.
-
Create a token with the required permissions for the repository.
-
Store the token in the server's secret environment as
MAINWORTHY_GITHUB_TOKEN. -
Set the following server variables:
MAINWORTHY_GITHUB_PROJECT=scratch MAINWORTHY_GITHUB_REPOSITORY=example/shop MAINWORTHY_PUBLIC_URL=https://mainworthy.example MAINWORTHY_GITHUB_STATUSES=1 -
Restart the server.
-
Report results with that repository and the full, lowercase, forty-character commit hash.
See configuration for the shared GitHub variables.
After you enable publication, a report from a pipeline or person enrolls its commit for status updates. Earlier reports and agent-only reports leave the commit unenrolled.
On the pull request, look for mainworthy/gate among the status checks. It shows the gate's reason, shortened to 140 characters, and links to the change on the instance. A trunk commit links to its run. GitHub shows success for passed, failure for failed, error for blocked, and pending for pending.
Later decisions, withdrawals, reports, and expired holds post a newer status in the same context without rerunning CI. GitHub displays the latest status for that context. A commit gets at most one publication attempt per minute. Intermediate changes combine into the latest verdict. Unchanged accepted content sends nothing. The job handles up to twenty commits per run. Shared rolling limits allow twenty posts per minute and 240 per hour. Failed and uncertain attempts count toward both limits.
If GitHub refuses a post, is unreachable, or its reply is lost, Mainworthy retries the current gate with exponential back-off. The delay starts at one minute, doubles after each unsuccessful attempt, and stops growing at one hour. After sixteen consecutive failed or uncertain attempts, that commit stops delivery with one fixed diagnostic. A new counted report resumes it, subject to any existing delay. Check connectivity, repository access, and Commit statuses write permission before reporting again. A successful post resets the attempt count.
An HTTP 429 pauses status posts for every commit, including newly enrolled commits. An HTTP 403 does so only when x-ratelimit-remaining is zero or retry-after is valid. Mainworthy waits for the longest of the exponential delay and applicable headers. It uses x-ratelimit-reset only with remaining zero or a valid retry-after.
Mainworthy caps each header-derived pause at one day. Repeated rate-limit replies increase the shared delay too, even across different commits. Other 403 replies, including missing permission, use the ordinary per-commit back-off, starting at one minute. The pause, attempt counts, and rolling limits survive a restart. No response body or exception text is stored or logged. GitHub allows 1,000 statuses per commit and context, so repeated changes or uncertain retries can eventually exhaust that limit.
After thirty days without a gate-payload change or a new counted report, an accepted commit stops automatic reconciliation. GitHub keeps its last status. Later decisions on that commit publish only after another counted report resumes reconciliation. Failed deliveries stop after the sixteen-attempt bound, even if the gate changes. Decisions alone do not resume a stopped commit.
Status delivery, shared limits, and enrollment are excluded from archives. Imported history does not publish statuses until a new counted report enrolls a commit. The token stays in process configuration.
A later decision can make the published mainworthy/gate status green while the earlier
mainworthy gate workflow step stays red. When you choose required status checks, account
for that difference. Keep runner setup failures and missing reports as CI failures.