Repository navigation
fix(bin): carry GitLab merge-request links into the backlog body on close - #2
Merged
Merged
Conversation
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.
…into answered close
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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--prvalidation (external npm tool, GitHub-only) rejects, both intasks-axi update --prand 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.shnow classifies every--prvalue it forwards throughfm-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>"ondoneand 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.shapplies the same gate when answering a call with a validated retain-mode pending-close record: a GitHub--pror report is still written viaupdate, while a GitLab--pris handed tofm_backlog_doneso the answered close carries it into the body instead of dropping it or erroring.tests/fm-backlog-atomicity.test.shandtests/fm-captain-hold-lifecycle.test.sh;docs/configuration.mdanddocs/captain-hold-lifecycle.mddescribe the automaticMR <url>carry-through.Risk Assessment
✅ Low: The change is bounded to classifying
--prlinks through the existing provider parser, every forwarded--prpath (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.
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)
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
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/75Evidence: Old-code marker replayed by new bootstrap
Source: Old-code marker replayed by new bootstrap
Evidence: GitHub PR link unchanged before/after
Source: GitHub PR link unchanged before/after
Evidence: Adversarial: malformed and non-MR links
Source: Adversarial: malformed and non-MR links
Evidence: Captain-held GitLab ship: retain then answer
Source: Captain-held GitLab ship: retain then answer
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
Evidence: Targeted tests at target commit
Source: Targeted tests at target commit
Evidence: New tests fail on base commit
Source: New tests fail on base commit
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-backlog-transition-lib.sh:548- The change classifies the--prvalue 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 runningfm_backlog_mutate update --pr <url>from a validated retain-mode pending-close record. Concrete sequence: a GitLab ship whose row is captain-held is torn down; teardown publishesstate/<id>.backlog-closewithmode=retain,arg=--pr,arg=https://git.ksb-intax.app/.../-/merge_requests/75and 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-axiupdate --prrejects 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--pris classified. Smallest remedy: make the--prarm 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 todone.🔧 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 theupdate --prfor 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 throughfm_backlog_done "$DATA" "$1" --pr <mr>, which fm_backlog_done rewrites totasks-axi done --note "MR <mr>". I verified the extension is functionally sound: with the real tasks-axi,done --noteappends the line to the body, keeps the resolution record written by write_resolution_record, and a repeateddonewith 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: amode=retainpending-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 asPR <url>, while the close path (fm_backlog_done) records the same link asMR <url>. 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 anMR <url>line and the retain path does not produce that spelling.✅ **Test** - passed
✅ No issues found.
tasks-axi update <id> --pr <gitlab-mr-url>andtasks-axi done <id> --pr <gitlab-mr-url>against real tasks-axi 0.2.5 (both rejected, GitHub URL accepted)bin/fm-teardown.sh <id>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 targetbin/fm-bootstrap.sh(row closed, marker retired)bin/fm-teardown.sh <id>with meta pr=https://github.com/.../pull/75 at base and target (identical: pr link recorded, row merged)bin/fm-teardown.sh <id>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 <id> --forceretains the row with deliverablePR <mr>, thenbin/fm-captain-hold.sh answercloses itinterrupted cleanup (treehouse fails) with a retain-mode pending close carrying a GitLab MR, thenbin/fm-captain-hold.sh answerbefore replay: logged every tasks-axi call (noupdate --pr, onedone --note "MR <url>"), row done with link, thenbin/fm-bootstrap.shreplay retires the marker without duplicating the notetests/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.
✅ **Push** - passed
✅ No issues found.