feat(miner): build a governor pause/resume control surface#5523
Conversation
|
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 | a9edcfd | Commit Preview URL Branch Preview URL |
Jul 13 2026, 04:17 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5523 +/- ##
==========================================
+ Coverage 94.87% 94.89% +0.02%
==========================================
Files 568 569 +1
Lines 45055 45154 +99
Branches 14675 14675
==========================================
+ Hits 42746 42849 +103
+ Misses 1575 1571 -4
Partials 734 734
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-13 04:21:26 UTC
✅ Suggested Action - Approve/Merge
Review summary Blockers
Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk 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.
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.
|
Add a real, persisted pause/resume flag on governor-state.js's existing scalar-state row (paused/pause_reason/paused_at columns, migrated in for on-disk files predating this), controllable via `gittensory-miner governor pause [--reason <text>]` / `governor resume` / `governor status` (governor-pause-cli.js). loop-cli.js's iteration loop checks it at the same two boundaries as the kill switch -- before the first cycle and at the top of every subsequent one -- so pausing mid-run stops the loop before its next cycle claims anything. Distinct from governor-kill-switch.js (a read-only resolver over env/YAML inputs this package never writes) and governor-run-halt.js (a one-way, run-scoped terminal breaker with no resume path): this is the first genuinely operator/governor-writable stop/go control. Resuming is just clearing the flag and re-invoking the loop -- every piece of per-cycle state it reads is already persisted, so a resumed run continues from exactly where it left off. The autonomous logic that decides *when* to pause is separate, later-wave scope. Closes #4851
The migration guard only checked for `paused`'s presence before skipping entirely, so a file with `paused` but missing `pause_reason`/`paused_at` would skip the ALTER and later fail with "no column named pause_reason". Check each of the three columns independently and add whichever are missing.
930c592 to
a9edcfd
Compare
Summary
governor-state.js's existinggovernor_scalar_staterow (paused/pause_reason/paused_atcolumns), migrated in for on-disk files predating this via a guardedALTER TABLE(mirrorsportfolio-queue.js's own post-creation column migration).governor-pause-cli.jsimplementsgittensory-miner governor pause [--reason <text>]/governor resume/governor status, dispatched from the existinggovernornoun ingovernor-ledger-cli.js'srunGovernorCli.loop-cli.js's iteration loop checks the flag at the same two boundaries as the kill switch — before the first cycle and at the top of every subsequent one — so pausing mid-run stops the loop before its next cycle claims anything.governor-kill-switch.js(a read-only resolver over env/YAML inputs this package never writes) andgovernor-run-halt.js(a one-way, run-scoped terminal breaker with no resume path): this is the first genuinely operator/governor-writable stop/go control. Resuming is just clearing the flag and re-invoking the loop — every piece of per-cycle state it reads (portfolio queue, run state, governor state's own cap usage) is already persisted, so a resumed run continues from exactly where it left off.Test plan
npx vitest run test/unit test/contract— 781 files / 15247 tests passing, 0 regressionsnpm run build --workspace @jsonbored/gittensory-miner(node --checkover every lib file, including the new one)npx tsc --noEmitcleannpm run docs:drift-check && npm run manifest:drift-check && npm run engine-parity:drift-check && npm run miner:env-reference:checknpm audit --audit-level=moderate— 0 vulnerabilitiesgovernor-state.js's pause accessors (round-trip, reason trimming/nulling, cross-preservation with rate-limit/cap-usage state, on-disk schema migration from a pre-Build a governor pause/resume control surface #4851 file, module-singleton wrappers), andloop-cli.js's two halt checkpoints — including a dedicated test proving the loop halts mid-run (not just before the first cycle) and a resume test proving a fresh invocation against the same on-disk files continues from the persisted queue stateCloses #4851