feat(miner-governor): global + per-repo kill-switch (#2341) - #5012
Merged
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 820d62c | Commit Preview URL Branch Preview URL |
Jul 11 2026, 09:16 AM |
This was referenced Jul 11, 2026
Merged
Adds the emergency-halt primitive every write-adjacent governor decision will consult first: a GLOBAL env-level switch (GITTENSORY_MINER_KILL_SWITCH, mirroring isGlobalAgentPause's truthy-string idiom) that halts every repo at once, and a PER-REPO switch (MinerGoalSpec.killSwitch.paused, from .gittensory-miner.yml) that halts only its own repo's queue. Pure/stateless resolver + a state-transition ledger-event builder; every-check allow/deny recording for a real write action is the fail-closed Governor chokepoint's job (#2340), which composes this module first.
4 tasks
JSONbored
force-pushed
the
feat/miner-governor-kill-switch-2341
branch
from
July 11, 2026 09:15
b418a79 to
820d62c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5012 +/- ##
=======================================
Coverage 94.35% 94.35%
=======================================
Files 457 458 +1
Lines 39216 39235 +19
Branches 14300 14309 +9
=======================================
+ Hits 37004 37022 +18
Misses 1558 1558
- Partials 654 655 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
2 tasks
JSONbored
added a commit
that referenced
this pull request
Jul 11, 2026
…llName fallback (#5047) PR #5012 (#2341, merged) landed with codecov/patch failing at 92.30% -- one partial branch never exercised: the root vitest test only ever supplied repoFullName on transitions, so buildMinerKillSwitchTransitionGovernorLedgerEvent's `input.repoFullName ?? null` fallback (kill-switch.ts:69) never took its null-producing side. Add a real, non-no-op transition (a genuine scope change) with repoFullName omitted, asserting the ledger row's repoFullName lands as null rather than undefined or omitted. kill-switch.ts now measures 100/100/100/100 via the same root vitest + vi.mock source-redirect path codecov actually reads (the engine package's own separate node:test suite, which this session had been using for local verification elsewhere, is invisible to codecov -- only files with a corresponding miner-lib wrapper exercised by a root vitest test are.)
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/gittensory-engine/src/governor/kill-switch.ts.GITTENSORY_MINER_KILL_SWITCH, same truthy-string idiom (1/true/yes/on, case-insensitive) as the review-stack's ownisGlobalAgentPause(src/settings/agent-execution.ts) — a parallel mechanism for the miner's local runtime, not the same one.MinerGoalSpec.killSwitch.pausedfield, resolvable from.gittensory-miner.yml. Deliberately distinct fromminerEnabled(a discovery-time opt-out) — pausing halts an already-in-flight queue without deregistering the repo from targeting, so un-pausing resumes exactly where the queue left off.resolveMinerKillSwitch({ global, repoPaused })is pure and stateless: a global halt always reports"global"regardless of the per-repo flag; per-repo alone is sufficient to halt just that repo; toggling either off on the next call immediately reflects"none"with no residual state to corrupt.buildMinerKillSwitchTransitionGovernorLedgerEventrecords STATE TRANSITIONS only (previous scope ≠ new scope) — the "state changes are themselves recorded" deliverable. Recording every check's allow/deny for a real write action is the fail-closed Governor chokepoint's job (maintainer: wire the fail-closed Governor chokepoint before every write action #2340, not yet built), which will consult this module first in its "safest wins" precedence (global kill-switch > per-repo pause > dry-run > rate-limit > budget cap > non-convergence > allow).packages/gittensory-miner/lib/governor-kill-switch.js(+ hand-written.d.ts) wrapper exposescheckMinerKillSwitch()(readsprocess.env+ a caller-supplied per-repo flag) andrecordMinerKillSwitchTransition()(persists via the existingappendGovernorEvent), matching the exact composition pattern PR feat(miner-governor): wire rate-limit + jittered backoff into live write enforcement (#2344) #4984 established forgovernor-write-rate-limit.js.packages/gittensory-miner/docs/miner-goal-spec.md,packages/gittensory-miner/schema/miner-goal-spec.schema.json,.gittensory-miner.yml.example— required by the existingminer-goal-spec-doc.test.tsfield-exhaustiveness check.Scope
MinerGoalSpecfield is documented" via a real test that scans doc/schema/JSDoc, so a new field cascades into doc+schema+example+3 test files; none of it is unrelated bundling.CONTRIBUTING.md.Validation
git diff --checknpm run typecheck— clean.npm run build+npm run testinpackages/gittensory-engine— 369/369 passing (9 new kill-switch tests + 2 newMinerGoalSpec.killSwitchparser tests + updates to 3 pre-existing exact-object assertions that needed the new field added).npm run buildinpackages/gittensory-miner(node --checkover every lib file, including the newgovernor-kill-switch.js) — clean.vitest runon every touched/adjacent root-level suite (miner-goal-spec-parser,miner-goal-spec-doc,miner-governor-kill-switch,miner-governor-write-rate-limit,miner-governor-ledger,find-opportunities,mcp-cli-find-opportunities) — 58/58 passing.npm run docs:drift-check— unaffected (that check covers feature-flags/commands/gate-mode/RepositorySettings/FocusManifest surfaces, notMinerGoalSpec; the dedicatedminer-goal-spec-doc.test.tsis the real doc-sync gate here and is green).npm run test:coverage,test:workers,build:mcp,test:mcp-pack,ui:*,npm audit— not re-run locally; this PR touches onlypackages/gittensory-engine/**,packages/gittensory-miner/**, andtest/unit/**(no top-levelsrc/**, Worker, MCP-pack, or UI code), and perCONTRIBUTING.mdonlysrc/**is Codecov-measured, so these are unaffected. CI runs them authoritatively.Safety
resolveMinerKillSwitchorcheckMinerKillSwitchyet; that wiring is the Governor chokepoint's job (maintainer: wire the fail-closed Governor chokepoint before every write action #2340).isGlobalMinerKillSwitch/resolveMinerKillSwitchdo not themselves fail closed on ambiguous input — they are pure classifiers. Fail-closed composition (any calculator erroring ⇒ deny) is explicitly the Governor chokepoint's (maintainer: wire the fail-closed Governor chokepoint before every write action #2340) responsibility, per the phase brief's "safest wins" precedence design.miner-goal-spec.md, JSON Schema,.gittensory-miner.yml.example); noCHANGELOG.mdchange (not a release-prep PR).Notes
killSwitch.pausedis intentionally a distinct field fromminerEnabled— see the doc's new "Relationship" note.minerEnabled: falseis a discovery-time opt-out (never targeted);killSwitch.paused: trueis a runtime halt of already-claimed/in-flight work, designed to resume cleanly.