feat(miner-governor): gated-submission trigger requiring predicted-gate PASS + slop-under-threshold (#2336) - #5045
Conversation
…te PASS + slop-under-threshold Adds shouldSubmit (#2336): THE safety-critical chokepoint of Phase 4 -- the actual decision point that decides "call gittensory_open_pr NOW" for an autonomous run. Conservatively requires BOTH a clean predicted- gate pass AND a slop band at or under a configurable threshold before a local-write open_pr action spec is ever built. Any ambiguity (a missing/errored signal) resolves to NOT submitting -- never defaults to allow. Runs before buildOpenPrSpec (src/mcp/local-write-tools.ts) is ever called, i.e. before the Governor chokepoint (#2340) ever sees an open_pr action spec. Complementary, not redundant: this gates on content-quality signals (predicted-gate conclusion, slop risk) specific to the candidate diff; the chokepoint gates on resource/ governance signals (rate-limit, budget, reputation, self-plagiarism, dry-run mode) that apply to every write action class. Input shape mirrors SelfReviewVerdict's own fields (self-review-adapter.ts, #2334) so a caller can pass the same verdict the iterate-loop's self-review (#2333) already computed at handoff time, as a defense-in-depth re-check immediately before submission. A dry-run/observe mode (mirroring src/settings/autonomy.ts's deny-by- default AUTONOMY_LEVELS dial) structurally forces allow: false regardless of the underlying signals, for safe rollout of this function's own thresholds -- distinct from the Governor chokepoint's own dry-run/live action-mode dial (#2342). Wiring a real call site behind this gate is a later, separate issue (mirrors #2333/#2335's own split between mechanics and policy). Barrel-exported from the engine's public entrypoint.
|
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 | e3e083f | Commit Preview URL Branch Preview URL |
Jul 11 2026, 10:33 AM |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-11 10:36:36 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 1 non-blocking
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.
|
Summary
Closes #2336.
Adds
shouldSubmit(packages/gittensory-engine/src/miner/submission-gate.ts): THE safety-critical chokepoint of Phase 4 -- the actual decision point that decides "callgittensory_open_prNOW" for an autonomous run. Conservatively requires BOTH a clean predicted-gate pass AND a slop band at or under a configurable threshold before a local-writeopen_praction spec is ever built. Any ambiguity (a missing/errored signal) resolves to NOT submitting -- never defaults to allow.Sequencing (why this is complementary to, not redundant with, the Governor chokepoint from #2340): this runs before
buildOpenPrSpec(src/mcp/local-write-tools.ts) is ever called -- i.e. before the chokepoint ever sees anopen_praction spec to evaluate. This gates on CONTENT-QUALITY signals (predicted-gate conclusion, slop risk) specific to the candidate diff; the chokepoint gates on RESOURCE/GOVERNANCE signals (rate-limit, budget, reputation, self-plagiarism, dry-run mode) that apply to every write action class, not justopen_pr.Input shape:
predictedGateVerdict/slopAssessmentare typed exactly as the fieldsSelfReviewVerdict(self-review-adapter.ts, #2334) already carries, so a caller can pass the SAME verdict the iterate-loop's own self-review (#2333) already computed at handoff time -- a defense-in-depth re-check immediately before submission, not a redundant re-computation.Deliverables, mapped:
shouldSubmit(candidate) -> { allow, reasons }requiring predicted-gate PASS AND slop-under-threshold -- done.predictedGateVerdict: null/slopAssessment: nullboth fail closed, never treated as "no opinion, so allow."buildOpenPrSpec/gittensory_open_pris gated exclusively through this function -- this PR ships the policy function itself; wiring a real call site is deliberately deferred to maintainer: wire the submission-gate trigger into the harness driving loop #2337 ("wire submission-gate into harness driving loop"), which exists as its own separate issue for exactly this -- mirrors maintainer: local create->score->self-review iterate-loop orchestrator (the control-flow core) #2333/maintainer: iterate-loop stop/abandon/handoff policy + Phase 4 handoff contract #2335's own split between loop mechanics and policy.packages/gittensory-miner(a separately-published npm CLI package) cannot import the private rootsrc/mcp/local-write-tools.tsdirectly anyway, the same cross-package boundary constraint that shaped maintainer: self-review adapter wiring iterate-loop diffs through predicted-gate + slop scoring #2334's slop-injection pattern.src/settings/autonomy.ts'sAUTONOMY_LEVELSdeny-by-default dial -- done.mode: "observe"structurally forcesallow: falseregardless of the underlying signals (not left to a caller to remember to also check mode), distinct from and evaluated separately from the Governor chokepoint's own dry-run/live action-mode dial (maintainer: dry-run-by-default enforcement #2342) -- this dial is specifically for safely calibrating the predicted-gate/slop thresholds against live traffic before ever trusting them to gate a real submission.Barrel-exported from the engine's public entrypoint.
Validation
Measured, not assumed:
(
--incremental falseon both commands is load-bearing -- the root tsconfig's inheritedincremental: truecache can silently no-op atscre-emit even on a 0 exit code, for the library build as well as the test build; see the local memory note I wrote after tripping over it twice this session.)submission-gate.js: 100.00% lines / 100.00% branch / 100.00% funcs.iterate-policy.jsandself-review-adapter.jsremain at 100% branch coverage (unaffected).Test plan
predictedGateVerdict: null,slopAssessment: null, and both null together.allow: falsefor an otherwise-passing candidate, and distinguishes a would-have-allowed decision from a would-have-blocked one (with the real underlying reasons preserved) in the audit trail.isSlopBandWithinThreshold's inclusive boundary (band === threshold passes) plus the fullclean < low < elevated < highordering exhaustively cross-checked.