Skip to content

feat(source-control): post the CI evidence comment from the merge gate - #13731

Merged
kyle-sexton merged 4 commits into
mainfrom
work-resolve-issue/issue-11393-42238132369-1
Nov 6, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
work-resolve-issue/issue-11393-42238132369-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #11393

Summary

Opened by the work-resolve-issue lane. The run's own summary:

The pr-merge lane now posts the `` comment after a passing verifier verdict and before the merge, on both merge paths. (1) merge-pr: babysit_merge.py `unattended_enqueue` (run through source-control-babysit-merge) posts it after the pin comment and before the enqueue, only when the verifier reader ran. (2) `enable-auto-merge`: enable-auto-merge.mjs runs the new `babysit_evidence_comment.py post` after the pin and before the arm. The comment links the head's `pr-capture-<pr>-<head>` artifact and its expiry date, uploads no file, and is upserted by marker, so a new head updates the one comment. Design choices: (a) An artifact counts only when its run is a successful `.github/workflows/pr-verify-capture.yml` run on main, started by workflow_run in this repository, with a title that names the head. These are the same rules find-capture.mjs applies, because any workflow, a fork PR's included, can upload an artifact with that name. (b) No capture, or a failed read or write, posts nothing and the merge goes on, following the Merge-Risk line precedent: the verdict is the gate and the comment is its record. (c) One Python renderer serves both paths, so the two paths cannot drift. The Actions reads run under BABYSIT_VERIFY_GH_TOKEN, which both jobs already set with `actions: read`. The comment write uses the lanes App token. No workflow or permission change was needed.

The run went past its turn budget (turns=136 max-turns=113): the work may be too big for one run.

Not verified

  • The Python suites (test_babysit_merge_unattended.py, test_babysit_evidence_comment.py, test_guards.py) and the node suite (enable-auto-merge.test.mjs) were not executed: this lane runs no interpreter or test runner. They are left to the PR's CI
  • reference/guard-contract.md was edited by hand, not regenerated with guard_contract.py --write (no interpreter here). test_guards' staleness check confirms it in CI
  • ci-status green on the PR head (done-when item): left to the PR's CI
  • Tidy not run: the change touches .github/ (a listed shared path), spans 2 areas (plugins/source-control and .github), and is over 300 changed lines
  • No live run: the capture-artifact lookup and the comment post were not exercised against GitHub
  • Untracked dotfiles in the checkout root (.bashrc, .bash_profile, .profile, .zshrc, .zprofile, .gitconfig, .ripgreprc, .mcp.json, .idea, .vscode) were not created by this run and are not part of the change

Fix

  • plugins/source-control/skills/babysit-prs/scripts/babysit_evidence_comment.py: new. find_capture (artifact listing by name plus the capture-run provenance check), evidence_body (the evidence-comment template layout with no capture sections), post (never raises; returns…
  • plugins/source-control/skills/babysit-prs/scripts/babysit_merge.py: unattended_enqueue posts the evidence comment after the pin and before the enqueue when the verifier reader ran, and records the outcome as unattended.enqueue.evidenceComment
  • .github/scripts/pr-merge/enable-auto-merge.mjs: new pythonEvidence spawner and an injectable evidence step, run after the pin and before each arm; its failure is logged and the arm goes on
  • .github/scripts/pr-merge/enable-auto-merge.test.mjs: enable-auto-merge path cases: PASS plus capture gives one comment and then the arm; no capture gives no comment and still arms; a throwing step still arms; no post under report-only or for a held PR; pythonEvidence argv/env/error
  • plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_merge_unattended.py: merge-pr path LaneMode cases: PASS plus capture gives one marker comment and then the enqueue; an earlier comment is PATCHed in place; no capture gives no comment and the merge is unaffected; another…
  • plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_evidence_comment.py: new unit tests for provenance, artifact filtering, newest-run choice, an unreadable run, body text, no-capture, errors, and the CLI
  • plugins/source-control/skills/babysit-prs/scripts/tests/guard_contract.py: classifies the new CLI as a mutating entry point backed by a new evidence-comment.upserts-a-comment mechanism row
  • plugins/source-control/skills/babysit-prs/reference/guard-contract.md: the two generated rows for that entry point and mechanism, written by hand to match render_markdown
  • plugins/source-control/skills/pull-request/reference/evidence.md: notes that in CI the merge gate posts the same marked comment on both merge paths
  • .changes/source-control/work-resolve-issue-issue-11393-42238132369-1-0348433c.md: minor changelog fragment for source-control

Verification

The runner ran each check from the base copy against e7ae156:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 2 fragments valid
  • check-changed-skills: babysit-prs and pull-request PASS, 0 errors (warnings are pre-existing size warnings)
  • check-affected: 13 passed, 6 skipped over 10 changed files
  • cant-fail-scan --file --check on test_babysit_evidence_comment.py, test_babysit_merge_unattended.py and enable-auto-merge.test.mjs: PASS, no gating findings (2 advisory findings are on pre-existing tests)
  • Fresh-context review subagent over the whole diff: found the missing guard_contract entry point (test_guards would fail), the one-argument gh_json fake that test_no_write_runs_under_the_read_token would hit with a TypeError, an exception type that could escape after the pin, and one unreadable run…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42238132369

Left out: the items under Not verified.

Related

#11393

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed f83fd4e76ec7924e9b8782dd9b67cca527e5d193: read 17 of 17 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #13731, head f83fd4e

critical-findings: 0

No security issues found. I read every hunk of all 17 changed files in the full diff. This lane already reviewed an earlier head (blocking only: yes), so this review reports only CRITICAL and IMPORTANT findings. There are none. My earlier summary comment had no line anchor and found nothing, so there is nothing to carry forward.

The new evidence comment (babysit_evidence_comment.py and its two callers)

  • What runs. enable-auto-merge.mjs runs the script from the base checkout (EVIDENCE_SCRIPT = ".base/…/babysit_evidence_comment.py"). It uses the same env.<X>_SCRIPT || .base/... override pattern as the existing VERIFY_SCRIPT and WHOLE_REVIEW_SCRIPT spawners, so the PR head's code never runs with the lane token. babysit_merge.py imports the module from the same scripts directory, and the PR adds that module to the hold floor.
  • What goes into the comment. Nothing untrusted:
    • head must match ^[0-9a-f]{40}$.
    • The run and artifact ids must be integers.
    • The expiry is cut down to a \d{4}-\d{2}-\d{2} match.
    • The repo comes from GITHUB_REPOSITORY.
    • The artifact name is built from the PR number and the head.
  • Lookalike artifacts. A fork or another workflow can upload an artifact with the same name. capture_run rejects it unless the run's path, workflow_run event, main head branch, repository.full_name, success conclusion and title SHA all match. Even a lookalike would only be linked, never run or trusted.
  • Write scope. upsert_marker_comment only rewrites a comment for which _newest_marker_comment returns true, and that requires the comment's author to match the lane identity (babysit_merge.py#L3896-L3914). A comment someone else wrote with the marker is never edited.
  • Nothing trusts the marker. No gate reads `` as a signal. Outside this PR's own files, the marker appears only in a skill template, a reference doc, an eval fixture and two skill docs.
  • Tokens and logs. The Actions reads use BABYSIT_VERIFY_GH_TOKEN (or the reader's actions_token), and the comment write uses GH_TOKEN. No token scope, permissions: block or token request changes. The outcome is logged through escapeCommand.
  • The merge always goes on. Every failure path returns an outcome string. In enable-auto-merge.mjs the call sits in a try/catch, so neither path can block or skip a hold.

Trust controls and hold paths

  • Merge holds. merge-holds.mjs (HOLD_PATH_CLASSES), babysit_risk.py (FLOOR_CLASSES), the generated hold_patterns in pr-require-checks.yml, and the hold-paths lists in pr-review-hosted.yml and pr-review-security-hosted.yml each gain one row for the new script. Nothing is removed or reclassified, so each change narrows what an unattended merge lets through. The [ "$AUTHOR_ID" = 49699333 ] || hold_patterns=() guard is unchanged.
  • enable-auto-merge.mjs. The new step runs only when action === "arm", after the existing hold logic, and it changes none of that logic.
  • Untouched controls. The trusted-trigger check, lane token scope, kill switch and token broker are not changed.
  • Instruction surfaces. The evidence.md and guard-contract.md edits only add text; they remove or soften no rule.

Spend. Each arm or enqueue now makes one artifact-listing read, one run read per candidate artifact and one comment write. These are GitHub API calls with no billing impact.

Embedded text. The PR context file contains no directives aimed at this lane.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed f83fd4e76ec7924e9b8782dd9b67cca527e5d193: read 17 of 17 changed file(s); 0 finding(s), 0 as inline comments.

Code review (blocking only): no findings

I read every hunk of all 17 files in the full diff. This lane already reviewed an earlier head, and the prior-findings file says blocking only: yes, so this review reports blocking findings only.

What I checked

  • merge-pr path (babysit_merge.py#L4994-L5014):
    • Runs only after a passing verdict. inputs["verify_reader"] is set at L3612. A refusal returns at L3613-3616, so the gate never reaches unattended_enqueue. Gating the comment on reader is not None therefore means it follows a passing verdict.
    • Order is pin, comment, enqueue. It runs after the pin and before async_merge.
    • Signatures match. It calls upsert_marker_comment(..., comments, marker=...) (L3929) and gh_json(args, env_overrides) in the form those functions take.
    • A failure never stops the merge. post catches every exception, so a failed read or write is recorded and the enqueue goes on.
  • enable-auto-merge path (enable-auto-merge.mjs#L2555-L2563):
    • Runs only on a live arm. It runs after the report-only branch (!write continues earlier) and after the pin, and only when action === "arm".
    • Its failure is logged, not fatal. An error is logged and the arm still goes on.
    • Tokens are already there. The job already sets GH_TOKEN to the lane token and BABYSIT_VERIFY_GH_TOKEN to github.token (pr-merge.yml#L2617-L2624), so no workflow change is needed.
  • Which artifact counts. capture_run checks the workflow path, the workflow_run event, the main branch, the repository, a success conclusion, and a title that names the head. That stops a pull request's own workflow from planting an artifact with the same name.
  • No import cycle. babysit_evidence_comment imports babysit_merge lazily inside main.
  • Hold floor. The new script is added to every copy of the floor. The earlier review checked those copies, and this push leaves them unchanged.

Closing issue #11393

  • Sanity Check (PASS + capture → one marker comment, then enqueue; no capture → no comment, merge unaffected): the tests exist on both paths: test_merge_pr_path_* in test_babysit_merge_unattended.py and the enable-auto-merge path: cases in enable-auto-merge.test.mjs. Whether they pass is left to CI; I did not run them.
  • Both merge-pr and enable-auto-merge paths enumerated in the PR body and covered by a test: met.
  • Version and CHANGELOG bumped per the repository's convention: met. The changelog fragment has bump: minor, which fits a new capability.
  • ci-status green on the PR head: not verified. This lane cannot read checks.

Not verified: the author says the Python and node suites and the hand-written guard-contract.md rows will be checked in CI. They have not run yet, and I could not run them either: this lane has no interpreter.

Spend: each arm or enqueue now makes a few more GitHub API calls (an artifact listing, one run read per candidate, a comment read and one write), under tokens the jobs already hold. Nothing here is billed.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head f83fd4e76ec7924e9b8782dd9b67cca527e5d193. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate holds it on its risk score (unreadable: RuntimeError: #13731 force pushes: unread or
  incomplete)

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 6, 2026
@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped fix-ci on this pull request: the CI fix changes a path the lane does not push: .github/workflows/, CODEOWNERS, .gitmodules or a settings file. The lane labels it needs-session for a session builder, who makes the change this lane cannot, and the run ends in a failing pr-unblock/fix-ci status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=13731 -f activity=fix-ci

babysit_merge.py now imports babysit_evidence_comment.py, so the floor
closure test requires it in the hold floor. Add it to
babysit_risk.FLOOR_CLASSES as an enforcement row like its sibling
scripts, regenerate the copies with scripts/sync-hold-floor.py
(merge-holds.mjs, pr-require-checks.yml, pr-review-hosted.yml,
pr-review-security-hosted.yml), and move the floor pins in
test_floor_paths.py and test_babysit_risk.py by that one enforcement row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton added do-not-merge Hard merge gate: do not merge while applied. and removed needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. labels Nov 6, 2026
kyle-sexton and others added 2 commits November 6, 2026 11:45
A blocked capture still uploads pr-capture-<pr>-<head> from a successful
run, so the comment claimed screenshots and video that did not exist. It
now says the artifact holds the capture summary and any capture that
passed the mask check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 6, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 7bc5754 Nov 6, 2026
82 of 83 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-11393-42238132369-1 branch November 6, 2026 17:20
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.

feat(source-control): post the CI evidence comment from the merge gate

1 participant