Skip to content

feat: automatically merge green yolo PRs while attended - #5726

Closed
mdc2122 wants to merge 7 commits into
kunchenguid:mainfrom
mdc2122:fm/yolo-automerge-v2
Closed

mdc2122 wants to merge 7 commits into
kunchenguid:mainfrom
mdc2122:fm/yolo-automerge-v2

Conversation

@mdc2122

@mdc2122 mdc2122 commented Sep 25, 2026 •

Copy link
Copy Markdown

Supersedes #4663 (rebased onto current main, reconciled with #5534).

Intent

Fix upstream PR #4663 (automatically merge green yolo pull requests): it conflicts with upstream main and has never been triaged. Rebase it once onto current upstream main keeping only its own commits, and reconcile it with upstream's newer merge guard #5534. The follow-up commit ensures the watcher never invokes the yolo merge path while the away-posture record exists.

What Changed

  • Automatically merge green PRs for yolo=on tasks through the existing guarded merge entrypoint, with a configurable timeout and continued polling for refused, queued, or unconfirmed merges.
  • Block watcher merge invocation while an away-posture record exists and recheck away authority during verification to prevent race-driven merges.
  • Preserve durable landing outcomes and retire only matching PR polls; document the contract and add regression coverage for merge guards, away-entry races, queued merges, rebound polls, and timeouts.

Risk Assessment

✅ Low: The change reuses existing merge guards, serializes away-state admission, and preserves polling on refusals, timeouts, queued merges, and PR replacement.

Testing

Focused behavioral tests passed, including both away-entry races. Captured a live CLI refusal transcript and removed the disposable lab. Forge-dependent scenarios remain unverified live; the previously declined missing-repository finding was not repeated.

  • Live validation: ⚠️ inconclusive - 1 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Watcher-origin merge request is refused while an away record exists ✅ pass live away-cli.txt: exit 2; no merge authority or landing outcome persisted
A green yolo PR merges and publishes one durable landing ⏸️ untested no No authorized disposable forge PR was supplied. Provide one with merge authority to verify live.
Non-yolo, red, and missing-required-check PRs remain unmerged ⏸️ untested no Live verification requires authorized disposable PRs with controllable checks and rules.
Away entry before admission or during verification prevents watcher merging and preserves polling ⏸️ untested no Race checks used simulated forge responses. Provide a disposable forge PR and controlled verification timing for live reproduction.
Queued merges and replacement PR registrations retain their polls ⏸️ untested no Live verification requires an authorized merge-queue repository and replacement test PR.
Stalled merge verification times out without retiring the poll ⏸️ untested no The stall was simulated; live verification requires a controllable forge connection.
Evidence: Real merge CLI refuses watcher authority while away

Source: Real merge CLI refuses watcher authority while away

Away posture recorded at 2026-09-26T00:26:47Z: hold-for-return only. No phone channel is configured; anything that needs you waits for your return. Your away instructions are recorded verbatim; the away session will carry them out where it can, and anything it is unsure of, or that needs you, waits for your return. Destructive, irreversible, and security-sensitive actions are never pre-authorizable, whatever the words say. Expected return: not given. Spend cap: 4 concurrent workers.
Away posture (recorded):
  entered: 2026-09-26T00:26:47Z
  expected return: not given
  spend cap: 4 concurrent workers
  reach: hold-for-return only. No phone channel is configured; anything that needs you waits for your return.
  your words (verbatim):
    do not merge anything
error: watcher auto-merge is forbidden while the away-posture record exists
Merge command exit status: 2
No merge authority or landing outcome persisted.
- Outcome: ⚠️ 1 warning across 1 run (2m0s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • 🚨 bin/fm-watch.sh:2792 - The requirement says the watcher “never invokes the yolo merge path while the away-posture record exists,” but the new ! fm_afk_contract_present check is unlocked. Away entry can publish the record after line 2792 and before the invocation at line 2797. The merge script then accepts the new record as away authority through require_current_away_authority, allowing a green PR to merge even when the away words prohibit merging. Entry during merge verification has the same consequence. Serialize automatic-merge admission with the existing away-record lock and enforce the watcher caller's attended-only restriction at the merge script's locked authority boundary.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (1 of 6 scenarios were driven live against the product); untested: A green yolo PR merges and publishes one durable landing, Non-yolo, red, and missing-required-check PRs remain unmerged, Away entry before admission or during verification prevents watcher merging and preserves polling, Queued merges and replacement PR registrations retain their polls, Stalled merge verification times out without retiring the poll
  • Live validation: ⚠️ inconclusive - 1 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Watcher-origin merge request is refused while an away record exists ✅ pass live away-cli.txt: exit 2; no merge authority or landing outcome persisted
A green yolo PR merges and publishes one durable landing ⏸️ untested no No authorized disposable forge PR was supplied. Provide one with merge authority to verify live.
Non-yolo, red, and missing-required-check PRs remain unmerged ⏸️ untested no Live verification requires authorized disposable PRs with controllable checks and rules.
Away entry before admission or during verification prevents watcher merging and preserves polling ⏸️ untested no Race checks used simulated forge responses. Provide a disposable forge PR and controlled verification timing for live reproduction.
Queued merges and replacement PR registrations retain their polls ⏸️ untested no Live verification requires an authorized merge-queue repository and replacement test PR.
Stalled merge verification times out without retiring the poll ⏸️ untested no The stall was simulated; live verification requires a controllable forge connection.
  • bash tests/fm-pr-check-security.test.sh --yolo-only
  • Created an isolated worktree-local lab home; ran fm-afk-contract.sh enter --words 'do not merge anything', then the real fm-pr-merge.sh with FM_PR_MERGE_WATCHER=1; verified refusal and absent landing state; removed the lab.
  • git merge-base --is-ancestor 4299683d5b656a70ced609d7d929499ddc0d675a HEAD
  • git status --short confirmed a clean worktree.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

When a task's merge poll finds the PR still open and the task meta records
yolo=on, the watcher now invokes bin/fm-pr-merge.sh itself instead of only
reporting the still-open PR and waiting for a firstmate turn. The merge
path's own live verification remains the only green check: a red,
unmergeable, or unverifiable PR is refused there and the poll stays armed.
A confirmed landing is recognized by the merge-notified marker the merge
path commits with its durable outcome, so a queued or unconfirmed
acceptance keeps polling and the landed wake is emitted exactly once.

The task's recorded yolo posture now resolves as standing merge authority
ahead of the away-posture record, which is consulted only for a task
without it.
@mdc2122
mdc2122 force-pushed the fm/yolo-automerge-v2 branch from e9b7726 to c9d3fcf Compare September 26, 2026 02:32
@mdc2122 mdc2122 changed the title feat(bin): automatically merge green yolo pull requests from the armed poll feat: automatically merge green yolo PRs while attended Sep 26, 2026
@mdc2122

mdc2122 commented Oct 5, 2026

Copy link
Copy Markdown
Author

Closing: stale and conflicting with main; superseded on our side by a different merge-authority model.

@mdc2122 mdc2122 closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant