Skip to content

feat(miner-governor): add global + per-repo kill-switch resolver (#2341)#4634

Closed
dhgoal wants to merge 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-kill-switch
Closed

feat(miner-governor): add global + per-repo kill-switch resolver (#2341)#4634
dhgoal wants to merge 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-kill-switch

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Adds the miner kill-switch resolver (Closes #2341) — the halt state the Governor consults FIRST, before any other calculator. Mirrors the review-stack's global AGENT_ACTIONS_PAUSED for the miner's own local runtime, plus a per-repo variant.

New packages/gittensory-engine/src/miner/kill-switch.ts:

  • resolveKillSwitch(state, repoFullName){halted, scope, reason}. The global switch denies every repo regardless of per-repo state (checked first); otherwise a per-repo switch denies only its own repo (case-insensitive match, so a config casing mismatch can't slip through), leaving others running.
  • isGlobalKillSwitchEnabled(value) — parses GITTENSORY_MINER_KILL_SWITCH on the codebase truthy convention (/^(1|true|yes|on)$/i).
  • isMinerWriteAllowed convenience predicate.

Pure, no IO: the caller reads the env flag + each repo's .gittensory-miner.yml and records ledger trips — that's separate, maintainer-owned enforcement wiring. This module only decides.

Test

test/unit/miner-kill-switch.test.ts — global-denies-all (incl. a repo not in the halted set), per-repo isolation (others untouched), off-state resumes, case-insensitive match, env-value parsing (truthy + falsy incl. undefined), and global-over-repo precedence. 6 tests pass (engine src via vitest).

…Nbored#2341)

New packages/gittensory-engine/src/miner/kill-switch.ts: pure resolution of the global + per-repo halt
state the Governor consults FIRST before any write. Global halt denies every repo; a per-repo switch
denies only its own repo (case-insensitive), leaving others running. isGlobalKillSwitchEnabled parses the
GITTENSORY_MINER_KILL_SWITCH env value on the codebase truthy convention.

No IO — the caller reads the env flag + per-repo config and records ledger trips (separate, maintainer-owned
enforcement wiring). This module only decides.

Closes JSONbored#2341
@dhgoal dhgoal requested a review from JSONbored as a code owner July 10, 2026 08:31
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 10, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (efcd25d) to head (6be173d).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4634   +/-   ##
=======================================
  Coverage   94.11%   94.11%           
=======================================
  Files         432      433    +1     
  Lines       38348    38357    +9     
  Branches    13979    13981    +2     
=======================================
+ Hits        36091    36100    +9     
  Misses       1600     1600           
  Partials      657      657           
Files with missing lines Coverage Δ
...ackages/gittensory-engine/src/miner/kill-switch.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gittensory-orb gittensory-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. label Jul 10, 2026
@gittensory-orb

gittensory-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-10 08:44:54 UTC

3 files · no blockers · readiness 100/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • AI review already in progress for this PR head: Another Gittensory pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another Gittensory pass. Gittensory is holding this PR for manual review until that pass completes.

Nits — 1 non-blocking
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review
Signal Result Evidence
Code review ✅ No blockers No AI review summary
Linked issue ✅ Linked #2341
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: 85 registered-repo PR(s), 52 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor dhgoal; Gittensor profile; 85 PR(s), 7 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Linked issue satisfaction

Partially addressed
The PR delivers the pure decision logic (global-first, per-repo, case-insensitive) with solid unit tests, but explicitly defers the actual .gittensory-miner.yml resolution, env-var wiring, and governor ledger recording of kill-switch trips to unspecified future 'maintainer-owned enforcement wiring,' and no test demonstrates that toggling off resumes without losing in-flight queue items since no qu

Review context
  • Author: dhgoal
  • 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: 85 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.

🟩 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

@gittensory-orb

Copy link
Copy Markdown

Gittensory is closing this pull request on the maintainer's behalf (Linked issue #2341 is assigned to the maintainer (@JSONbored) — that work is reserved for the maintainer, so this PR cannot be auto-accepted.). 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.

@gittensory-orb gittensory-orb Bot closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner-governor): global + per-repo kill-switch

1 participant