Skip to content

feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs - #7462

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
syarifid:fm/fm-gitlab-mr-upstream
Oct 18, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
syarifid:fm/fm-gitlab-mr-upstream

Conversation

@syarifid

@syarifid syarifid commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Intent

yes, go ahead with both fixes

Context: the fixes are the two gaps in upstream issue #7355, which the maintainer confirmed on main 9b1ada0 and labeled ready-for-pr.

  1. bin/fm-pr-merge.sh can never merge a GitLab merge request in a repository that runs no merge request pipeline, even on an explicit captain order, because the GitLab guard requires a successful head pipeline and GitLab has no waiver. The maintainer's accepted shape: an opt-in, attended-only --allow-no-pipeline, refused under the away posture, scoped to a present-and-null head_pipeline only (never a failed, running, canceled or stale pipeline verdict), with the default refusal byte-identical without the flag; a project's "pipelines must succeed" setting still refuses through detailed_merge_status.
  2. After a GitLab merge request lands, bin/fm-teardown.sh cannot complete the backlog Done transition, because tasks-axi rejects GitLab /-/merge_requests/N URLs as pr links. The maintainer's accepted shape: restore parity with the existing Gerrit carve-out in fm_backlog_done / fm_backlog_retain (bin/fm-backlog-transition-lib.sh), recording a GitLab merge request URL as a note so cleanup completes, until tasks-axi accepts GitLab MR URLs.
    One pull request to kunchenguid/firstmate covering both fixes, linked to the issue.

run /no-mistakes and open the PR to kunchenguid/firstmate for issue 7355

What Changed

  • bin/fm-pr-merge.sh accepts a new attended-only --allow-no-pipeline flag for GitLab.
    It waives the pipeline check only when GitLab reports head_pipeline as present and null.
    A failed, running, canceled, or stale pipeline still refuses, every other mergeability check still applies, and a project that requires pipelines to succeed still refuses through detailed_merge_status.
    The flag is refused on GitHub and Forgejo, refused while the away-posture record exists, and rejected if given a value.
    Without the flag, the default refusal is unchanged.
  • bin/fm-backlog-transition-lib.sh replaces fm_backlog_pr_is_gerrit_change with fm_backlog_pr_note_label.
    fm_backlog_done, fm_backlog_retain, and the retained-close path in bin/fm-captain-hold.sh now record a GitLab merge request URL as a GitLab merge request <url> note, the same way they already handled Gerrit changes.
    tasks-axi rejects GitLab MR URLs as --pr links, so this lets teardown finish the Done transition after a GitLab merge request lands.
  • AGENTS.md, the afk skill, the branch prompt, and the captain-hold, GitLab merge-watch, and Pi supervision docs now describe the new waiver and the GitLab note handling.
    New tests in tests/fm-pr-merge.test.sh and tests/fm-teardown.test.sh cover both behaviors.

Closes #7355

🤖 Generated with Claude Code

Risk Assessment

✅ Low: Both fixes are opt-in or narrowly scoped and match the maintainer's accepted shape: the waiver only applies to an attended run with a head_pipeline that is present and null, the away posture is refused both before metadata is recorded and inside the locked critical section, every other GitLab condition still holds, the default refusal is unchanged without the flag, and the backlog GitLab note mirrors the existing Gerrit carve-out at every consumer.

Testing

I drove the teardown scenario live with the real tasks-axi 0.2.6. On the base commit, teardown exits 1 and leaves the item in_flight with a pending-close marker. On the target commit, it exits 0, marks the item done with the note "GitLab merge request <url>", and removes the marker. The fm-pr-merge waiver scenarios and the non-GitLab teardown regressions ran only through the repo's forge fixtures and targeted tests, and those all passed. No GitLab instance or glab credentials were available, so those scenarios are not live and are reported as untested. This is a CLI-only change, so there is no visual evidence.

  • Live validation: ✅ go - 1 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Teardown of a landed GitLab merge request task closes the backlog item as done, with the merge request URL recorded as a note (real tasks-axi) ✅ pass live live-teardown-gitlab-base.log (exit 1, in_flight, marker present) vs live-teardown-gitlab-target.log (exit 0, done, body 'GitLab merge request <url>', marker absent)
GitHub and Forgejo pr links still close as --pr links, and Gerrit still closes as a note ⏸️ untested no The earlier payload checked this only through the repo test harness, which uses a stand-in for tasks-axi, so it did not establish a live result. A live run needs landed GitHub, Forgejo and Gerrit task…
Attended captain runs fm-pr-merge --allow-no-pipeline on a GitLab merge request whose head_pipeline is null: it merges at the verified head ⏸️ untested no The earlier payload ran this only against the repo's glab fixture, so it did not establish a live result. No GitLab instance or glab credentials were available. A live run needs a GitLab project with…
Without the flag, a merge request with no pipeline is refused with output byte-identical to base ⏸️ untested no The earlier payload ran this only against the repo's glab fixture, so it did not establish a live result. A live run needs a GitLab instance and an authenticated glab, and neither was available.
Adversarial: the waiver does not cover a failed, running, canceled or stale pipeline, a ci_must_pass status, or a missing head_pipeline field ⏸️ untested no The earlier payload ran this only against the repo's glab fixture and targeted tests, so it did not establish a live result. A live run needs a GitLab instance and an authenticated glab, and neither w…
Adversarial: the waiver is refused under the away posture, refused with a value, and refused on GitHub and Forgejo ⏸️ untested no The earlier payload ran this only against forge fixtures and targeted tests, so it did not establish a live result. No GitLab, GitHub or Forgejo merge target could be changed from this gate.
Evidence: Teardown of a landed GitLab task at base (real tasks-axi rejects the URL, item stays in_flight)

Source: Teardown of a landed GitLab task at base (real tasks-axi rejects the URL, item stays in_flight)

=== BASE c7b7798 ===
tasks-axi used: /opt/homebrew/bin/tasks-axi 0.2.6
--- fm-teardown.sh rc=1 output:
error: task-x1's endpoint and local copy are cleaned up, but its backlog item could not be closed atomically (error: "Task pr link must be a canonical pull request URL: https://github.com/<owner>/<repo>/pull/<n> (GitHub) or https://<host>/<owner>/<repo>/pulls/<n> (Forgejo)"); the pending close is recorded and the next session start retries it
--- backlog row state: in_flight
--- tasks-axi show task-x1 --full:
task:
  id: task-x1
  title: teardown fixture task
  state: in_flight
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: "-"
  priority: "-"
  created: 2026-10-18
  closed: "-"
  deps: none
  links: none
  body: ""
--- pending close marker: present
Evidence: Teardown of a landed GitLab task at target (item done, merge request URL recorded as a note)

Source: Teardown of a landed GitLab task at target (item done, merge request URL recorded as a note)

=== TARGET 4fa2233 ===
tasks-axi used: /opt/homebrew/bin/tasks-axi 0.2.6
--- fm-teardown.sh rc=0 output:
/private/var/folders/3s/7gx26dws7kv_580c734gwkf00000gn/T/fm-teardown-tests.fNb61Y/live-gitlab-real-tasks-axi/project: already current
teardown task-x1 complete (window firstmate:fm-task-x1, worktree /private/var/folders/3s/7gx26dws7kv_580c734gwkf00000gn/T/fm-teardown-tests.fNb61Y/live-gitlab-real-tasks-axi/wt)
Backlog: task-x1 is closed in /private/var/folders/3s/7gx26dws7kv_580c734gwkf00000gn/T/fm-teardown-tests.fNb61Y/live-gitlab-real-tasks-axi/data/backlog.md. Run bin/fm-tasks-axi.sh ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
--- backlog row state: done
--- tasks-axi show task-x1 --full:
task:
  id: task-x1
  title: teardown fixture task
  state: done
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: "-"
  priority: "-"
  created: "-"
  closed: 2026-10-18
  deps: none
  links: none
  body: "GitLab merge request https://gitlab.example.com/group/sub/repo/-/merge_requests/12"
--- pending close marker: absent
Evidence: fm-pr-merge default no-pipeline refusal at base (glab fixture)

Source: fm-pr-merge default no-pipeline refusal at base (glab fixture)

\### default-no-pipeline  fields=[pipeline=null] args=[] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - the head pipeline status is "none", not success
  - the head pipeline ran at "none", not at the current head aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
glab merge call: 
Evidence: fm-pr-merge --allow-no-pipeline scenario transcripts at target (glab fixture)

Source: fm-pr-merge --allow-no-pipeline scenario transcripts at target (glab fixture)

\### default-no-pipeline  fields=[pipeline=null] args=[] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - the head pipeline status is "none", not success
  - the head pipeline ran at "none", not at the current head aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
glab merge call: 

\### waiver-null-pipeline  fields=[pipeline=null] args=[--allow-no-pipeline] away=0 -> exit 0
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
verified: https://gitlab.example/group/subgroup/project/-/merge_requests/7 is open and mergeable at head aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, with no head pipeline, waived by --allow-no-pipeline
glab merge call:     GITLAB_HOST=gitlab.example mr merge 7 -R https://gitlab.example/group/subgroup/project --sha aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --yes

\### waiver-failed  fields=[pipeline_status=failed] args=[--allow-no-pipeline] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - the head pipeline status is "failed", not success
glab merge call: 

\### waiver-running  fields=[pipeline_status=running] args=[--allow-no-pipeline] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - the head pipeline status is "running", not success
glab merge call: 

\### waiver-canceled  fields=[pipeline_status=canceled] args=[--allow-no-pipeline] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - the head pipeline status is "canceled", not success
glab merge call: 

\### waiver-stale  fields=[pipeline_sha=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] args=[--allow-no-pipeline] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - the head pipeline ran at "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", not at the current head aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
glab merge call: 

\### waiver-ci-must-pass  fields=[pipeline=null detail=ci_must_pass] args=[--allow-no-pipeline] away=0 -> exit 1
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: refusing to merge https://gitlab.example/group/subgroup/project/-/merge_requests/7
  - detailed_merge_status is "ci_must_pass", not mergeable
glab merge call: 

\### waiver-away  fields=[pipeline=null] args=[--allow-no-pipeline] away=1 -> exit 2
error: --allow-no-pipeline is attended-only; while the away-posture record exists a GitLab merge requires a successful head pipeline
glab merge call: 

\### waiver-with-value  fields=[pipeline=null] args=[--allow-no-pipeline=true] away=0 -> exit 2
error: --allow-no-pipeline takes no value
glab merge call: 

\### green-pipeline-no-flag  fields=[] args=[] away=0 -> exit 0
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
verified: https://gitlab.example/group/subgroup/project/-/merge_requests/7 is open and mergeable, with a successful pipeline at head aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
glab merge call:     GITLAB_HOST=gitlab.example mr merge 7 -R https://gitlab.example/group/subgroup/project --sha aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --yes
Evidence: Targeted fm-pr-merge test run

Source: Targeted fm-pr-merge test run

ok - fm-pr-merge reads a plan-gated 403 on branch rules as no merge queue, not unreadable
ok - away merge proceeds on a plan-gated 403 because that repository cannot have a merge queue
ok - fm-pr-merge --allow-no-pipeline waives only a null GitLab head pipeline and keeps every other condition
ok - fm-pr-merge --allow-no-pipeline is attended-only, takes no value, and applies only to GitLab
ok - fm-pr-merge --allow-missing is single use, attended-only, and GitHub-only like --allow-red
Evidence: Targeted fm-teardown test run

Source: Targeted fm-teardown test run

ok - teardown retires a v1 presentation journal once its token workspace is confirmed gone
ok - teardown retains a v1 presentation journal while its token workspace is still present
ok - teardown retains a v1 presentation journal when the workspace query is ambiguous
ok - teardown closes a landed GitLab task with its merge request URL as a note and GitHub and Forgejo tasks with --pr
ok - teardown closes a landed Gerrit task with its change URL as a note and a GitHub task with --pr

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 1 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Teardown of a landed GitLab merge request task closes the backlog item as done, with the merge request URL recorded as a note (real tasks-axi) ✅ pass live live-teardown-gitlab-base.log (exit 1, in_flight, marker present) vs live-teardown-gitlab-target.log (exit 0, done, body 'GitLab merge request <url>', marker absent)
GitHub and Forgejo pr links still close as --pr links, and Gerrit still closes as a note ⏸️ untested no The earlier payload checked this only through the repo test harness, which uses a stand-in for tasks-axi, so it did not establish a live result. A live run needs landed GitHub, Forgejo and Gerrit task…
Attended captain runs fm-pr-merge --allow-no-pipeline on a GitLab merge request whose head_pipeline is null: it merges at the verified head ⏸️ untested no The earlier payload ran this only against the repo's glab fixture, so it did not establish a live result. No GitLab instance or glab credentials were available. A live run needs a GitLab project with…
Without the flag, a merge request with no pipeline is refused with output byte-identical to base ⏸️ untested no The earlier payload ran this only against the repo's glab fixture, so it did not establish a live result. A live run needs a GitLab instance and an authenticated glab, and neither was available.
Adversarial: the waiver does not cover a failed, running, canceled or stale pipeline, a ci_must_pass status, or a missing head_pipeline field ⏸️ untested no The earlier payload ran this only against the repo's glab fixture and targeted tests, so it did not establish a live result. A live run needs a GitLab instance and an authenticated glab, and neither w…
Adversarial: the waiver is refused under the away posture, refused with a value, and refused on GitHub and Forgejo ⏸️ untested no The earlier payload ran this only against forge fixtures and targeted tests, so it did not establish a live result. No GitLab, GitHub or Forgejo merge target could be changed from this gate.
  • Targeted copies of tests/fm-pr-merge.test.sh running only test_allow_no_pipeline_merges_only_a_null_head_pipeline, test_allow_no_pipeline_is_attended_only_and_gitlab_only and test_allow_missing_follows_the_allow_red_rules
  • Targeted copy of tests/fm-teardown.test.sh running only test_teardown_closes_a_gitlab_task_with_its_merge_request_url_as_a_note and test_teardown_closes_a_gerrit_task_with_its_change_url_as_a_note
  • tasks-axi done t1 --pr https://gitlab.example.com/group/sub/repo/-/merge_requests/12 against real tasks-axi 0.2.6: rejected with VALIDATION_ERROR, confirming the upstream refusal
  • Real bin/fm-teardown.sh with the unmodified real tasks-axi 0.2.6 on a landed GitLab task, at base c7b7798 (from git archive) and at target 4fa2233
  • bin/fm-pr-merge.sh CLI transcripts at base and target through the repo's GitLab fixture: default no-pipeline refusal, the waiver on a null pipeline, failed/running/canceled/stale pipelines, ci_must_pass, away posture, valued flag, green pipeline; default refusal diffed between base and target
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

Note on a pre-existing local test failure

tests/fm-pr-merge.test.sh's forgejo-merges case fails locally on unchanged main (c7b7798) as well, with "the combined commit status is "unreadable"", so it is unrelated to this change and left untouched here.

A GitLab repository that deliberately runs no merge request pipeline could
never be merged through fm-pr-merge.sh: the guard requires a successful head
pipeline at the current head, and GitLab has no per-check waiver.

--allow-no-pipeline waives only the pipeline condition, and only when GitLab
reports head_pipeline as present and null. A failed, running, canceled, or
stale pipeline still refuses, every other condition (open, mergeable
detailed_merge_status, no conflicts, discussions resolved) still holds, and
the verified head is still passed to glab as --sha. The flag is attended-only
(refused while the away-posture record exists), GitLab-only, and takes no
value; without it the default refusal is unchanged.
tasks-axi accepts a --pr link only as a GitHub or Forgejo pull request, so
after a GitLab merge request landed, teardown could never complete the
backlog Done transition and left the close pending forever.

Extend the existing Gerrit carve-out in fm_backlog_done and
fm_backlog_retain, and the captain-hold answer replay that shares it, to
record a GitLab merge request URL as a "GitLab merge request <url>" note,
until tasks-axi accepts GitLab merge request URLs. GitHub and Forgejo pull
requests are still recorded as pr links.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @syarifid — reviewed tip 4fa22334 against main c7b7798b (11 files, +265/−41). The no-mistakes attestation matches this head.

Closes claim: your body says Closes #7355, and GitHub links it. The diff covers both gaps confirmed in the #7355 triage, in the shape described there.

Diff review (safe):

  • bin/fm-pr-merge.sh: --allow-no-pipeline is GitLab-only, takes no value, and is refused while the away-posture record exists. It skips the pipeline condition only when head_pipeline is present and null. Failed, running, canceled and stale pipelines still refuse, every other condition still holds, --sha binding is unchanged, and the refusal without the flag is the same text.
  • bin/fm-backlog-transition-lib.sh / fm-captain-hold.sh: GitLab MR URLs are now recorded as notes, the same way Gerrit change URLs already are.
  • No workflow, secret or CI-config changes. I approved this head's first-time fork runs: CI 39080019335 and Require no-mistakes 39080019334 / 39081040002.

Contract-class: opt-in + restore (my own read). The waiver stays off unless the captain passes the flag in an attended run. The GitLab note carve-out makes teardown's existing Done transition work again for GitLab tasks.

VISION.md (each rule):

  • One captain, one interface: aligns. A merge the captain ordered no longer forces a hand merge in the GitLab UI that skips firstmate's recording.
  • Authority is explicit: aligns. This is an explicit, attended, one-merge grant, and the away posture stays absolute.
  • Scripts own the mechanics: aligns. The script draws the null-vs-verdict line exactly.
  • A restart is a non-event: aligns. Merge and backlog recording stay durable, and the Done transition completes.
  • Delegation with a spine: aligns. The head stays bound by --sha.
  • The fleet outlives any vendor: aligns. This gives GitLab parity with GitHub's waivers and with the Gerrit note path.
  • Scope: aligns. A project's "pipelines must succeed" setting still refuses through detailed_merge_status.

What I need from you: the merge waiver is the merge-authority part of this PR, and so far it has only been run against the glab fixture (1 of 6 scenarios live). When you have a chance, could you run it against a real GitLab project (gitlab.com free tier or self-hosted is fine) and post the transcripts plus a fresh API readback for each case? The cases: (a) an MR with no head pipeline is refused without the flag, (b) the same MR merges with --allow-no-pipeline at the verified head, and (c) a failed head pipeline is still refused with the flag. Re-raising through no-mistakes with that evidence works too. CI is running in the meantime.

Overlap FYI: #6866 (GitLab project delivery) also changes the GitLab no-pipeline gate, but in a different shape. It merges automatically when the project doesn't require pipelines, with no flag. It also adds a near-identical GitLab note carve-out. The two PRs conflict in fm-pr-merge.sh, fm-backlog-transition-lib.sh, fm-captain-hold.sh and two docs, so whichever one lands second will need a rebase. Kun hasn't decided on #6866 yet. Nothing is needed from you on that now.

@syarifid

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I ran the waiver against a real gitlab.com project: a private throwaway, https://gitlab.com/syarifdn/fm-allow-no-pipeline-test, using bin/fm-pr-merge.sh at this PR's head 4fa22334 from a scratch FM_HOME, with glab 1.102.0.

(a) No head pipeline, no flag: refused. MR !1 has no .gitlab-ci.yml, so GitLab returns head_pipeline: null.

error: refusing to merge https://gitlab.com/syarifdn/fm-allow-no-pipeline-test/-/merge_requests/1
  - the head pipeline status is "none", not success
  - the head pipeline ran at "none", not at the current head c478c9475c18e90476616d41a88780e34dc07f95
exit=1

Readback: state: opened, sha: c478c947…, merge_commit_sha: null, head_pipeline: null.
The same command with main's script (c7b7798b) prints a byte-identical refusal.

(b) Same MR with --allow-no-pipeline: merged at the verified head.

verified: https://gitlab.com/syarifdn/fm-allow-no-pipeline-test/-/merge_requests/1 is open and mergeable at head c478c9475c18e90476616d41a88780e34dc07f95, with no head pipeline, waived by --allow-no-pipeline
! No pipeline running on no-pipeline
✓ Merged!
exit=0

Readback: state: merged, sha: c478c9475c18e90476616d41a88780e34dc07f95, merge_commit_sha: a5ee578df96c197ed11f85eecaa8279974269d52, merged_at: 2026-10-18T13:50:08.723Z, head_pipeline: null.
The merge commit's parents are 9bd3be10… (main) and c478c947…, the head the script verified and passed as --sha.

(c) Failed head pipeline with --allow-no-pipeline: still refused. MR !2 adds a job that runs exit 1; pipeline 2960329254 finished failed (script_failure) at the MR head.

error: refusing to merge https://gitlab.com/syarifdn/fm-allow-no-pipeline-test/-/merge_requests/2
  - the head pipeline status is "failed", not success
exit=1

Readback: state: opened, sha: 13bf5118…, merge_commit_sha: null, head_pipeline: {id: 2960329254, status: failed, sha: 13bf5118…}.
A first attempt at (c), made while GitLab was rechecking !2 right after !1 merged, also reported detailed_merge_status is "unchecked"; the re-run above isolates the failed pipeline.

The project and both MRs are left in place if you want to look.

@kunchenguid
kunchenguid merged commit 45dd50a into kunchenguid:main Oct 18, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @syarifid — really appreciate you taking the time on this.

max-metaplanet added a commit to max-metaplanet/firstmate that referenced this pull request Oct 19, 2026
## Commits taken

- d20196a feat(herdr): opt-in project groups with status tags and a sorted agents view (kunchenguid#7434)
- ce69740 fix(bin): pin LC_ALL=C for remote job process identity reads (kunchenguid#7410)
- 64dddf6 fix(opencode): ignore child stdin EPIPE in guard and encoder (kunchenguid#7447)
- 11becbb fix(bin): ignore crew state overrides for other tasks (kunchenguid#5881)
- eeeeb91 fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (kunchenguid#7415)
- 66c300b feat: support version URLs for watched tool updates (kunchenguid#7449)
- 3094475 fix(pi): keep a live session's extension markers when a nested Pi command loads them (kunchenguid#7287)
- f05b628 fix: reclaim orphaned Claude auto-arm claims (kunchenguid#5939)
- c4f4333 feat(bin): add Polytoken crewmate/scout worker adapter (kunchenguid#7321)
- 11990a2 Fix away branch relaunch admission (kunchenguid#7444)
- 56074d0 fix(bin): show reported checks when a pull request's base requires none (kunchenguid#7450)
- 0791268 fix: support durable per-secondmate account pins (kunchenguid#7452)
- 4e6b9f5 feat(bin): consult operator evidence guards before wedge escalation (kunchenguid#6958)
- c7b7798 fix(bin): make inbox listing succeed when the inbox is empty (kunchenguid#7460)
- 63fc5eb fix: bound remote secondmate convergence and preserve owed re-reads (kunchenguid#7394)
- 8ba34f1 fix: require positive daemon running status in crew-state (kunchenguid#7317)
- 1aa2a21 fix(tests): stabilize supervision host drain and offer fixtures (kunchenguid#7467)
- 69f9d09 fix(bin): refuse spawn into a project with an unborn HEAD (kunchenguid#6987)
- 45dd50a feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (kunchenguid#7462)

## Conflict decisions

- `.agents/skills/operational-home-layout/SKILL.md`: Fork seat configuration; upstream per-secondmate account configuration. Decision: Keep both configuration entries.
- `bin/backends/herdr.sh`: Fork send-failure/recovery semantics and harness variable; upstream Polytoken busy override. Decision: Keep fork send-failed and recovery handling; add Polytoken busy identity without losing the fork harness variable.
- `bin/fm-backlog-transition-lib.sh`: Fork cached library directory; upstream GitLab completion support. Decision: Keep cached source path and extend forge ownership comment to GitLab; accept GitLab completion path.
- `bin/fm-config-inherit-lib.sh`: Fork Claude/Codex seat inheritance; upstream Herdr project groups. Decision: Union the allowlist; per-secondmate account pins remain local to the primary home.
- `bin/fm-control.sh`: Fork pre-stop seat checks; upstream per-mate pins and Polytoken launch checks. Decision: Select the per-mate pin while retaining its returned account for seat conflict validation; keep all Polytoken pre-stop checks. A valid explicit pin supersedes the old recorded Claude store on relaunch.
- `bin/fm-harness.sh`: Fork in-process HARNESS_VERDICT result; upstream echo-based Polytoken detection. Decision: Add Polytoken through the fork verdict convention, retaining existing adapter detection.
- `bin/fm-lock.sh`: Fork handover reservation and runtime publication; upstream session re-anchor lease/auto-arm locks. Decision: Share the existing claim lock and release helper, add lease/auto-arm locking, then publish runtime and clear an admitted handover before releasing locks.
- `bin/fm-pr-state.sh`: Fork shared required-check evaluator from dbe11b1 and 91371c8; upstream 56074d0 adds a second gh pr checks fallback. Decision: Keep one evaluator through fm-pr-checks.sh and fm-pr-checks-lib.sh. It already checks non-advisory reported checks on unprotected bases, includes missing configured requirements, and fails closed on read errors. Adapt upstream regressions to this API; preserve the fork REQUIRED CHECK label and advisory policy.
- `bin/fm-spawn.sh`: Fork parked-session resume, seats, unclaimed-worktree guard and ticket hook; upstream Polytoken, per-mate accounts and Herdr groups. Decision: Compose both paths, retain validate_spawn_worktree_unclaimed, seat gates, profile trust and metadata, and both hooks. Extend pin/seat refusal to the selected per-mate pin while retaining the primary-home seat guard. The selected durable Claude pin owns trust and recorded store on relaunch so old seats cannot override it.
- `bin/fm-teardown.sh`: Fork merged-at/park record cleanup and isolation protections; upstream generated Polytoken wiring cleanup. Decision: Keep fork cleanup and guards; add only task-owned Polytoken files and generated untracked wiring to existing guarded teardown.
- `bin/fm-test-run.sh`: Fork timing entries and pipeline-spend suite; upstream Herdr-group and Polytoken suites. Decision: Union suite entries, preserve fork timing measurements for existing suites.
- `bin/fm-wake-lib.sh`: Fork single-read auto-arm ledger parser; upstream session-owner identity fields. Decision: Extend the single-read parser with owner_session_id and the third-line lock identity; retain orphan recovery and lease logic.
- `bin/fm-watch.sh`: Fork bounded run-activity deferral and escalation wording; upstream operator evidence guard. Decision: Keep both bounded deferrals and append operator guard evidence to both ordinary and deep-inspection escalations. Keep exact owned watcher termination semantics.
- `docs/agent-control.md`: Fork seat relaunch policy; upstream per-mate account selection. Decision: Describe both policies with account pin checked before stopping the live agent.
- `docs/configuration.md`: Fork seat sections and ticket timeout; upstream per-mate pins and remote convergence settings. Decision: Keep all sections, place per-mate pins under worker accounts before the seat sections, and retain all timeout entries.
- `tests/fm-control-relaunch.test.sh`: Fork fixture cleanup and seat regressions; upstream account and away-admission regressions. Decision: Keep fixture-scoped cleanup and all regression calls; extend the changed-pin case to check trust in the new store and recorded profile.
- `tests/fm-crew-state.test.sh`: Fork no-fork metadata parsing test; upstream override-identity tests. Decision: Keep both test bodies and calls, plus upstream positive daemon-status cases.
- `tests/fm-pr-merge.test.sh`: Fork named-case local selector; upstream GitLab waiver test definitions. Decision: Place upstream definitions before the named-case selector and retain every case.
- `tests/fm-supervision-host.test.sh`: Fork split helper/suite layout; upstream snapshot-aware offer fixture. Decision: Update the shared supervision-host-helpers.sh implementation and retain its split consumers rather than duplicate the helper in one suite.
- `tests/fm-teardown.test.sh`: Fork collision/released-claim cases; upstream Polytoken cleanup cases. Decision: Keep all regression calls.
- `tests/fm-watch-triage.test.sh`: Fork split classifier/stale/delivery suites; upstream unsplit suite with four new operator-guard cases. Decision: Keep the split and move only new guard fixtures/cases into fm-watch-triage-stale.test.sh; do not resurrect duplicated legacy test bodies.

## Additional integration and verification decisions

- Preserve fork teardown, merge, push, worktree ownership/isolation, and exact-owned watcher termination guards. GitLab no-pipeline waiver remains explicit, attended-only, GitLab-only, and only accepts an explicit null pipeline; default and existing-pipeline safety checks remain in force.
- Existing pull-request CI selects subsets and cannot prove the requested full suite. Add a manual CI workflow trigger using the existing full-suite fallback, so the feature head can run every required lane before landing; document that entry point. No local full suite or real Herdr lifecycle run is authorized.
max-metaplanet added a commit to max-metaplanet/firstmate that referenced this pull request Oct 19, 2026