Surfaced by the #538 analysis. maybeProcessPrPanelRetrigger and the new maybeProcessGateOverrideCommand (#538) share ~80% boilerplate: resolve real repo permission → authorize → load PR/settings → build advisory → audit → product-usage. As #778 (auto-maintain) adds more action commands (auto-merge/close/request-changes), this duplication is a consistency + safety risk (each new action command must independently get the real-permission auth right).
Deliverable
Why it matters
Centralizes the real-permission authorization so no future action command can accidentally fall back to the spoofable author_association (the #788 hazard). Relates #778, #769, #788, #538.
Context
src/queue/processors.ts (maybeProcessPrPanelRetrigger ~1432, maybeProcessGateOverrideCommand new), resolveRealRepoPermissionAssociation.
Surfaced by the #538 analysis.
maybeProcessPrPanelRetriggerand the newmaybeProcessGateOverrideCommand(#538) share ~80% boilerplate: resolve real repo permission → authorize → load PR/settings → build advisory → audit → product-usage. As #778 (auto-maintain) adds more action commands (auto-merge/close/request-changes), this duplication is a consistency + safety risk (each new action command must independently get the real-permission auth right).Deliverable
withAuthorizedPrAction({ commandName, payload, onAuthorized })helper in src/queue/processors.ts (or a sibling module) capturing: real-permission resolution (resolveRealRepoPermissionAssociation), isAuthorizedCommandActor, the deny audit/product-usage, the advisory build, and the success audit shell.Why it matters
Centralizes the real-permission authorization so no future action command can accidentally fall back to the spoofable author_association (the #788 hazard). Relates #778, #769, #788, #538.
Context
src/queue/processors.ts (maybeProcessPrPanelRetrigger ~1432, maybeProcessGateOverrideCommand new), resolveRealRepoPermissionAssociation.