Skip to content

fix(orb): wire env into all isProtectedAutomationAuthor production callers - #8742

Closed
galuis116 wants to merge 1 commit into
JSONbored:mainfrom
galuis116:fix/8645-wire-protected-automation-author-env
Closed

fix(orb): wire env into all isProtectedAutomationAuthor production callers#8742
galuis116 wants to merge 1 commit into
JSONbored:mainfrom
galuis116:fix/8645-wire-protected-automation-author-env

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

  • Wire env into all 14 production isProtectedAutomationAuthor call sites (and the two automation-bot-skip wrappers) so PROTECTED_AUTOCLOSE_AUTHORS_EXTRA actually protects self-hosted automation bots.
  • Extend derivePublicCommentMergeFacts with an optional env so neverClosed honors the same allowlist extension.
  • Add integration coverage proving an EXTRA-only author (e.g. mergify[bot]) is suppressed in review-evasion self-close and contributor-cap-on-open, and only marked neverClosed when env is passed.

Closes #8645

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint — not applicable (no workflow changes)
  • npm run typecheck — deferred to CI
  • Targeted unit tests for this change: protected-automation-author-env-wiring.test.ts, processors-public-comment-merge-facts.test.ts, automation-bot-skip.test.ts (all pass locally)
  • npm run test:coverage — deferred to CI (codecov/patch on src/**)
  • npm run test:workers — not applicable (no workers changes)
  • npm run build:mcp — not applicable
  • npm run test:mcp-pack — not applicable
  • npm run ui:openapi:check — not applicable (no UI/OpenAPI changes)
  • npm run ui:lint — not applicable
  • npm run ui:typecheck — not applicable
  • npm run ui:build — not applicable
  • npm audit --audit-level=moderate — deferred to CI
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • UI/MCP/workers/actionlint checks skipped because this PR only touches orb/settings/queue call sites and unit tests (no UI, MCP, or workflow changes). Full typecheck / test:coverage / audit left to CI.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable — no visible UI/frontend/docs/extension changes.

Notes

…llers

PROTECTED_AUTOCLOSE_AUTHORS_EXTRA was documented and unit-tested on
isProtectedAutomationAuthor, but every production call site dropped the
optional env argument, so a self-hoster's extra allowlist never protected
bots from contributor-cap close, review-evasion enforcement, neverClosed,
or automation-bot skip. Pass env through all 14 callers (and the two
automation-bot-skip wrappers) and cover the previously-broken path with
integration tests.

Closes JSONbored#8645
@galuis116
galuis116 requested a review from JSONbored as a code owner July 26, 2026 01:56
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.26%. Comparing base (abf88ab) to head (a535bb7).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/queue/review-evasion.ts 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8742      +/-   ##
==========================================
- Coverage   93.79%   91.26%   -2.53%     
==========================================
  Files         797      100     -697     
  Lines       79478    26060   -53418     
  Branches    24079     5198   -18881     
==========================================
- Hits        74543    23784   -50759     
+ Misses       3563     1996    -1567     
+ Partials     1372      280    -1092     
Flag Coverage Δ
backend 95.71% <92.30%> (+0.64%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/processors.ts 95.66% <100.00%> (ø)
src/services/agent-approval-queue.ts 99.17% <100.00%> (ø)
src/settings/automation-bot-skip.ts 100.00% <100.00%> (ø)
src/queue/review-evasion.ts 94.59% <80.00%> (ø)

... and 697 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-26 02:04:48 UTC

6 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR threads an optional `env` parameter through all 14 production call sites of `isProtectedAutomationAuthor` plus the two `automation-bot-skip` wrappers and `derivePublicCommentMergeFacts`, so `PROTECTED_AUTOCLOSE_AUTHORS_EXTRA` now actually reaches every production caller instead of only being exercised in unit tests of the helper itself. The diff is a mechanical, well-scoped wiring fix with a clear linked issue (#8645), and the added integration test (`protected-automation-author-env-wiring.test.ts`) is notably strong — it proves the fix end-to-end by asserting zero GitHub calls for review-evasion self-close and a full contributor-cap webhook run, not just unit-level behavior. `env` is correctly threaded as optional so the change is backward compatible everywhere it isn't yet called with a value.

Nits — 4 non-blocking
  • The codecov/patch check failed at 92.30% vs a 99% target — with a change this mechanical (dozens of one-line call-site edits), it's worth checking which specific branch/line is uncovered since one of the 16 wired call sites may have been missed by the new tests.
  • `src/services/agent-approval-queue.ts:141,358` and `src/settings/automation-bot-skip.ts` weren't included in 'FULL FILE CONTENT', so I can't independently verify those files' surrounding context, though the diff hunks themselves look mechanically correct.
  • Consider a follow-up (or confirm existing coverage) that asserts `isTrustedAutomationBotWebhookActor` is env-wired end-to-end via the actual `handlePullRequestWebhookEvent` skip path, not just the two direct-call unit assertions in the new test file's first `it` block.
  • If the codecov/patch gap traces to one of the 16 call sites, add a targeted assertion the same way `processors-public-comment-merge-facts.test.ts` did for `derivePublicCommentMergeFacts`.

CI checks failing

  • codecov/patch — 92.30% of diff hit (target 99.00%)

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8645
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 1879 registered-repo PR(s), 1221 merged, 56 issue(s).
Contributor context ✅ Confirmed Gittensor contributor galuis116; Gittensor profile; 1879 PR(s), 56 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff updates all 7 processors.ts, 5 review-evasion.ts, 3 automation-bot-skip.ts, and 2 agent-approval-queue.ts call sites to pass env through to isProtectedAutomationAuthor, and adds an integration test file plus updates covering EXTRA-only bot suppression at both contributor-cap and review-evasion call sites as required.

Review context
  • Author: galuis116
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 1879 PR(s), 56 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 26, 2026
JSONbored pushed a commit that referenced this pull request Jul 26, 2026
…llers (#8745)

* fix(orb): wire env into all isProtectedAutomationAuthor production callers

PROTECTED_AUTOCLOSE_AUTHORS_EXTRA was documented and unit-tested on
isProtectedAutomationAuthor, but every production call site dropped the
optional env argument, so a self-hoster's extra allowlist never protected
bots from contributor-cap close, review-evasion enforcement, neverClosed,
or automation-bot skip. Pass env through all 14 callers (and the two
automation-bot-skip wrappers) and cover the previously-broken path with
integration tests.

Closes #8645

* test(orb): cover all five review-evasion EXTRA env call sites for #8645

codecov/patch closed #8742 at 92% with one partial in review-evasion.ts
because only the self-close guard was exercised. Drive all five production
env-wired review-evasion call sites on both the EXTRA-protected and
unprotected paths so patch coverage hits the 99% gate.

---------

Co-authored-by: loopover-orb[bot] <296761690+loopover-orb[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant