Skip to content

feat(miner-governor): gated-submission trigger requiring predicted-gate PASS + slop-under-threshold (#2336) - #5045

Merged
JSONbored merged 1 commit into
mainfrom
feat/miner-submission-gate-2336
Jul 11, 2026
Merged

feat(miner-governor): gated-submission trigger requiring predicted-gate PASS + slop-under-threshold (#2336)#5045
JSONbored merged 1 commit into
mainfrom
feat/miner-submission-gate-2336

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

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 "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.

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 an open_pr action 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 just open_pr.

Input shape: predictedGateVerdict/slopAssessment are typed exactly as the fields SelfReviewVerdict (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:

Barrel-exported from the engine's public entrypoint.

Validation

Measured, not assumed:

npx tsc -p tsconfig.json --incremental false && npx tsc -p tsconfig.test.json --incremental false && node --experimental-test-coverage --test "dist-test/**/*.test.js"

(--incremental false on both commands is load-bearing -- the root tsconfig's inherited incremental: true cache can silently no-op a tsc re-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.)

  • 439/439 tests pass across the whole engine package.
  • submission-gate.js: 100.00% lines / 100.00% branch / 100.00% funcs.
  • iterate-policy.js and self-review-adapter.js remain at 100% branch coverage (unaffected).

Test plan

  • pass/pass allows, with an empty reasons array.
  • fail/pass blocks, with the predicted-gate blocker codes joined into the reason string; also covers the no-blockers-listed case (no dangling separator).
  • pass/fail blocks, with the slop band/threshold pair in the reason string.
  • both-fail blocks, with both reasons listed.
  • Every fail-closed path: predictedGateVerdict: null, slopAssessment: null, and both null together.
  • Observe mode: forces allow: false for 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 full clean < low < elevated < high ordering exhaustively cross-checked.

…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-security

Copy link
Copy Markdown
Contributor

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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 11, 2026
@loopover-orb

loopover-orb Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-11 10:36:36 UTC

3 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
AI review could not be completed for this PR head. Gittensory is holding this PR for manual review instead of relying on deterministic signals alone.

Nits — 1 non-blocking
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2336
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: 47 registered-repo PR(s), 39 merged, 428 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 47 PR(s), 428 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ✅ Minor risk: clean · value: minor — Code changes are accompanied by test evidence.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Ruby, Go, JavaScript, MDX, Shell, Solidity
  • Official Gittensor activity: 47 PR(s), 428 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
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

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 11, 2026
@JSONbored
JSONbored merged commit e6efe87 into main Jul 11, 2026
13 checks passed
@JSONbored
JSONbored deleted the feat/miner-submission-gate-2336 branch July 11, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

maintainer: gated-submission trigger — predicted-gate-PASS + slop-under-threshold check before calling open_pr

1 participant