feat(miner-governor): add global + per-repo kill-switch resolver (#2341)#4634
feat(miner-governor): add global + per-repo kill-switch resolver (#2341)#4634dhgoal wants to merge 1 commit into
Conversation
…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
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-10 08:44:54 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 1 non-blocking
Flagged checks (non-blocking)
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🟩 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.
|
|
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. |
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_PAUSEDfor 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)— parsesGITTENSORY_MINER_KILL_SWITCHon the codebase truthy convention (/^(1|true|yes|on)$/i).isMinerWriteAllowedconvenience predicate.Pure, no IO: the caller reads the env flag + each repo's
.gittensory-miner.ymland 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).site//CNAME/**/lovable/**; noCHANGELOG.md. New engine module + test + one entrypoint export; no secrets.