Skip to content

fix(bin): carry GitLab merge-request links into the backlog body on close - #2

Merged
valerius21 merged 3 commits into
mainfrom
fm/fm-gitlab-backlog-close
Sep 14, 2026
Merged

valerius21 merged 3 commits into
mainfrom
fm/fm-gitlab-backlog-close

Conversation

@valerius21

Copy link
Copy Markdown
Owner

Intent

Firstmate-observed defect, reported to the captain on 2026-09-10 and filed as follow-up work; the captain's standing instruction is that GitLab projects are first class ("wir sind hier meist mit glab unterwegs ... pass es an auf gitlab").

Observed today four times (tasks ai-chat-mr75-ci, ai-chat-167-vitest-forks, ai-chat-139-ratelimit-reset, ai-chat-143-itests): bin/fm-teardown.sh <id> cleaned the endpoint and worktree, then failed to close the backlog item: "error: Task pr link must be an http(s) pull request URL ending in /pull/". The task's recorded pr= is a GitLab merge request URL (https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75), which tasks-axi's --pr validation (external npm tool, GitHub-only) rejects, both in tasks-axi update --pr and in the done transition bin/fm-backlog-transition-lib.sh passes --pr <url> to (lines ~520-560, ~941). Teardown then records state/.backlog-close and every session start retries the same failing transition (BACKLOG_RECONCILE), so the items stay In flight forever and the markers accumulate: state/ai-chat-mr75-ci.backlog-close, state/ai-chat-167-vitest-forks.backlog-close, state/ai-chat-139-ratelimit-reset.backlog-close, state/ai-chat-143-itests.backlog-close exist right now in this home.

What Changed

  • bin/fm-backlog-transition-lib.sh now classifies every --pr value it forwards through fm-pr-lib.sh: GitHub pull-request URLs still pass as --pr, while any other link (a GitLab merge-request URL) is rewritten to --note "MR <url>" on done and kept only as the deliverable line on retain, so the tasks-axi transition no longer fails and the link survives in the item body.
  • bin/fm-captain-hold.sh applies the same gate when answering a call with a validated retain-mode pending-close record: a GitHub --pr or report is still written via update, while a GitLab --pr is handed to fm_backlog_done so the answered close carries it into the body instead of dropping it or erroring.
  • Regression coverage added in tests/fm-backlog-atomicity.test.sh and tests/fm-captain-hold-lifecycle.test.sh; docs/configuration.md and docs/captain-hold-lifecycle.md describe the automatic MR <url> carry-through.

Risk Assessment

✅ Low: The change is bounded to classifying --pr links through the existing provider parser, every forwarded --pr path (close, retain, answered close, replay) now succeeds for a GitLab MR with the link carried into the body, I verified tasks-axi's note semantics support idempotent replay, and the only open point is an authorial scope choice on the answered-close carry-through rather than a defect.

Testing

Reproduced the reported defect directly against the real tasks-axi (both update --pr and done --pr reject a GitLab MR URL), then drove teardown, session-start reconcile, and captain-hold flows against real scripts on isolated fixture homes for both the base commit (exported to a temp dir) and the target commit. Base reproduces the reported stuck loop exactly; target closes the row with the MR link in the body and no pending-close marker, replays old-format markers cleanly, keeps GitHub links on --pr unchanged, retains captain-held GitLab rows with the link as the deliverable, and closes an answered retain-mode pending close without any update --pr call while the later replay retires the marker without duplicating the note. Adversarially, a malformed pr= value is still refused by the pre-existing record validation (unchanged guard), and a non-merge-request https link is carried into the body as an MR line. Ran the three new tests plus seven related existing ones at the target commit (all pass) and the three new tests against the base commit (all fail with the reported errors). No UI surface, so no visual artifacts; CLI transcripts and persisted backlog state are the evidence. Worktree left clean.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Teardown of a ship whose pr= is a GitLab merge-request URL closes the backlog row with the link in the body and leaves no pending-close marker ✅ pass live 02-teardown-gitlab-TARGET-after-fix.txt (row state done, body "MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75&#34;, marker absent); base counterpart 01-teardown-gitlab-BASE-before-fix.txt re…
A pending-close marker left behind by the old code (arg=--pr, arg=<gitlab-mr-url>) is closed by the new session-start reconcile instead of retrying forever ✅ pass live 03-old-marker-replayed-by-new-bootstrap.txt (BOOTSTRAP_INFO closed the item, state done, marker absent, MR line in backlog.md)
A GitHub pull-request URL is still forwarded as --pr and recorded as the row's pr link (no regression) ✅ pass live 04-github-pr-still-forwarded-as-pr.txt (base and target identical: links pr:https://github.com/rnd/ai-chat/pull/75, row merged)
Captain-held GitLab ship: successful teardown retains the row with the merge-request link as its deliverable, and the captain's answer closes it ✅ pass live 06-captain-held-gitlab-retain-then-answer.txt (teardown exit 0, row queued/held with "Deliverable of the finished work: PR <mr>", answer -> state done with link preserved)
Crash window: retain-mode pending close carrying a GitLab MR is answered before replay; the answer never calls update --pr, closes the row with the link, and the later replay retires the marker withou… ✅ pass live 07-captain-answer-before-replay-gitlab.txt (tasks-axi call log shows done --note "MR <url>" and no update --pr; row done with one MR line; bootstrap replay -> marker absent, body unchanged)
Adversarial: a malformed pr= value is still refused before any close and the task records are retained; a non-merge-request https link is carried into the body rather than wedging the close ✅ pass live 05-adversarial-malformed-and-non-mr-links.txt (not-a-url-at-all -> 'invalid pending-close arguments', row in_flight, records retained; issues URL -> row done with MR line)
The new regression tests fail on the base commit and pass on the target commit ✅ pass live 10-new-tests-fail-on-base.txt (three 'not ok' with the reported tasks-axi error) and 09-targeted-tests-at-target.txt (all ok)
Evidence: Real tasks-axi rejects a GitLab MR URL on --pr (defect reproduction)

Source: Real tasks-axi rejects a GitLab MR URL on --pr (defect reproduction)

$ tasks-axi update ai-chat-mr75-ci --pr https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
error: "--pr must be an http(s) pull request URL ending in /pull/<number>"
code: VALIDATION_ERROR
exit=2
$ tasks-axi done ai-chat-mr75-ci --pr https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
error: Task pr link must be an http(s) pull request URL ending in /pull/<number>
code: VALIDATION_ERROR
exit=2
$ tasks-axi done ai-chat-mr75-ci --pr https://github.com/o/r/pull/75
ok: done ai-chat-mr75-ci -> Done (pr https://github.com/o/r/pull/75)
help[1]:
  - Run `tasks-axi ready --file=/tmp/nm-gitlab-stE6Q9/repro/backlog.md` to dispatch work unblocked by this
exit=0
Evidence: Teardown with GitLab MR at base commit: reported failure, lingering marker, reconcile loop

Source: Teardown with GitLab MR at base commit: reported failure, lingering marker, reconcile loop

\### [base] state before teardown: in_flight
\### [base] $ bin/fm-teardown.sh ai-chat-mr75-ci
error: ai-chat-mr75-ci's endpoint and local copy are cleaned up, but its backlog item could not be closed atomically (error: Task pr link must be an http(s) pull request URL ending in /pull/<number>); the pending close is recorded and the next session start retries it
\### exit=1
\### [base] row state after teardown: in_flight
\### [base] pending-close marker:
-rw-r--r--@ 1 valeriusmattfeld  staff  259 Sep 10 23:46 /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.ZKOZ8X/teardown-base/home/state/ai-chat-mr75-ci.backlog-close
--- marker contents ---
id=ai-chat-mr75-ci
data=/private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.ZKOZ8X/teardown-base/home/data
spawn_gen=s1789076815.10801.14601
cleanup_incomplete=0
arg=--pr
arg=https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
\### [base] second session start (bootstrap reconcile):
BACKLOG_RECONCILE: ai-chat-mr75-ci: recorded backlog close could not be replayed: error: Task pr link must be an http(s) pull request URL ending in /pull/<number>
\### [base] row state after bootstrap: in_flight
\### [base] marker after bootstrap: STILL PRESENT
\### [base] tasks-axi show ai-chat-mr75-ci --full:
task:
  id: ai-chat-mr75-ci
  title: item for ai-chat-mr75-ci
  state: in_flight
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: "-"
  priority: "-"
  created: 2026-09-10
  closed: "-"
  deps: none
  links: none
  body: ""
\### [base] data/backlog.md:
# Backlog

## In flight
- [ ] ai-chat-mr75-ci - item for ai-chat-mr75-ci (kind: ship) (since 2026-09-10)

## Queued
## Done
Evidence: Teardown with GitLab MR at target commit: row closed, MR line in body, no marker

Source: Teardown with GitLab MR at target commit: row closed, MR line in body, no marker

### [target] row state after teardown: done ### [target] pending-close marker: No such file or directory ## Done - [x] ai-chat-mr75-ci - item for ai-chat-mr75-ci (kind: ship) (done 2026-09-10) MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75

\### [target] state before teardown: in_flight
\### [target] $ bin/fm-teardown.sh ai-chat-mr75-ci
/private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.1u1b21/teardown-target/project: already current
teardown ai-chat-mr75-ci complete (window firstmate:fm-ai-chat-mr75-ci, worktree /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.1u1b21/teardown-target/wt)
Backlog: ai-chat-mr75-ci is closed in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.1u1b21/teardown-target/home/data/backlog.md. Run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
\### exit=0
\### [target] row state after teardown: done
\### [target] pending-close marker:
ls: /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.1u1b21/teardown-target/home/state/ai-chat-mr75-ci.backlog-close: No such file or directory
\### [target] second session start (bootstrap reconcile):
(no backlog-related output)
\### [target] row state after bootstrap: done
\### [target] marker after bootstrap: absent
\### [target] tasks-axi show ai-chat-mr75-ci --full:
task:
  id: ai-chat-mr75-ci
  title: item for ai-chat-mr75-ci
  state: done
  blocked: no
  blocked_by: none
  held: no
  hold_reason: "-"
  hold_kind: "-"
  hold_until: "-"
  kind: ship
  repo: "-"
  priority: "-"
  created: "-"
  closed: 2026-09-10
  deps: none
  links: none
  body: "MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75"
\### [target] data/backlog.md:
# Backlog

## In flight
## Queued
## Done
- [x] ai-chat-mr75-ci - item for ai-chat-mr75-ci (kind: ship) (done 2026-09-10)
  MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
Evidence: Old-code marker replayed by new bootstrap

Source: Old-code marker replayed by new bootstrap

\### OLD code: teardown leaves the marker behind
error: ai-chat-167-vitest-forks's endpoint and local copy are cleaned up, but its backlog item could not be closed atomically (error: Task pr link must be an http(s) pull request URL ending in /pull/<number>); the pending close is recorded and the next session start retries it
\### exit=0 state=in_flight
--- state/ai-chat-167-vitest-forks.backlog-close (written by OLD code) ---
id=ai-chat-167-vitest-forks
data=/private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.xTdH6E/migrate/home/data
spawn_gen=s1789076875.70382.30043
cleanup_incomplete=0
arg=--pr
arg=https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
\### NEW code: session start replays the old marker
BOOTSTRAP_INFO: closed the backlog item for ai-chat-167-vitest-forks that an interrupted cleanup left open
\### state after NEW bootstrap: done
\### marker after NEW bootstrap: absent
\### data/backlog.md:
# Backlog

## In flight
## Queued
## Done
- [x] ai-chat-167-vitest-forks - item for ai-chat-167-vitest-forks (kind: ship) (done 2026-09-10)
  MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
Evidence: GitHub PR link unchanged before/after

Source: GitHub PR link unchanged before/after

\### [github-base] meta pr=https://github.com/rnd/ai-chat/pull/75
\### [github-base] $ bin/fm-teardown.sh ai-chat-gh-1
teardown ai-chat-gh-1 complete (window firstmate:fm-ai-chat-gh-1, worktree /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.dKo71D/pr-github-base/wt)
Backlog: ai-chat-gh-1 is closed in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.dKo71D/pr-github-base/home/data/backlog.md. Run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
\### exit=0
\### [github-base] row state: done   marker: absent
\### [github-base] tasks-axi show --full (links/body):
  state: done
  links: "pr:https://github.com/rnd/ai-chat/pull/75"
  body: ""
\### [github-base] Done section of data/backlog.md:
## Done
- [x] ai-chat-gh-1 - item for ai-chat-gh-1 https://github.com/rnd/ai-chat/pull/75 (kind: ship) (merged 2026-09-10)

\### [github-target] meta pr=https://github.com/rnd/ai-chat/pull/75
\### [github-target] $ bin/fm-teardown.sh ai-chat-gh-1
teardown ai-chat-gh-1 complete (window firstmate:fm-ai-chat-gh-1, worktree /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.2Jm2mn/pr-github-target/wt)
Backlog: ai-chat-gh-1 is closed in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.2Jm2mn/pr-github-target/home/data/backlog.md. Run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
\### exit=0
\### [github-target] row state: done   marker: absent
\### [github-target] tasks-axi show --full (links/body):
  state: done
  links: "pr:https://github.com/rnd/ai-chat/pull/75"
  body: ""
\### [github-target] Done section of data/backlog.md:
## Done
- [x] ai-chat-gh-1 - item for ai-chat-gh-1 https://github.com/rnd/ai-chat/pull/75 (kind: ship) (merged 2026-09-10)
Evidence: Adversarial: malformed and non-MR links

Source: Adversarial: malformed and non-MR links

\### [malformed-target] meta pr=not-a-url-at-all
\### [malformed-target] $ bin/fm-teardown.sh ai-chat-junk-1
error: the pending backlog close for ai-chat-junk-1 could not be recorded (invalid pending-close arguments in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.DJ157D/pr-malformed-target/home/state/.ai-chat-junk-1.backlog-close.25770); retaining every durable task record
\### exit=1
\### [malformed-target] row state: in_flight   marker: absent
\### [malformed-target] tasks-axi show --full (links/body):
  state: in_flight
  links: none
  body: ""
\### [malformed-target] Done section of data/backlog.md:
## Done

\### [gitlab-self-hosted-issue] meta pr=https://git.ksb-intax.app/rnd/ai-chat/-/issues/12
\### [gitlab-self-hosted-issue] $ bin/fm-teardown.sh ai-chat-issue-1
teardown ai-chat-issue-1 complete (window firstmate:fm-ai-chat-issue-1, worktree /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.wmfwLq/pr-gitlab-self-hosted-issue/wt)
Backlog: ai-chat-issue-1 is closed in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-backlog-atomicity.wmfwLq/pr-gitlab-self-hosted-issue/home/data/backlog.md. Run tasks-axi ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
\### exit=0
\### [gitlab-self-hosted-issue] row state: done   marker: absent
\### [gitlab-self-hosted-issue] tasks-axi show --full (links/body):
  state: done
  links: none
  body: "MR https://git.ksb-intax.app/rnd/ai-chat/-/issues/12"
\### [gitlab-self-hosted-issue] Done section of data/backlog.md:
## Done
- [x] ai-chat-issue-1 - item for ai-chat-issue-1 (kind: ship) (done 2026-09-10)
  MR https://git.ksb-intax.app/rnd/ai-chat/-/issues/12
Evidence: Captain-held GitLab ship: retain then answer

Source: Captain-held GitLab ship: retain then answer

\### $ bin/fm-teardown.sh ai-chat-139-ratelimit-reset --force   (captain-held, pr=https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75)
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  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.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
teardown ai-chat-139-ratelimit-reset complete (window firstmate:fm-ai-chat-139-ratelimit-reset, worktree /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.UhdVJe/captain-retain-gitlab/projects/ai-chat-139-ratelimit-reset)
Backlog: ai-chat-139-ratelimit-reset stays open in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.UhdVJe/captain-retain-gitlab/data/backlog.md, still held for the captain with its deliverable recorded. Relay the question and close it only with bin/fm-captain-hold.sh answer.
\### exit=0
\### marker: absent
\### tasks-axi show ai-chat-139-ratelimit-reset --full (after teardown, before answer):
  state: queued
  held: yes
  hold_kind: captain
  links: none
  body: "Captain hold set: 2026-09-10T21:49:11Z\n\nDeliverable of the finished work: PR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75"
\### $ fm-captain-hold.sh answer ai-chat-139-ratelimit-reset
answered: ai-chat-139-ratelimit-reset
\### exit=0
\### tasks-axi show ai-chat-139-ratelimit-reset --full (after answer):
  state: done
  held: no
  hold_kind: captain
  links: none
  body: "Resolution recorded by fm-captain-hold.\nDecision digest: 913f3c040fd87577d3ac29bfc9a9eaa484e8e7817572cbdd69a8cf9096c16e3f\nResolution mode: answered\n\nCaptain decision:\nProceed with the merged result.\n\nDeliverable of the finished work: PR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75"
\### data/backlog.md Done section:
## Done
- [x] ai-chat-139-ratelimit-reset - Ship the merge request (repo: sample) (kind: ship) (done 2026-09-10) (hold: captain must choose after the merge request) (hold-kind: captain)
  Resolution recorded by fm-captain-hold.
  Decision digest: 913f3c040fd87577d3ac29bfc9a9eaa484e8e7817572cbdd69a8cf9096c16e3f
  Resolution mode: answered

  Captain decision:
  Proceed with the merged result.

  Deliverable of the finished work: PR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
Evidence: Answer before replay with tasks-axi call log, then replay retires marker

Source: Answer before replay with tasks-axi call log, then replay retires marker

\### $ bin/fm-teardown.sh ai-chat-143-itests --force   (treehouse fails -> cleanup interrupted after the pending close is recorded)
error: treehouse return failed for worktree /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.AxBm63/captain-answer-before-replay-gitlab/projects/ai-chat-143-itests; teardown aborted
\### exit=1
--- state/ai-chat-143-itests.backlog-close ---
id=ai-chat-143-itests
data=/private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.AxBm63/captain-answer-before-replay-gitlab/data
spawn_gen=fixture-ai-chat-143-itests
cleanup_incomplete=0
mode=retain
arg=--pr
arg=https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75
\### row before answer:
  state: in_flight
  held: yes
  links: none
  body: "Captain hold set: 2026-09-10T21:50:28Z"
\### $ fm-captain-hold.sh answer ai-chat-143-itests   (before any session-start replay)
answered: ai-chat-143-itests
\### exit=0
\### tasks-axi calls made by the answer:
tasks-axi update --help
tasks-axi update ai-chat-143-itests --body-file /var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T//fm-captain-hold-body.AduarT --archive-body --file /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.AxBm63/captain-answer-before-replay-gitlab/data/backlog.md
tasks-axi done ai-chat-143-itests --note MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75 --file /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.AxBm63/captain-answer-before-replay-gitlab/data/backlog.md
tasks-axi update ai-chat-143-itests --body-file /var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T//fm-captain-hold-normalize.vdgPGL --file /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.AxBm63/captain-answer-before-replay-gitlab/data/backlog.md
\### row after answer:
  state: done
  held: no
  links: none
  body: "Resolution recorded by fm-captain-hold.\nDecision digest: 913f3c040fd87577d3ac29bfc9a9eaa484e8e7817572cbdd69a8cf9096c16e3f\nResolution mode: answered\n\nCaptain decision:\nProceed with the merged result.\nMR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75"
\### marker after answer: PRESENT
\### replay at next session start (bootstrap):
(no backlog-related output)
\### row after replay:
  state: done
  held: no
  body: "Resolution recorded by fm-captain-hold.\nDecision digest: 913f3c040fd87577d3ac29bfc9a9eaa484e8e7817572cbdd69a8cf9096c16e3f\nResolution mode: answered\n\nCaptain decision:\nProceed with the merged result.\nMR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75"
\### marker after replay: absent
Evidence: Targeted tests at target commit

Source: Targeted tests at target commit

== tests/fm-backlog-atomicity.test.sh (targeted) ==
ok - completion records a GitLab merge-request link in the item body
ok - recovery closes a pending close carrying a GitLab merge-request link
ok - dispatch and completion transition structurally with evidence
ok - recovery rejects malformed PR URL values
ok - recovery rejects close-marker arguments outside its protocol
atomicity exit=0
== tests/fm-captain-hold-lifecycle.test.sh (targeted) ==
ok - an answer before cleanup replay skips a GitLab merge-request artifact
ok - an answer before cleanup replay preserves the retained report
ok - an interrupted cleanup keeps the captain call recoverable and session start retains it
ok - release and scout report retention distinguish deliveries from rejected merge answers
ok - an unusable pending-close record names its reason instead of a bare refusal
captain-hold exit=0
Evidence: New tests fail on base commit

Source: New tests fail on base commit

not ok - teardown with a merge-request link failed: error: fm-structural-gitlab-b15's endpoint and local copy are cleaned up, but its backlog item could not be closed atomically (error: Task pr link must be an http(s) pull request URL ending in /pull/<number>); the pending close is recorded and the next session start retries it
[base] test_completion_records_a_gitlab_merge_request_link_in_the_body exit=1
not ok - recovery did not close the row recorded with a merge-request link: BACKLOG_RECONCILE: atomic-heal-gitlab-b9: recorded backlog close could not be replayed: error: Task pr link must be an http(s) pull request URL ending in /pull/<number>
MISSING: treehouse (install: curl -fsSL https://kunchenguid.github.io/treehouse/install.sh | sh)
MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/kunchenguid/no-mistakes/main/docs/install.sh | sh)
[base] test_recovery_closes_a_pending_close_carrying_a_gitlab_merge_request_link exit=1
fm-captain-hold: cannot apply the artifact recorded for sample-answer-before-replay-gitlab in /private/var/folders/wz/dfpbtyzn3j9b2nzb1pcpm0j40000gn/T/fm-captain-hold.Yi4joF/answer-before-replay-gitlab/state/sample-answer-before-replay-gitlab.backlog-close: error: "--pr must be an http(s) pull request URL ending in /pull/<number>"
fm-captain-hold: could not close answered captain-held task sample-answer-before-replay-gitlab
not ok - the merge-request record wedged the captain's answer before replay
[base] test_answer_before_cleanup_replay_skips_a_gitlab_merge_request_artifact exit=1

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 issues (1 warning, 1 info)
  • ⚠️ bin/fm-backlog-transition-lib.sh:548 - The change classifies the --pr value in fm_backlog_done and fm_backlog_retain, but fm_backlog_row_artifact_supported (bin/fm-backlog-transition-lib.sh:548) still returns 0 for every --pr, and bin/fm-captain-hold.sh:907-908 uses it as the gate before running fm_backlog_mutate update --pr &lt;url&gt; from a validated retain-mode pending-close record. Concrete sequence: a GitLab ship whose row is captain-held is torn down; teardown publishes state/&lt;id&gt;.backlog-close with mode=retain, arg=--pr, arg=https://git.ksb-intax.app/.../-/merge_requests/75 and is killed during cleanup before the record is retired (the crash window the record exists for). The captain answers the hold before the next session start replays it: apply_pending_retained_artifact validates the record, the artifact gate accepts --pr, tasks-axi update --pr rejects the merge-request URL, and close_answered fails with 'cannot apply the artifact recorded for <id>', so the answer cannot close the row. This contradicts the new FORGE LINKS comment (line 61) that every forwarded --pr is classified. Smallest remedy: make the --pr arm of fm_backlog_row_artifact_supported return fm_backlog_pr_flag_supported "$value" so a non-GitHub link is skipped (the deliverable line already carries it in the body) and the answer proceeds to done.

🔧 Fix applied.
2 issues (1 warning, 1 info) still open:

  • ⚠️ bin/fm-captain-hold.sh:923 - The fix round exceeded the round-1 instruction. That instruction prescribed only skipping the update --pr for a GitLab link on the answered close ("the deliverable line in the body already carries it"). Instead the round added the PENDING_CLOSE_ARGS global (lines 899, 912) and routes the answered close through fm_backlog_done &#34;$DATA&#34; &#34;$1&#34; --pr &lt;mr&gt;, which fm_backlog_done rewrites to tasks-axi done --note &#34;MR &lt;mr&gt;&#34;. I verified the extension is functionally sound: with the real tasks-axi, done --note appends the line to the body, keeps the resolution record written by write_resolution_record, and a repeated done with the same note does not duplicate it, so the post-close body_has_resolution_record check and later replay both hold. The reason the extension matters: a mode=retain pending-close record exists exactly when the retain transition has NOT yet run (teardown returns the worktree at bin/fm-teardown.sh:3233 before running the transition at :3364, and the new test reproduces this by failing treehouse), so in that window the body has no deliverable line and the prescribed minimal form would close the row with the MR link dropped entirely. Decision needed from the author: keep this carry-through (my recommendation, it matches the FORGE LINKS contract that "the link survives") or revert to the prescribed minimal skip and accept the link loss in the crash window. The remedy choice, not a defect, is what needs authorization.
  • ℹ️ bin/fm-backlog-transition-lib.sh:580 - fm_backlog_retain records a GitLab merge-request link in the deliverable line as PR &lt;url&gt;, while the close path (fm_backlog_done) records the same link as MR &lt;url&gt;. A row that is retained and later answered before replay ends up with both lines, so the same link appears twice under two labels. Harmless for closing and for the link surviving; noted only because docs/configuration.md now promises an MR &lt;url&gt; line and the retain path does not produce that spelling.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Teardown of a ship whose pr= is a GitLab merge-request URL closes the backlog row with the link in the body and leaves no pending-close marker ✅ pass live 02-teardown-gitlab-TARGET-after-fix.txt (row state done, body "MR https://git.ksb-intax.app/rnd/ai-chat/-/merge_requests/75&#34;, marker absent); base counterpart 01-teardown-gitlab-BASE-before-fix.txt re…
A pending-close marker left behind by the old code (arg=--pr, arg=<gitlab-mr-url>) is closed by the new session-start reconcile instead of retrying forever ✅ pass live 03-old-marker-replayed-by-new-bootstrap.txt (BOOTSTRAP_INFO closed the item, state done, marker absent, MR line in backlog.md)
A GitHub pull-request URL is still forwarded as --pr and recorded as the row's pr link (no regression) ✅ pass live 04-github-pr-still-forwarded-as-pr.txt (base and target identical: links pr:https://github.com/rnd/ai-chat/pull/75, row merged)
Captain-held GitLab ship: successful teardown retains the row with the merge-request link as its deliverable, and the captain's answer closes it ✅ pass live 06-captain-held-gitlab-retain-then-answer.txt (teardown exit 0, row queued/held with "Deliverable of the finished work: PR <mr>", answer -> state done with link preserved)
Crash window: retain-mode pending close carrying a GitLab MR is answered before replay; the answer never calls update --pr, closes the row with the link, and the later replay retires the marker withou… ✅ pass live 07-captain-answer-before-replay-gitlab.txt (tasks-axi call log shows done --note "MR <url>" and no update --pr; row done with one MR line; bootstrap replay -> marker absent, body unchanged)
Adversarial: a malformed pr= value is still refused before any close and the task records are retained; a non-merge-request https link is carried into the body rather than wedging the close ✅ pass live 05-adversarial-malformed-and-non-mr-links.txt (not-a-url-at-all -> 'invalid pending-close arguments', row in_flight, records retained; issues URL -> row done with MR line)
The new regression tests fail on the base commit and pass on the target commit ✅ pass live 10-new-tests-fail-on-base.txt (three 'not ok' with the reported tasks-axi error) and 09-targeted-tests-at-target.txt (all ok)
  • tasks-axi update &lt;id&gt; --pr &lt;gitlab-mr-url&gt; and tasks-axi done &lt;id&gt; --pr &lt;gitlab-mr-url&gt; against real tasks-axi 0.2.5 (both rejected, GitHub URL accepted)
  • bin/fm-teardown.sh &lt;id&gt; with meta pr=<gitlab-mr-url> at base commit 56e91ac (fails, marker left, bootstrap BACKLOG_RECONCILE retries and fails) and at target commit 7df5917 (closes, MR line in body, no marker)
  • old-code marker (written by base fm-teardown.sh) replayed by target bin/fm-bootstrap.sh (row closed, marker retired)
  • bin/fm-teardown.sh &lt;id&gt; with meta pr=https://github.com/.../pull/75 at base and target (identical: pr link recorded, row merged)
  • bin/fm-teardown.sh &lt;id&gt; with meta pr=not-a-url-at-all (refused by pending-close validation, record retained) and pr=<gitlab issues URL> (closed, carried as MR line)
  • captain-held GitLab ship: bin/fm-teardown.sh &lt;id&gt; --force retains the row with deliverable PR &lt;mr&gt;, then bin/fm-captain-hold.sh answer closes it
  • interrupted cleanup (treehouse fails) with a retain-mode pending close carrying a GitLab MR, then bin/fm-captain-hold.sh answer before replay: logged every tasks-axi call (no update --pr, one done --note &#34;MR &lt;url&gt;&#34;), row done with link, then bin/fm-bootstrap.sh replay retires the marker without duplicating the note
  • tests/fm-backlog-atomicity.test.sh: test_completion_records_a_gitlab_merge_request_link_in_the_body, test_recovery_closes_a_pending_close_carrying_a_gitlab_merge_request_link, test_dispatch_and_completion_are_structural, test_recovery_rejects_malformed_pr_urls, test_recovery_rejects_invalid_close_arguments (target: all ok)
  • tests/fm-captain-hold-lifecycle.test.sh: test_answer_before_cleanup_replay_skips_a_gitlab_merge_request_artifact, test_answer_before_cleanup_replay_preserves_the_retained_report, test_interrupted_cleanup_keeps_the_captain_call_recoverable, test_retained_row_artifacts_survive_captain_answers, test_unusable_pending_close_record_names_its_reason (target: all ok)
  • the three new tests executed against the base commit's scripts (all three fail with the reported tasks-axi validation error)
✅ **Document** - passed

✅ No issues found.

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

✅ No issues found.

Valerius Mattfeld added 3 commits September 10, 2026 23:28
…close

tasks-axi's --pr flag accepts GitHub pull-request URLs only, so a teardown
whose recorded pr= was a GitLab merge-request URL failed its done transition
and left a pending close that every session start retried and failed again.

Classify every --pr the transition library forwards through fm-pr-lib's
provider parse: a GitHub link stays --pr, any other link becomes a
`--note "MR <url>"` on close and stays off the row flags on retention,
where the deliverable line already carries it. Pending-close records keep
their original --pr pair and are rewritten when applied, so the closes an
older teardown left behind replay without hand edits.

Cover both the teardown and the replay path with a GitLab URL, and replace
the manual body-note guidance in docs/configuration.md with the automatic
behavior.
@valerius21
valerius21 merged commit 2c0d612 into main Sep 14, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant