feat(ci-gate): wait for CI to prove a commit before a human is called #418
No reviewers
Labels
No labels
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli!418
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/ci-green-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
After a PR is created, the command waits for CI to reach a verdict, and only a
proved-green commit is handed to a human or merged.
There is no separate "wait for CI" step: it is wait if there is a CI to wait
for, and whether a branch carries CI is a fact the code reads from the commit
under test — the workflow files in
HEAD— never per-project configuration.GitHub, GitLab and Forgejo are all first class. GitLab was verified end to end
against a live self-hosted instance (MEDECA): MR 396 read as green, MR 367 as
red naming the
e2ejob,script_failure, and job 14623.On red CI: locate, never diagnose
The gate names the failed jobs, downloads their logs, and prints absolute paths,
forge URLs and suggested greps. It quotes no excerpt and guesses no cause. A real
747 KB GitLab trace cleans to 645 KB with its Czech text intact.
The exit-code contract
Exit 3 exists because a CI wait outlives the shell an agent will hold open. The
budget lives on the card (
ci_deadline), so a resumed invocation spends what isleft of it rather than starting a fresh thirty minutes.
Commands
iw phase-prgates the phase it just opened.iw phase-mergemerges only the commit the gate read (--match-head-commit,--sha,head_commit_id), so a push landing between verdict and merge cannotslip in ungated.
iw ci-gateis new: it gates work that has no phase — a slice, a spike, abranch opened by hand. It never commits and never pushes, because a push would
move the head and restart the run it is waiting for.
Dashboard
New CI states are understood: a red gate asks to fix the failure rather than to
review a pull request, and a
ci_pendingcard that no writer has touched for tenminutes is a gate that died — the one place resolution raises a claim no writer
made, because the writer is the process that died.
Review
Eight reviewers ran over this branch. They found one critical defect and twelve
warnings; every behaviour finding is fixed. The ones worth knowing:
git ls-treefailure read as "this branch has noCI", sending the PR straight past the wait. It now reports the error.
phase-mergenever wroteci_failed. An exhausted gate left the card atci_pending, whichbatch-implementreads as recoverable, so it loopedinstead of stopping and raised no claim for a person.
a false claim about the forge when the real cause was an expired token.
forge-written job names are fenced in the recovery prompt as data the agent
must not obey.
Deferred deliberately: an opaque
CommitShasweep, URL query encoding, adownload size cap for GitHub and Forgejo, and issue-id path validation — all
pre-existing or repo-wide rather than this branch's scope.
Clean break
No backward-compatibility shim.
CommandEnv's merge methods takematchHead,and
listInHeadreturns the git error instead of an empty list.Verification
Core suite, the dashboard module under Mill, and the bats suites all green.
The pre-push gate (warnings as errors, scalafix, both suites under Mill, all 33
commands compiled) passes.
Note:
MEDECA's main-branch pipeline runs ~57 minutes, so it needs--timeout 90m. That is documented, not defaulted.