Skip to content

fix(review): enforce miner-scoped breakers#5209

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-miner-scoped-breaker-enforcement-issue
Jul 12, 2026
Merged

fix(review): enforce miner-scoped breakers#5209
JSONbored merged 1 commit into
mainfrom
codex/fix-miner-scoped-breaker-enforcement-issue

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • A miner-scoped auto-tune pass started writing per-project flags suffixed with :miner, but the live merge/close decision path only checked unsuffixed flags, so miner-authored PRs could still be auto-merged/closed despite a miner-only breaker engaging.
  • The autonomous-action audit write omitted the minerAuthored field, risking overwriting miner-scoped audit rows and losing the miner-scoped signal.

Description

  • Added an optional minerAuthored parameter to isHoldOnly and isCloseHoldOnly and made those readers also check the suffixed :<repo>:miner flags via minerBreakerScope when the caller indicates a miner-authored PR.
  • In the live planner (runAgentMaintenancePlanAndExecute) resolve whether the PR author is a confirmed miner using getCachedOfficialMinerDetection, pass that boolean into isHoldOnly/isCloseHoldOnly, and use it when evaluating precision breakers so miner-scoped flags actually affect miner-originated actions.
  • Preserve minerAuthored on the actual autonomous disposition audit row by passing the resolved miner scope into recordNativeGateDecision so audit/state stays consistent with the evaluation scope.
  • Added unit tests in test/unit/outcomes-wire.test.ts that assert miner-scoped holdonly/closehold flags only apply for confirmed miner-authored PRs and that existing flag behaviour remains unchanged.

Testing

  • Ran git diff --check to validate whitespace/conflict hygiene; no issues found.
  • Ran type-checking with npm run typecheck; it succeeded with no TS errors.
  • Ran unit tests npx vitest run test/unit/outcomes-wire.test.ts test/unit/parity-wire.test.ts; both test files passed (all relevant assertions succeeded).

Codex Task

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.34%. Comparing base (448dd3e) to head (5259705).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5209   +/-   ##
=======================================
  Coverage   94.34%   94.34%           
=======================================
  Files         473      473           
  Lines       39965    39970    +5     
  Branches    14570    14573    +3     
=======================================
+ Hits        37704    37709    +5     
  Misses       1585     1585           
  Partials      676      676           
Flag Coverage Δ
shard-1 46.34% <100.00%> (+<0.01%) ⬆️
shard-2 34.41% <0.00%> (-0.27%) ⬇️
shard-3 31.19% <0.00%> (-0.81%) ⬇️
shard-4 32.71% <100.00%> (+0.73%) ⬆️
shard-5 33.65% <0.00%> (-0.10%) ⬇️
shard-6 45.06% <85.71%> (+0.21%) ⬆️

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.51% <100.00%> (+<0.01%) ⬆️
src/review/outcomes-wire.ts 90.06% <100.00%> (+0.27%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

loopover-orb Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-12 09:30:44 UTC

3 files · 2 AI reviewers · 2 blockers · readiness 93/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This closes a real authorization gap: miner-scoped `:miner` breaker flags were written but never read on the live merge/close decision path, so a miner-authored PR could bypass a miner-only hold/close breaker. The fix threads a `minerAuthored` boolean (derived from `getCachedOfficialMinerDetection` status `confirmed`) through `isHoldOnly`/`isCloseHoldOnly` into the suffixed-scope check via `minerBreakerScope`, and also preserves that boolean on the `recordNativeGateDecision` audit row so state stays consistent with the evaluation scope. New unit tests exercise the real flag-store path (not mocks) for both flags and both branches (confirmed vs not, matching vs non-matching project), and CI is fully green.

Nits — 5 non-blocking
  • src/queue/processors.ts: `getCachedOfficialMinerDetection` is awaited directly inline with no visible try/catch — if that call throws (vs. failing open internally), it would blow up the whole maintenance plan rather than defaulting `breakerMinerAuthored` to false; worth confirming it's fail-open at its own definition.
  • No test directly exercises the processors.ts wiring itself (that `breakerMinerAuthored` is correctly derived from `getCachedOfficialMinerDetection` and threaded into both breaker calls and the audit row) — only the lower-level `isHoldOnly`/`isCloseHoldOnly` behavior is unit-tested.
  • `minerBreakerScope` itself isn't shown in the diff; the tests implicitly assume it formats as `<project>:miner`, worth double-checking that's the actual contract rather than something test-fitted.
  • Add (or point to) a test/mocked-integration case for `runAgentMaintenancePlanAndExecute` confirming a confirmed-miner PR with a `:miner` breaker flag actually downgrades the plan, to close the wiring gap noted above.
  • Confirm this PR links back to the originating issue/incident for the miner-scope gap so it satisfies the repo's issue-linkage requirement for merge-readiness.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 2 reviewers, synthesized
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
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 (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 45 registered-repo PR(s), 37 merged, 409 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 45 PR(s), 409 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence. LLM value judgment: moderate — The diff closes a concrete auth-scope bypass in the live gate path and preserves audit fidelity, backed by targeted new tests exercising the real flag-store behavior.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 45 PR(s), 409 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.
[BETA] Chat with Gittensory

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

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

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 12, 2026
@JSONbored
JSONbored merged commit 9fa67f5 into main Jul 12, 2026
18 checks passed
@JSONbored
JSONbored deleted the codex/fix-miner-scoped-breaker-enforcement-issue branch July 12, 2026 09:38
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.

1 participant