Repository navigation
feat(crew): park ship lanes while awaiting review - #7965
Conversation
[Medium impact] The PR appears safe to merge, with no new blocking findings established. Reviews (30) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
|
Speaking as Kun's firstmate: thank you @Dematom1. This is a substantial piece of work, and the live gate runs against real GitHub PRs and GitLab MRs are good evidence. I've approved the first CI runs on this head. I read the diff first: no workflow or credential changes, and the tests stub I read the tip
VISION: aligns on peace of mind, fewer idle sessions, restart-safe park records, staying vendor-neutral (GitHub plus GitLab) and scripts owning the mechanics. On "authority is explicit" it does not align as written, because default-on auto-land assumes consent. The open P1s mean "workers are supervised" isn't settled yet. The |
994803e to
3bd7629
Compare
|
Speaking as Kun's firstmate: thank you @Dematom1. That's a lot of careful follow-through in one afternoon. Every Greptile finding is answered and resolved, and Greptile scores Delta since my last stamp (2026-10-29T18:19Z): new head Still open on this head (waiting on you):
The default is still a captain decision: merge-time cleanup is on by default for every ship lane ( VISION: aligns on peace of mind (fewer idle sessions, lanes don't fall through the cracks after merge), restart safety (durable pending/parked records), scripts owning the mechanics, and staying vendor-neutral (GitHub and GitLab). It does not align as written on "authority is explicit", because default-on auto-land assumes consent. "Workers are supervised" is closer but still has the open warnings above. The |
1637c54 to
91a6515
Compare
|
Speaking as Kun's firstmate: thank you @Dematom1. The new head
I read the diff again: no workflow, network, or credential changes, forge reads only through Still open on this head (waiting on you):
Please fix or answer those and re-raise with Still a captain decision once it's ready: auto-parking stays opt-in through |
|
Speaking as Kun's firstmate: thank you @Dematom1. The new head
Still waiting on you:
Contract class: with both flags off by default, I'm provisionally treating this as opt-in. Before it can merge I still need to finish reading the unconfigured path: the watcher now calls (The red "Full suite" check is our label gate for outside PRs, not something you need to fix.) |
|
Speaking as Kun's firstmate: a quick heads-up, @zestysoft. #7996 (also yours) fixes the same |
633f451 to
ed27912
Compare
|
Live evidence for the park-on-review scenarios you asked about, re-driven on this PR's head Focused suites on 1. An automated reviewer has not reviewed the current head -> no parkGreptile reviewed an older commit on each of these PRs. With the quiet window still open over the head's real CI finish, the gate refuses and names the reviewer. Once the default 900s window has passed, the head reads clean, which is the designed fallback. 2. Required-check gate
3. Pending park record recovery (real worker)The park is killed with SIGKILL right after it writes its pending record. In the first run, the stop it already started still reaches the agent: the record reads as "parking" until the next tick, which promotes it to parked. In the second run, the stop never reaches the still-running agent: the next tick drops the record and the lane reads done again. Unconfigured path, for your reading. With neither The three unconditional changes:
The two P1s on
A third P1 on The rotate/slow-relaunch test failures in the last Test step were a real flake in the tests, not the product: with Lint on |
|
Speaking as Kun's firstmate: thanks @Dematom1. First, a correction: my 18:33Z heads-up on this PR was addressed to the wrong person. #7996 is @zestysoft's, not yours. Its point still holds: #7996 fixes the same On head Still waiting on you: the live evidence. The "live 2/2" rows on this head are contract-class: opt-in (provisional, unchanged). I'll finish the unconfigured-path read when the evidence is in. VISION: unchanged from my last note. Waiting on you, not on Kun. |
|
The live transcripts for all three scenarios at bbc4f279 are in the comment just above (posted 22s before yours). |
|
Speaking as Kun's firstmate: thanks @Dematom1, and I'm sorry. My 22:30Z note asked for live evidence you had already posted 22 seconds earlier. Your transcripts are exactly what I asked for. All three scenarios were driven on
The focused suites finished green too (park 28/28 ×3, teardown 151/151, relaunch 90/90, check-security 50/50). Unconfigured path (my own read): contract-class: new-default (this replaces my provisional opt-in, because of that teardown path). Parking and auto-land themselves are opt-in. VISION.md: aligns. Parking is off unless the captain opts in, and a manual Overlap with #7996: #7996 merged as |
bbc4f27 to
792aa84
Compare
…fied stop and replacement-agent support before lease or record creation. Added a Zellij regression test; `bash tests/fm-park.test.sh` and `git diff --check` pass
# Conflicts: # docs/scripts.md
|
Speaking as Kun's firstmate: thanks @Dematom1. I re-read Where it stands: waiting on you for two things.
I've left the |
…portable parallel set and rebalancing its lanes; retained teardown status-4 slot/path details in saved land reports with a regression test. Updated scheduling evidence docs. Verified coverage guard (27 parallel; max 850004 ms), fm-park tests, and doc audience check. fm-test-run tests passed scheduling/coverage checks but timed out at 600s before the suite completed
|
Speaking as Kun's firstmate: thanks @Dematom1. Both of my asks from the last round are done on
I checked the opt-in boundary again against current main The only red lane in run 42854885272 is Status: waiting on us, not on you. We'll rerun the full suite once main's fix for #8325 lands. If that run is green and nothing else changes, this is ready to land under the opt-in rules. You don't need to do anything. I've left the |
# Conflicts: # bin/fm-teardown.sh # docs/scripts.md
|
Speaking as Kun's firstmate: this is merged. Thank you @Dematom1 — really appreciate you taking the time on this. |
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* feat: park ship lanes on review and clean them up on merge
Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.
Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.
Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
change after the verdict, park preflight refusals, the lease, every relaunch
trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
fm-teardown: park with the slot leased (a concurrent get received another
slot), a review comment relaunched a fresh worker in the same copy, re-park,
and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
and read a merge-train squash-merged GitLab MR (main got a commit other than
the MR head) as merged.
Refs kunchenguid#7938
* no-mistakes(review): Harden park gate, bound tick, default merge cleanup
* no-mistakes(document): Inventory park-on-review config flags and state records
* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh
* fix(park): write the park record pending before the stop and settle it on tick
cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.
The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.
* fix(park): bound the pending-park agent check by the tick budget
settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.
* fix(park): require every required check reported, relaunch on inline replies
The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.
* fix(park): run lane actions detached so no budget cuts them short
Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.
The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.
* no-mistakes(document): Document review parking and merge cleanup
* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified
* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed
* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass
* test(park): wait for the pending cleanup request to clear before asserting
A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.
* fix(park): bind cleanup requests to their PR and record wakes before removing reports
A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.
The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.
The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.
* no-mistakes(document): Document park-on-review safety behavior
* fix(park): keep the cleanup request until its outcome is saved
Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.
* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)
* Preserve PR poll authentication on relaunch
* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* fix(spawn): reuse main PR metadata rewrite helper
* no-mistakes(review): Count unresolved GitLab notes individually
* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads
* no-mistakes(document): Document park-on-review behavior
* fix(park): paginate GitHub comments and fix Linux mode test
* no-mistakes(review): Set private permissions on cleanup requests
* no-mistakes(document): Correct park-on-review cleanup documentation
* fix(park): serialize inbox delivery with review parking
* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* feat: park ship lanes on review and clean them up on merge
Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.
Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.
Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
change after the verdict, park preflight refusals, the lease, every relaunch
trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
fm-teardown: park with the slot leased (a concurrent get received another
slot), a review comment relaunched a fresh worker in the same copy, re-park,
and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
and read a merge-train squash-merged GitLab MR (main got a commit other than
the MR head) as merged.
Refs kunchenguid#7938
* no-mistakes(review): Harden park gate, bound tick, default merge cleanup
* no-mistakes(document): Inventory park-on-review config flags and state records
* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh
* fix(park): write the park record pending before the stop and settle it on tick
cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.
The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.
* fix(park): bound the pending-park agent check by the tick budget
settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.
* fix(park): require every required check reported, relaunch on inline replies
The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.
* fix(park): run lane actions detached so no budget cuts them short
Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.
The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.
* no-mistakes(document): Document review parking and merge cleanup
* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified
* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed
* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass
* test(park): wait for the pending cleanup request to clear before asserting
A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.
* fix(park): bind cleanup requests to their PR and record wakes before removing reports
A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.
The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.
The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.
* no-mistakes(document): Document park-on-review safety behavior
* fix(park): keep the cleanup request until its outcome is saved
Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.
* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)
* Preserve PR poll authentication on relaunch
* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* fix(spawn): reuse main PR metadata rewrite helper
* no-mistakes(review): Count unresolved GitLab notes individually
* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads
* no-mistakes(document): Document park-on-review behavior
* fix(park): paginate GitHub comments and fix Linux mode test
* no-mistakes(review): Set private permissions on cleanup requests
* no-mistakes(document): Correct park-on-review cleanup documentation
* fix(park): serialize inbox delivery with review parking
* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing
* no-mistakes(review): Document GitLab pagination completeness invariant
* no-mistakes(review): Remove duplicate temporary park test suite
* no-mistakes(review): Strengthen relaunch and inbox lock regressions
* no-mistakes(review): Keep merge poll armed when cleanup queueing fails
* no-mistakes(review): Preserve pending parks and merge cleanup retries
* no-mistakes(review): Test merged-poll cleanup queue retries
* no-mistakes(review): Retain cleanup request when outcome reporting fails
* no-mistakes(document): Fix park-on-review documentation links
* fix(park): relaunch a pending park only once its stop is confirmed
A pending record now stays pending while its agent reads alive, so feedback could relaunch over a worker whose park never finished. Hold every trigger until the stop is confirmed, for a live agent and an unreadable one alike.
Update the preflight test to expect the record to stay pending and expire at the stop bound, fix gh_fixture's review count for extra_reviews, and make the interrupted-alive and interrupted-unreadable cases wait out the detached relaunch they rule out.
* no-mistakes(review): Fix same-second relaunches and synchronize detached tests
* no-mistakes(document): Clarify park-on-review documentation ownership
* no-mistakes(ci): Applied the GitLab incomplete-discussions handling and outage distinction in `bin/fm-park.sh`, with corresponding test updates. Verification failed: `FM_LIVE=0 bash tests/fm-park.test.sh` reported 3/32 failures; specifically, the failed-page parked-lane relaunch was not observed within the test timeout. Fix/test remains incomplete
* test(park): write real newlines in the GitLab relaunch fixtures
The fixtures used a doubled backslash, so the record held one line, parked_at could not be read, and the tick skipped the lane. The relaunch assertion could not pass, and the outage assertion passed without reaching the forge read.
* no-mistakes(review): Synchronize detached teardown timing test
* no-mistakes(ci): Added the measured `fm-park.test.sh` serial hint and provenance; moved closed-PR reporting ahead of the idle-worker check and added a busy-worker regression. Coverage guard passed (43/290 unhinted), and `FM_LIVE=0 bash tests/fm-park.test.sh` passed. `tests/fm-test-run.test.sh` reached the shard-coverage cases but timed out during a later case; `git diff --check` passed
* fix(teardown): gate GitLab merged-MR landed-work proof on park-on-review opt-in
Teardown accepts a merged GitLab merge request (squash or merge train) as
landed work only when config/park-on-review or config/auto-land exists.
Without either flag a GitLab MR goes through the same read as on main.
* no-mistakes(ci): Fixed park preflight to reject backends lacking verified stop and replacement-agent support before lease or record creation. Added a Zellij regression test; `bash tests/fm-park.test.sh` and `git diff --check` pass
* no-mistakes(ci): Fixed CI coverage by moving fm-park into the proven portable parallel set and rebalancing its lanes; retained teardown status-4 slot/path details in saved land reports with a regression test. Updated scheduling evidence docs. Verified coverage guard (27 parallel; max 850004 ms), fm-park tests, and doc audience check. fm-test-run tests passed scheduling/coverage checks but timed out at 600s before the suite completed
---------
Co-authored-by: Ian Brown <[email protected]>
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* feat: park ship lanes on review and clean them up on merge
Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.
Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.
Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
change after the verdict, park preflight refusals, the lease, every relaunch
trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
fm-teardown: park with the slot leased (a concurrent get received another
slot), a review comment relaunched a fresh worker in the same copy, re-park,
and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
and read a merge-train squash-merged GitLab MR (main got a commit other than
the MR head) as merged.
Refs kunchenguid#7938
* no-mistakes(review): Harden park gate, bound tick, default merge cleanup
* no-mistakes(document): Inventory park-on-review config flags and state records
* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh
* fix(park): write the park record pending before the stop and settle it on tick
cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.
The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.
* fix(park): bound the pending-park agent check by the tick budget
settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.
* fix(park): require every required check reported, relaunch on inline replies
The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.
* fix(park): run lane actions detached so no budget cuts them short
Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.
The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.
* no-mistakes(document): Document review parking and merge cleanup
* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified
* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed
* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass
* test(park): wait for the pending cleanup request to clear before asserting
A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.
* fix(park): bind cleanup requests to their PR and record wakes before removing reports
A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.
The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.
The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.
* no-mistakes(document): Document park-on-review safety behavior
* fix(park): keep the cleanup request until its outcome is saved
Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.
* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)
* Preserve PR poll authentication on relaunch
* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* fix(spawn): reuse main PR metadata rewrite helper
* no-mistakes(review): Count unresolved GitLab notes individually
* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads
* no-mistakes(document): Document park-on-review behavior
* fix(park): paginate GitHub comments and fix Linux mode test
* no-mistakes(review): Set private permissions on cleanup requests
* no-mistakes(document): Correct park-on-review cleanup documentation
* fix(park): serialize inbox delivery with review parking
* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* feat: park ship lanes on review and clean them up on merge
Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.
Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.
Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
change after the verdict, park preflight refusals, the lease, every relaunch
trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
fm-teardown: park with the slot leased (a concurrent get received another
slot), a review comment relaunched a fresh worker in the same copy, re-park,
and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
and read a merge-train squash-merged GitLab MR (main got a commit other than
the MR head) as merged.
Refs kunchenguid#7938
* no-mistakes(review): Harden park gate, bound tick, default merge cleanup
* no-mistakes(document): Inventory park-on-review config flags and state records
* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh
* fix(park): write the park record pending before the stop and settle it on tick
cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.
The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.
* fix(park): bound the pending-park agent check by the tick budget
settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.
* fix(park): require every required check reported, relaunch on inline replies
The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.
* fix(park): run lane actions detached so no budget cuts them short
Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.
The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.
* no-mistakes(document): Document review parking and merge cleanup
* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified
* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed
* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass
* test(park): wait for the pending cleanup request to clear before asserting
A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.
* fix(park): bind cleanup requests to their PR and record wakes before removing reports
A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.
The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.
The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.
* no-mistakes(document): Document park-on-review safety behavior
* fix(park): keep the cleanup request until its outcome is saved
Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.
* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)
* Preserve PR poll authentication on relaunch
* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* fix(spawn): reuse main PR metadata rewrite helper
* no-mistakes(review): Count unresolved GitLab notes individually
* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads
* no-mistakes(document): Document park-on-review behavior
* fix(park): paginate GitHub comments and fix Linux mode test
* no-mistakes(review): Set private permissions on cleanup requests
* no-mistakes(document): Correct park-on-review cleanup documentation
* fix(park): serialize inbox delivery with review parking
* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing
* no-mistakes(review): Document GitLab pagination completeness invariant
* no-mistakes(review): Remove duplicate temporary park test suite
* no-mistakes(review): Strengthen relaunch and inbox lock regressions
* no-mistakes(review): Keep merge poll armed when cleanup queueing fails
* no-mistakes(review): Preserve pending parks and merge cleanup retries
* no-mistakes(review): Test merged-poll cleanup queue retries
* no-mistakes(review): Retain cleanup request when outcome reporting fails
* no-mistakes(document): Fix park-on-review documentation links
* fix(park): relaunch a pending park only once its stop is confirmed
A pending record now stays pending while its agent reads alive, so feedback could relaunch over a worker whose park never finished. Hold every trigger until the stop is confirmed, for a live agent and an unreadable one alike.
Update the preflight test to expect the record to stay pending and expire at the stop bound, fix gh_fixture's review count for extra_reviews, and make the interrupted-alive and interrupted-unreadable cases wait out the detached relaunch they rule out.
* no-mistakes(review): Fix same-second relaunches and synchronize detached tests
* no-mistakes(document): Clarify park-on-review documentation ownership
* no-mistakes(ci): Applied the GitLab incomplete-discussions handling and outage distinction in `bin/fm-park.sh`, with corresponding test updates. Verification failed: `FM_LIVE=0 bash tests/fm-park.test.sh` reported 3/32 failures; specifically, the failed-page parked-lane relaunch was not observed within the test timeout. Fix/test remains incomplete
* test(park): write real newlines in the GitLab relaunch fixtures
The fixtures used a doubled backslash, so the record held one line, parked_at could not be read, and the tick skipped the lane. The relaunch assertion could not pass, and the outage assertion passed without reaching the forge read.
* no-mistakes(review): Synchronize detached teardown timing test
* no-mistakes(ci): Added the measured `fm-park.test.sh` serial hint and provenance; moved closed-PR reporting ahead of the idle-worker check and added a busy-worker regression. Coverage guard passed (43/290 unhinted), and `FM_LIVE=0 bash tests/fm-park.test.sh` passed. `tests/fm-test-run.test.sh` reached the shard-coverage cases but timed out during a later case; `git diff --check` passed
* fix(teardown): gate GitLab merged-MR landed-work proof on park-on-review opt-in
Teardown accepts a merged GitLab merge request (squash or merge train) as
landed work only when config/park-on-review or config/auto-land exists.
Without either flag a GitLab MR goes through the same read as on main.
* no-mistakes(ci): Fixed park preflight to reject backends lacking verified stop and replacement-agent support before lease or record creation. Added a Zellij regression test; `bash tests/fm-park.test.sh` and `git diff --check` pass
* no-mistakes(ci): Fixed CI coverage by moving fm-park into the proven portable parallel set and rebalancing its lanes; retained teardown status-4 slot/path details in saved land reports with a regression test. Updated scheduling evidence docs. Verified coverage guard (27 parallel; max 850004 ms), fm-park tests, and doc audience check. fm-test-run tests passed scheduling/coverage checks but timed out at 600s before the suite completed
---------
Co-authored-by: Ian Brown <[email protected]>
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* feat: park ship lanes on review and clean them up on merge
Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.
Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.
Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
change after the verdict, park preflight refusals, the lease, every relaunch
trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
fm-teardown: park with the slot leased (a concurrent get received another
slot), a review comment relaunched a fresh worker in the same copy, re-park,
and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
and read a merge-train squash-merged GitLab MR (main got a commit other than
the MR head) as merged.
Refs kunchenguid#7938
* no-mistakes(review): Harden park gate, bound tick, default merge cleanup
* no-mistakes(document): Inventory park-on-review config flags and state records
* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh
* fix(park): write the park record pending before the stop and settle it on tick
cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.
The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.
* fix(park): bound the pending-park agent check by the tick budget
settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.
* fix(park): require every required check reported, relaunch on inline replies
The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.
* fix(park): run lane actions detached so no budget cuts them short
Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.
The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.
* no-mistakes(document): Document review parking and merge cleanup
* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified
* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed
* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass
* test(park): wait for the pending cleanup request to clear before asserting
A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.
* fix(park): bind cleanup requests to their PR and record wakes before removing reports
A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.
The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.
The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.
* no-mistakes(document): Document park-on-review safety behavior
* fix(park): keep the cleanup request until its outcome is saved
Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.
* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)
* Preserve PR poll authentication on relaunch
* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* fix(spawn): reuse main PR metadata rewrite helper
* no-mistakes(review): Count unresolved GitLab notes individually
* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads
* no-mistakes(document): Document park-on-review behavior
* fix(park): paginate GitHub comments and fix Linux mode test
* no-mistakes(review): Set private permissions on cleanup requests
* no-mistakes(document): Correct park-on-review cleanup documentation
* fix(park): serialize inbox delivery with review parking
* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* feat: park ship lanes on review and clean them up on merge
Add bin/fm-park.sh: a clean-state gate (GitHub and GitLab) that parks a lane
only when CI is green on the current head, review bots have posted on it or a
quiet window passed, no thread is unresolved, nothing conflicts, and the PR is
not a draft; a park that re-reads the forge bound to the recorded head before
stopping the agent through fm-control, durably leases the Treehouse slot (a
re-park reuses the lane's own lease), and records the lane; a watcher tick that
relaunches a fresh worker on review activity and reports closed PRs once; and
merge-time cleanup through fm-teardown from the watcher's merged path. The
watcher starts fm-park only when a lane is parked or parking is configured.
Teach teardown's landed proof to read GitLab merge requests and fetch
refs/merge-requests/<n>/head, so squash and merge-train merges are recognized
from the MR head.
Local proof:
- tests/fm-park.test.sh (13 tests) covers each unclean gate condition, a head
change after the verdict, park preflight refusals, the lease, every relaunch
trigger, closed reporting, the opt-ins and merge cleanup.
- An isolated lab home (Herdr lab session, faked forge, real Treehouse pool)
ran a full cycle through the real fm-pr-check, fm-park, fm-watch and
fm-teardown: park with the slot leased (a concurrent get received another
slot), a review comment relaunched a fresh worker in the same copy, re-park,
and on merge the watcher tore the lane down and returned the copy.
- A read-only gate run against live lanes in other homes refused lanes with
pending CI, unresolved threads or uncomputed mergeability, passed clean ones,
and read a merge-train squash-merged GitLab MR (main got a commit other than
the MR head) as merged.
Refs kunchenguid#7938
* no-mistakes(review): Harden park gate, bound tick, default merge cleanup
* no-mistakes(document): Inventory park-on-review config flags and state records
* no-mistakes(ci): I made fixes for all six Greptile findings (ci-1 to ci-6). One existing watcher test now fails because of the ci-1 change and needs your decision. Fixes: - **ci-1, merge cleanup skipped** (bin/fm-watch.sh): the merge poll now runs `fm-park.sh land` even when bin/fm-pr-merge.sh recorded the merge first. The cleanup outcome wakes the captain under the queue key `land-<id>`. New test `test_self_merged_lane_is_still_cleaned_up_by_the_poll` in tests/fm-pr-check-security.test.sh. - **ci-2, old CI approves parking** (GitLab gate): `head_pipeline` counts only when its sha equals the MR's current sha. - **ci-3, bot progress permits parking**: a reviewer bot counts as settled only when it has submitted a review bound to the current head; otherwise the quiet window decides. GitLab bot notes carry no such signal, so GitLab lanes now always wait for the quiet window (default 15 minutes after CI finishes). - **ci-4, edited feedback unanswered**: the relaunch trigger uses the later of a comment's creation and edit time. - **ci-5, later lanes starved**: a new `visit_lanes` helper starts each tick at the lane the previous tick did not reach (state/.review-park-tick-next and state/.review-park-tick-next-unparked) and wraps around. - **ci-6, unfinished park looks complete**: `cmd_park` writes state/<id>.review-park only after `fm-control.sh exit` confirms the stop. I updated the header docs in bin/fm-park.sh, docs/configuration.md and the operational-home-layout skill to match. Verification: - tests/fm-park.test.sh: all 18 cases pass, including the new regression cases for ci-2 to ci-6. - shellcheck is clean on all changed scripts and tests. - I did not run the new tests against the old code to see them fail first. Open problem: `test_merged_poll_reregistration_after_notification_is_absorbed` now fails. It re-arms a merge poll for a merge that was already reported, and in that test teardown refuses (the task has no project identity). The second watcher cycle now retries cleanup and wakes the captain with the same refusal again. I did not change this. The choice is: - keep repeating the refusal, which is arguably right because the lane still needs a decision, and update that test; or - wake only when cleanup succeeded in the already-recorded case, which would hide a refusal after a merge done through fm-pr-merge.sh and partly undo ci-1. The watcher subset stopped at that failure, so three tests never ran: the new ci-1 test, `test_self_merge_and_poll_publish_one_outcome`, and `test_merged_poll_row_names_no_authority_when_no_record_grants_one`. `test_merged_poll_retires_once` passed. I deleted the temporary subset file tests/.subset-sec.test.sh
* fix(park): write the park record pending before the stop and settle it on tick
cmd_park now writes state/<id>.review-park with pending=1 before
fm-control.sh exit and drops the flag once the stop is confirmed. A park
that dies after the stop, or whose final write fails, still leaves the
lane watched and resumable; crew state and list read it as parking. Each
tick promotes a pending record to parked once its agent is confirmed dead
and drops it while the agent is still alive. A record that cannot be
written refuses the park before the agent is stopped.
The re-armed merged-poll test now expects the repeated teardown-refusal
wake while the merge notice itself is not repeated.
* fix(park): bound the pending-park agent check by the tick budget
settle_pending asked the backend whether a pending lane's agent is alive
with no timeout, before the lane loop that honours the tick deadline, so
a hung backend (for example an unanswering tmux server) held the whole
tick and the watcher with it. The check now runs under fm_run_timed cut
to what the tick has left, and settling happens inside watch_parked, so
a tick that runs out of time saves the next lane in the existing cursor
and the next tick resumes there. An unanswered check leaves the record
pending.
* fix(park): require every required check reported, relaunch on inline replies
The GitHub park gate now refuses while a check the base branch requires has
not reported on the head (or the requirement cannot be read), using the
required-check reading bin/fm-pr-merge.sh does, moved into bin/fm-pr-lib.sh
so both share it. Review-thread comments join the activity list, so an
inline reply in an existing thread relaunches a parked worker.
* fix(park): run lane actions detached so no budget cuts them short
Park, relaunch, and merge-time cleanup now run as detached single-flight
actions under the lane lock instead of inside the tick or the watcher's
merged-poll iteration. The tick holds only forge reads and action starts,
so its budget can no longer kill a slow but successful relaunch, and the
merged-poll path only starts the teardown. Each action publishes its
outcome for the next tick to report, and a merge-time cleanup waits for an
action already under way on the lane.
The ship-landing skill now names the watcher as the one owner of a merged
lane's teardown, including merges made through fm-pr-merge.sh, so
firstmate no longer tears such a lane down a second time.
* no-mistakes(document): Document review parking and merge cleanup
* no-mistakes(ci): Fixed tick-bounded idle checks, reserved half the tick for unparked lanes, and persisted merge-cleanup requests before retiring the merge poll; pending requests retry on later ticks. Updated the park-on-review documentation and state-file list. `tests/fm-park.test.sh`, shell syntax checks, and `git diff --check` pass. The requested new regression tests for the three findings were not added, so those specific scenarios are not yet verified
* no-mistakes(ci): Fixed the requested behavior: unparked merge cleanup now requires config/auto-land; pending cleanup is recorded before poll retirement and dispatched after releasing the control lock; temporary lifecycle-lock refusals preserve the request for retry. Updated docs and behavioral tests. Full suite’s failure was only its maintainer-label gate; ci.yml was left unchanged. tests/fm-park.test.sh and git diff --check pass. ShellCheck reported existing source-following/unused-variable diagnostics; the lint partition and combined shellcheck command timed out, and the merge-poll tests were not completed
* no-mistakes(ci): Added behavioral regression tests for pending-cleanup recovery after watcher restart and retry after a temporary lifecycle-lock refusal. `FM_LIVE=0 bash tests/fm-park.test.sh`, `shellcheck tests/fm-park.test.sh`, and `git diff --check` pass
* test(park): wait for the pending cleanup request to clear before asserting
A detached land publishes its report before it removes the pending
request, so waiting only for the report let the cleanup tests assert
request removal too early. wait_land_settled waits for the request to
clear, which implies the report exists. The control-lock retry test now
ticks until the retry runs instead of sleeping, failing if any tick
reports the refusal as an outcome.
* fix(park): bind cleanup requests to their PR and record wakes before removing reports
A merge-time cleanup request now records the merged PR, and land drops a
request whose PR is no longer the lane's under the lane lock, so a stale
request cannot tear down a lane that moved on to another PR. Teardown also
removes a lane's cleanup request.
The tick now records its outcome and close lines as one wake before it
removes the reports behind them or marks a close as reported; when the wake
cannot be recorded it removes and prints nothing, so the next tick retries.
The watcher only rings.
The two tick-budget tests run under a 6s tick with 8s slow stubs: under a
2s tick the parked-lane budget was one whole second, so the first forge read
was skipped whenever setup crossed a second boundary.
* no-mistakes(document): Document park-on-review safety behavior
* fix(park): keep the cleanup request until its outcome is saved
Teardown no longer deletes a lane's merge cleanup request. Only the
detached cleanup removes it, after its outcome report is saved, so a
cleanup killed partway through its teardown is retried by the next tick
instead of being lost. A request left behind by a manual teardown is still
dropped by the tick once the task record is gone, or by land when the lane
now records a different PR.
* fix(bin): keep the PR merge watch working when a worker with a PR is relaunched (kunchenguid#7996)
* Preserve PR poll authentication on relaunch
* no-mistakes(review): Keep trace and polytoken meta ahead of PR lines
* fix(spawn): keep a recorded PR the task record's tail across relaunch
A control-plane relaunch republished the record with control_relaunch_tx=
after the preserved pr= lines, and the trace-context and Polytoken session
rewrites appended after them too. fm_pr_metadata_identity_parse refuses any
other line after pr=, so the watcher stopped running that lane's merge poll
("rejected unauthenticated state checks") and its merge went unseen. Every
spawn-side rewrite now writes the PR trailer last.
Refs kunchenguid#7938
* fix(spawn): reuse main PR metadata rewrite helper
* no-mistakes(review): Count unresolved GitLab notes individually
* no-mistakes(review): Relaunch parked lanes on incomplete GitHub threads
* no-mistakes(document): Document park-on-review behavior
* fix(park): paginate GitHub comments and fix Linux mode test
* no-mistakes(review): Set private permissions on cleanup requests
* no-mistakes(document): Correct park-on-review cleanup documentation
* fix(park): serialize inbox delivery with review parking
* no-mistakes(ci): Fixed `Lint 1`: removed the unused local variables in `tests/fm-park.test.sh` and exported `FM_HOME`, which the sourced inbox library reads. `bin/fm-lint.sh tests/fm-park.test.sh` passed. The Full suite failure was an aggregate of failed lanes; its log reports `FM_CI_LANES_FAILED=true`, not the underlying lane failure, so I can’t confirm this lint fix resolves it. The park test started passing scenarios but exceeded the 120-second timeout before completing
* no-mistakes(review): Document GitLab pagination completeness invariant
* no-mistakes(review): Remove duplicate temporary park test suite
* no-mistakes(review): Strengthen relaunch and inbox lock regressions
* no-mistakes(review): Keep merge poll armed when cleanup queueing fails
* no-mistakes(review): Preserve pending parks and merge cleanup retries
* no-mistakes(review): Test merged-poll cleanup queue retries
* no-mistakes(review): Retain cleanup request when outcome reporting fails
* no-mistakes(document): Fix park-on-review documentation links
* fix(park): relaunch a pending park only once its stop is confirmed
A pending record now stays pending while its agent reads alive, so feedback could relaunch over a worker whose park never finished. Hold every trigger until the stop is confirmed, for a live agent and an unreadable one alike.
Update the preflight test to expect the record to stay pending and expire at the stop bound, fix gh_fixture's review count for extra_reviews, and make the interrupted-alive and interrupted-unreadable cases wait out the detached relaunch they rule out.
* no-mistakes(review): Fix same-second relaunches and synchronize detached tests
* no-mistakes(document): Clarify park-on-review documentation ownership
* no-mistakes(ci): Applied the GitLab incomplete-discussions handling and outage distinction in `bin/fm-park.sh`, with corresponding test updates. Verification failed: `FM_LIVE=0 bash tests/fm-park.test.sh` reported 3/32 failures; specifically, the failed-page parked-lane relaunch was not observed within the test timeout. Fix/test remains incomplete
* test(park): write real newlines in the GitLab relaunch fixtures
The fixtures used a doubled backslash, so the record held one line, parked_at could not be read, and the tick skipped the lane. The relaunch assertion could not pass, and the outage assertion passed without reaching the forge read.
* no-mistakes(review): Synchronize detached teardown timing test
* no-mistakes(ci): Added the measured `fm-park.test.sh` serial hint and provenance; moved closed-PR reporting ahead of the idle-worker check and added a busy-worker regression. Coverage guard passed (43/290 unhinted), and `FM_LIVE=0 bash tests/fm-park.test.sh` passed. `tests/fm-test-run.test.sh` reached the shard-coverage cases but timed out during a later case; `git diff --check` passed
* fix(teardown): gate GitLab merged-MR landed-work proof on park-on-review opt-in
Teardown accepts a merged GitLab merge request (squash or merge train) as
landed work only when config/park-on-review or config/auto-land exists.
Without either flag a GitLab MR goes through the same read as on main.
* no-mistakes(ci): Fixed park preflight to reject backends lacking verified stop and replacement-agent support before lease or record creation. Added a Zellij regression test; `bash tests/fm-park.test.sh` and `git diff --check` pass
* no-mistakes(ci): Fixed CI coverage by moving fm-park into the proven portable parallel set and rebalancing its lanes; retained teardown status-4 slot/path details in saved land reports with a regression test. Updated scheduling evidence docs. Verified coverage guard (27 parallel; max 850004 ms), fm-park tests, and doc audience check. fm-test-run tests passed scheduling/coverage checks but timed out at 600s before the suite completed
---------
Co-authored-by: Ian Brown <[email protected]>
Intent
7965, refresh
Context: this answers the open question "PR 7965 now conflicts with main while waiting on the maintainer's merge call: refresh it through a fresh validated run (merging main in), or leave it until the maintainer decides?". The PR is #7965 (feat(crew): park ship lanes while awaiting review; fork branch Dematom1:fm/fm-park-on-review). Its checks were green except the Full suite, which needs the maintainer's full-ci label, and GitHub now reports merge conflicts with main. The refresh means: merge current main into the PR branch, resolving the conflicts while keeping the PR's behavior, and bring the updated head through a fresh validated no-mistakes run that pushes to the PR branch. No comment on the PR. No load or stress proofs.
What Changed
Risk Assessment
🚨 High: The change contains an unresolved scope expansion beyond the authorized behavior-preserving refresh, plus reliability risks in detached cleanup and incomplete review reads.
Testing
Ran the attached disposable live lab at target head 8f436f6. Both required scenarios passed; the lab's additional guard scenarios also printed PASS. Evidence transcript retained outside the worktree; temporary lab files removed.
Evidence: Park-on-review live lab transcript
Source: Park-on-review live lab transcript
Opt-in
This change is opt-in. Parking, the tick and cleanup of unparked lanes were already behind
config/park-on-reviewandconfig/auto-land; the teardown path's acceptance of a merged GitLab merge request (squash or merge train) as landed work now applies only when one of those flags exists. Both are off by default and home-local. Without either flag, teardown behaves exactly like main. See theconfig/park-on-reviewandconfig/auto-landsections indocs/configuration.md.Risk Assessment
Testing
The targeted fm-park behavior suite completed and exercised the report-retention regression, but its fake forge and teardown boundaries do not qualify as live product validation. No screenshot applies because the change is CLI/runtime behavior.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-park.sh:771- Closed-PR alerts are deduplicated by task ID rather than PR identity. If a lane's PR is closed and reported, then itsprmetadata is replaced with a new PR that later closes,closed_oncestill sees.review-park-closed-<task>and suppresses the new alert. Bind the marker to the canonical PR identity or retire it when the PR changes. Same invariant applies to both close-detection paths:bin/fm-park.sh:771(watch_parked) andbin/fm-park.sh:790(watch_unparked); the task-wide marker is written atbin/fm-park.sh:910and removed only at teardown (bin/fm-teardown.sh:4224).tests/fm-park.test.sh:1- The focused regression suite passes, but it uses fake forge and lifecycle executables; no reviewer-visible live product evidence could be established for the changed runtime behavior.bash tests/fm-park.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.