Skip to content

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

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
galuis116:fix/8645-wire-protected-automation-author-env-v2
Jul 26, 2026
Merged

fix(orb): wire env into all isProtectedAutomationAuthor production callers#8745
JSONbored merged 3 commits into
JSONbored:mainfrom
galuis116:fix/8645-wire-protected-automation-author-env-v2

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.
  • Integration coverage for EXTRA-only bots across contributor-cap-on-open and all five review-evasion env-wired guards (both protected early-return and unprotected fall-through), fixing the codecov/patch gap that closed fix(orb): wire env into all isProtectedAutomationAuthor production callers #8742.

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
  • protected-automation-author-env-wiring.test.ts (4/4 pass locally, including all five review-evasion call sites)
  • npm run test:coverage — deferred to CI (codecov/patch on src/**; prior fix(orb): wire env into all isProtectedAutomationAuthor production callers #8742 failed at 92.3% on one review-evasion partial — addressed here)
  • npm run test:workers — not applicable
  • npm run build:mcp — not applicable
  • npm run test:mcp-pack — not applicable
  • npm run ui:openapi:check — not applicable
  • 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 skipped — orb/settings/queue wiring + unit tests only. Full typecheck/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
…Nbored#8645

codecov/patch closed JSONbored#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.
@galuis116
galuis116 requested a review from JSONbored as a code owner July 26, 2026 02:08
@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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.27%. Comparing base (a93ae0a) to head (cea6286).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8745      +/-   ##
==========================================
+ Coverage   90.56%   91.27%   +0.71%     
==========================================
  Files          96      100       +4     
  Lines       22490    26069    +3579     
  Branches     3884     5201    +1317     
==========================================
+ Hits        20367    23795    +3428     
- Misses       1945     1997      +52     
- Partials      178      277      +99     
Flag Coverage Δ
backend 95.78% <100.00%> (?)

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.67% <100.00%> (ø)
src/queue/review-evasion.ts 95.36% <100.00%> (ø)
src/services/agent-approval-queue.ts 99.17% <100.00%> (ø)
src/settings/automation-bot-skip.ts 100.00% <100.00%> (ø)

@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

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-26 05:25:27 UTC

6 files · 1 AI reviewer · no blockers · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This PR mechanically threads `env` through 14 production `isProtectedAutomationAuthor` call sites and 2 `automation-bot-skip` wrapper functions, plus adds an optional `env` param to `derivePublicCommentMergeFacts` so `neverClosed` also honors the EXTRA allowlist. The diff is correct and narrow — every call site shown had the missing `env` argument added without changing any surrounding logic, exactly matching the stated intent of closing #8645. The added integration test file exercises the actual production wiring (five review-evasion guards plus the contributor-cap path) with both a protected and unprotected outcome, which is a meaningfully better test than a unit test of `isProtectedAutomationAuthor` alone.

Nits — 3 non-blocking
  • `isTrustedAutomationBotAuthor(prAuthorLogin, env)` in src/settings/automation-bot-skip.ts is called at src/queue/processors.ts:3554 with `env` in scope, but confirm every remaining call site of `isTrustedAutomationBotAuthor`/`isTrustedAutomationBotWebhookActor` across the codebase (outside this diff) was also updated, since a caller that still omits `env` would silently keep the pre-fix behavior.
  • The new JSDoc-style comment on `env?: Env` in processors.ts:2048-2050 is a bit verbose for a one-line optional-field note; consider trimming to the essential MUST-pass rule.
  • Consider whether `env` should eventually become non-optional on `derivePublicCommentMergeFacts` and `isTrustedAutomationBotAuthor`/`isTrustedAutomationBotWebhookActor` now that all production callers pass it, to prevent a future caller from silently regressing to the unprotected default (a lint rule or non-optional signature would catch it at compile time instead of relying on grep).

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 #8742, #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 (2 linked issues).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 1881 registered-repo PR(s), 1221 merged, 56 issue(s).
Contributor context ✅ Confirmed Gittensor contributor galuis116; Gittensor profile; 1881 PR(s), 56 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The diff wires `env` through all named production call sites of isProtectedAutomationAuthor (processors.ts, review-evasion.ts, automation-bot-skip.ts, agent-approval-queue.ts) and extends derivePublicCommentMergeFacts with an optional env param as the issue requested, backed by new/updated tests covering the EXTRA-only bot scenario.

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: JavaScript, Python, TypeScript, Dart, HTML, MDX, Rust, C++
  • Official Gittensor activity: 1881 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 added the manual-review Gittensor contributor context label Jul 26, 2026
@JSONbored
JSONbored merged commit f22b2d1 into JSONbored:main Jul 26, 2026
5 checks passed
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. manual-review Gittensor contributor context

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

2 participants