Skip to content

dev-lead fix-bot-comment edits a verbatim org-standard stub on a standards-sync PR when a bot suggests it — the PR drifts from the template it syncs #2185

Closed

Description

@don-petry

Problem

On a standards-sync PR, a dev-lead fix-bot-comment pass will edit a verbatim org-standard caller stub when a review bot suggests it. The PR then no longer matches the template it exists to sync, and with auto-merge on it can land that way.

Nothing in dev-lead stops this:

  • prompts/dev-lead/fix-bot-comment.md has one stub guardrail (line 44, "never forward an undeclared input across a channel pin"). It says nothing about a stub whose header reads SOURCE OF TRUTH: petry-projects/.github/standards/workflows/<name>.yml, or about a PR labeled standards-sync.
  • The harness (scripts/dev-lead-fix-reviews.sh) has no check that a pass on a standards-sync PR left the synced files unchanged.
  • The stub's own header tells agents not to change the trigger events. The pass ignored it.

The bot's suggestion was plausible on its face, so the model's judgement alone is not a reliable guard.

Evidence

petry-projects/incubator PR #164 (chore: sync 3 org-standard workflow stub(s) from petry-projects/.github), 2026-10-10:

  • CodeAnt opened a Major thread on the new .github/workflows/persona-mention.yml: "pull_request review_requested is not subscribed, so reviewer assignments never reach the reusable".
  • Run 38043757605 (fix-bot-comment, status applied) pushed badfc374 "fix(bot): address bot feedback". It added a pull_request: [review_requested] trigger and deleted the five-line NOTE that explains why the template omits that trigger (the router has no path for reviewer assignment; finding 10 in Persona framework — pre-rollout review findings .github#755).
  • dev-lead replied "Fixed", CodeAnt replied "verified this suggestion was addressed", and the thread was resolved. Auto-merge was on for that head.
  • A maintainer review and a fix-reviews dispatch were needed to restore the file (5dc549d7, tree identical to the pre-change commit 111bb767).

That run used dev-lead/v1-stable at 4fd4eacd. The prompt and harness on main (0fe8e4c4) carry no rule that would have prevented it, so this is not fixed by the re-pin to dev-lead/v139-stable.

Why it matters now

The fleet sweep on 2026-10-12 opens sync PRs that add persona-mention.yml to more repos. CodeAnt is likely to raise the same suggestion on each one. A drifted stub that merges is flagged as drift by the next sweep, which opens another sync PR, and the cycle can repeat.

Options

  1. Prompt: in the dev-lead review prompts (fix-bot-comment, fix-reviews, review-changes, on-mention), a file whose header names a SOURCE OF TRUTH under petry-projects/.github/standards/ is read-only in a consumer repo. A bot suggestion to change it gets a "declined, change the template instead" reply and no code change.
  2. Harness: on a PR labeled standards-sync, refuse to push a pass that modifies a file the sync commit wrote, the same way the test-tamper guard refuses a test removal. A maintainer finding could still override it explicitly.

Option 2 is the deterministic guard. Option 1 covers stubs edited outside a sync PR.

Scope decision (maintainer, 2026-10-10)

Answering the triage question in the comments: do both. The harness check (option 2) is the primary guard, because it is deterministic. The prompt rule (option 1) is the backstop. A maintainer (non-bot) review may override the harness check to restore a synced stub to the template, as the second acceptance criterion says; a bot suggestion never can.

Acceptance criteria

  • A fix-bot-comment pass on a standards-sync PR that would change a synced stub pushes nothing, and answers the bot thread as declined with a pointer to the template in petry-projects/.github.
  • A maintainer (non-bot) review thread that asks for a synced stub to be restored to the template is still applied.
  • A sync PR's own files outside standards/ scope, and non-sync PRs, are unaffected.
  • Covered by a test in the harness and/or prompt-contract suites.

Activity

  1. github-actions commented on Oct 10, 2026

    @github-actions
    Contributor

    Thanks for the thorough report and the detailed evidence from incubator PR #164, which makes the failure easy to follow. To help scope the fix, which guard do you prefer as the primary one: the deterministic harness check in scripts/dev-lead-fix-reviews.sh (option 2), with the prompt rule (option 1) as a backstop, or both together? Also say whether a non-bot maintainer review should be able to override the harness check, as your acceptance criteria imply.

  2. don-petry commented on Oct 10, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

    Issue: #2185 — dev-lead fix-bot-comment edits a verbatim org-standard stub on a standards-sync PR when a bot suggests it

    Scope

    Add a deterministic harness guard that refuses to push a bot-driven pass (fix-bot-comment, fix-reviews) on a standards-sync PR when it changes a synced org-standard stub (header SOURCE OF TRUTH: petry-projects/.github/standards/…), unless the change restores the stub to the content the sync commit wrote; plus a prompt rule in the four review prompts that makes such stubs read-only and answers the bot as declined with a pointer to the template.

    Implementation Checklist

    • scripts/lib/sync-stub-guard.sh (new): pure helpers (ssg_template_path, ssg_has_sync_label) + impure ssg_scan_pass <pre-pass> <head> <merge-base> → clean / drift (+ path<TAB>template) / unknown (fail closed). A changed stub is allowed only when its post-pass blob equals the blob the PR's first commit touching it wrote (the sync commit) — that is the maintainer "restore to template" path.
    • scripts/dev-lead-fix-reviews.sh: source the lib; in commit_and_push, for fix-bot-comment|fix-reviews only, run the scan when the pass touches a stub, read the PR's labels/base, and on drift/unknown refuse the push (rc 4, same path as the test-tamper guard) via a new flag_sync_stub_drift that posts one deduped "declined — change the template in petry-projects/.github" comment naming each template, holds the PR and disables auto-merge. Maintainer-driven intents (review-changes/human-pr, on-mention, human) are not guarded.
    • prompts/dev-lead/{fix-bot-comment,fix-reviews,review-changes,on-mention}.md: "Guardrail — a synced org-standard stub is read-only" — decline the bot suggestion (no code change, no addressed-marker) with a pointer to petry-projects/.github/standards/…; restoring the stub to its template is allowed.

    Tests to Write

    • tests/dev-lead/unit/test_sync_stub_guard.bats: header detection; label detection; scan on a temp git repo — bot drift on a synced stub → drift rc1 naming the template; restore to the synced content → clean; non-stub files and .github-private SOURCE OF TRUTH files → clean; missing merge base / pre-pass head → unknown rc2; deleting the stub → drift; harness wiring (guard sourced, intents scoped, rc 4).
    • tests/dev-lead/unit/test_sync_stub_readonly_guardrail.bats: prompt-contract — the guardrail is present in all four prompts, names SOURCE OF TRUTH, standards-sync, the declined reply and the template pointer.

    Test Command

    bats tests/dev-lead/unit/test_sync_stub_guard.bats tests/dev-lead/unit/test_sync_stub_readonly_guardrail.bats (plus the full tests/dev-lead/unit suite) and bash .dev-lead/scripts/dev-lead-lint.sh

  3. don-petry commented on Oct 10, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete — PR #2191

    The implementation for issue #2185 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.

    Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.

  4. added a commit that references this issue on Oct 10, 2026
  5. added a commit that references this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reportsdev-leadFor dev-lead agent pickup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions