⚠️ 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 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
Context
src/settings/agent-actions.ts:85'sisProtectedAutomationAuthor(introduced by commiteecc228a5, #4615/#4663) takes an optionalenvparameter specifically so a self-hoster can extendthe protected-automation-bot allowlist via
PROTECTED_AUTOCLOSE_AUTHORS_EXTRA, "instead of forkingthe code."
Every real production call site ignores that second argument, even though each one already has
env: Envin scope:src/queue/processors.ts(lines 2072, 2724, 2978, 5466, 6355, 6722, 9714) — 7 call sites,including
maybeCloseForContributorCapOnOpen(env: Env, ...)at line 2609, which hasenvavailable 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 passesenv.isProtectedAutomationAuthorgatesreal close/skip decisions: the contributor-cap auto-close path, review-evasion self-close, and the
neverCloseddisposition flag. As a result, a self-hoster's configuredPROTECTED_AUTOCLOSE_AUTHORS_EXTRAbot (e.g.mergify[bot]) is silently never protected anywherein production, despite the documented feature existing and passing its own unit test.
Requirements
envthrough toisProtectedAutomationAuthor(login, env).isProtectedAutomationAuthor's own signature or logic — it already handlesenvcorrectly; only the callers are missing the argument.
Deliverables
src/queue/processors.tspassenvtoisProtectedAutomationAuthor.src/queue/review-evasion.tspassenv.src/settings/automation-bot-skip.tspassenv.src/services/agent-approval-queue.tspassenv.env.PROTECTED_AUTOCLOSE_AUTHORS_EXTRAto e.g."mergify[bot]", then calls at leastmaybeCloseForContributorCapOnOpenand onereview-evasion.tsguard with that author, asserting the close/skip is now correctlysuppressed — currently it is not, because
envnever reaches the check at any of these 14sites.
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 bycodecov/patch(99%+ target, branch-counted). The new test(s) must exercisethe 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_EXTRAconfiguration actually protects thenamed bot author from contributor-cap auto-close, review-evasion self-close, and the
neverCloseddisposition flag, matching what the feature has always claimed to do.
Links & Resources
src/settings/agent-actions.ts:85(isProtectedAutomationAuthor, already correct)src/queue/processors.ts(7 call sites needing the fix)src/queue/review-evasion.ts(5 call sites)src/settings/automation-bot-skip.ts(3 call sites)src/services/agent-approval-queue.ts(2 call sites)test/unit/agent-actions.test.ts:1488+(existing unit test proving the underlying function iscorrect — the gap is purely in callers)
eecc228a5(Minor hardcoding cleanup batch #4615/fix(review): derive four hardcoded gittensory literals from their config (#4615) #4663)