Skip to content

fix(orb): isProtectedAutomationAuthor's self-host allowlist extension is never wired to any of its 14 production call sites #8645

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

src/settings/agent-actions.ts:85's isProtectedAutomationAuthor (introduced by commit
eecc228a5, #4615/#4663) takes an optional env parameter specifically so a self-hoster can extend
the protected-automation-bot allowlist via PROTECTED_AUTOCLOSE_AUTHORS_EXTRA, "instead of forking
the code."

Every real production call site ignores that second argument, even though each one already has
env: Env in scope:

  • src/queue/processors.ts (lines 2072, 2724, 2978, 5466, 6355, 6722, 9714) — 7 call sites,
    including maybeCloseForContributorCapOnOpen(env: Env, ...) at line 2609, which has env
    available but never passes it through.
  • src/queue/review-evasion.ts (lines 610, 829, 995, 1156, 1290) — 5 call sites.
  • src/settings/automation-bot-skip.ts (lines 59, 60, 71) — 3 call sites.
  • src/services/agent-approval-queue.ts (lines 144, 361) — 2 call sites.

All 14 call isProtectedAutomationAuthor(login) with a single argument. Only the direct unit test
(test/unit/agent-actions.test.ts:1488+) ever passes env. isProtectedAutomationAuthor gates
real close/skip decisions: the contributor-cap auto-close path, review-evasion self-close, and the
neverClosed disposition flag. As a result, a self-hoster's configured
PROTECTED_AUTOCLOSE_AUTHORS_EXTRA bot (e.g. mergify[bot]) is silently never protected anywhere
in production, despite the documented feature existing and passing its own unit test.

Requirements

  • Update all 14 production call sites listed above to pass their in-scope env through to
    isProtectedAutomationAuthor(login, env).
  • Do not change isProtectedAutomationAuthor's own signature or logic — it already handles env
    correctly; only the callers are missing the argument.

Deliverables

  • All 7 call sites in src/queue/processors.ts pass env to isProtectedAutomationAuthor.
  • All 5 call sites in src/queue/review-evasion.ts pass env.
  • All 3 call sites in src/settings/automation-bot-skip.ts pass env.
  • Both call sites in src/services/agent-approval-queue.ts pass env.
  • A new integration-level test that stubs env.PROTECTED_AUTOCLOSE_AUTHORS_EXTRA to e.g.
    "mergify[bot]", then calls at least maybeCloseForContributorCapOnOpen and one
    review-evasion.ts guard with that author, asserting the close/skip is now correctly
    suppressed — currently it is not, because env never reaches the check at any of these 14
    sites.

All five Deliverables are required in the same PR — fixing only some of the 14 call sites does not
resolve this issue.

Test Coverage Requirements

src/** is measured by codecov/patch (99%+ target, branch-counted). The new test(s) must exercise
the previously-broken path directly (an author present only in PROTECTED_AUTOCLOSE_AUTHORS_EXTRA,
not in the built-in list) at more than one of the four call-site families, proving the fix is real
end-to-end, not just at the unit level already covered by agent-actions.test.ts.

Expected Outcome

A self-hosted operator's PROTECTED_AUTOCLOSE_AUTHORS_EXTRA configuration actually protects the
named bot author from contributor-cap auto-close, review-evasion self-close, and the neverClosed
disposition flag, matching what the feature has always claimed to do.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions