fix(predict-gate): resolve contributor confirmation for gate prediction - #715
Conversation
The pre-submission gate prediction (gittensory_predict_gate MCP tool and the /v1/local/branch-analysis self-gate) never passed confirmedContributor, leaving it undefined. Under the default gittensor pack only confirmed Gittensor contributors are ever hard-blocked, so a non-confirmed contributor whose synthetic PR tripped a blocker was told 'failure' when the real maintainer gate returns 'neutral' for them — breaking the documented pre/post-submission parity. Resolve the caller's own confirmed status the same way the pipeline does (official Gittensor API -> confirmed): reuse the already-fetched gittensorSnapshot in the API route, and gate a lookup behind the pack in the MCP tool (oss-anti-slop drops the contributor gate, so it's skipped there). Add MCP regression tests for both non-confirmed -> neutral and confirmed -> failure.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 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. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 3 changed file(s) — two independent AI reviewers. Changed files: Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
…nfirmed-contributor # Conflicts: # src/api/routes.ts # test/unit/mcp-predict-gate.test.ts
The CI validate job's npm audit step failed on 9 advisories (2 moderate, 7 high) — all transitive in the dev toolchain. The 7 high all trace to ws (via miniflare/wrangler/vitest-pool-workers); tar and js-yaml are the two moderate. Pin patched versions via overrides (ws ^8.21.0, tar ^7.5.16, js-yaml ^4.2.0) — same-major, non-breaking — following the existing esbuild override pattern. npm audit --audit-level=moderate now reports 0. Also syncs the stale packages/gittensory-mcp lockfile version (0.5.0 -> 0.6.0, matching its package.json) left by the upstream merge.
JSONbored
left a comment
There was a problem hiding this comment.
PR #715 — fix(predict-gate): resolve contributor confirmation for gate prediction
Author: galuis116 | CI: ✅ pass | Status: Concerns
ACTION: REQUEST CHANGES
Highlights:
- Correct gate-parity fix: passes confirmedContributor so non-confirmed contributors get neutral not failure — mirrors evaluateGateCheck. Moves in the SAFE direction (less likely to block outsiders), does not weaken auth.
- oss-anti-slop pack stays account/fetch-free; gittensor pack resolves via fetchGittensorContributorSnapshot(login) !== null, matching the confirmed-status pipeline.
- Caller-level regression tests added (confirmed→failure, non-confirmed→neutral).
Change requests / reasons:
- New fetchGittensorContributorSnapshot is now on the prediction path: add SSRF-guard confirmation + a network-failure/error-path test.
- failing CI
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #715 +/- ##
=======================================
Coverage 96.68% 96.68%
=======================================
Files 93 93
Lines 13769 13771 +2
Branches 5015 5017 +2
=======================================
+ Hits 13312 13314 +2
Misses 88 88
Partials 369 369 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…rmation lookup Per the review: when the Gittensor confirmation lookup on the prediction path throws/times out, the contributor is treated as non-confirmed → the gate stays neutral (fail-safe), never a false failure. The lookup hits a fixed constant base URL with the login filtered client-side (never interpolated into the URL), so there is no SSRF surface.
JSONbored
left a comment
There was a problem hiding this comment.
PR #715 — fix(predict-gate): resolve contributor confirmation for gate prediction
Verdict: MERGE
Resolves issue: N/A (bugfix referencing #693/#712/#688, no direct "Fixes")
CI: All green (validate, test x2, lint, workers, ui, security, Superagent Security Scan = success, codecov). gittensory/Context neutral.
Highlights:
- Correctly diagnoses the real bug: callers never passed confirmedContributor, leaving it undefined; since undefined === false is false, the "non-confirmed authors are never hard-blocked" neutral branch was skipped and fired blockers produced a false failure — opposite of the real gate outcome for the first-time/agent users this self-check targets.
- Resolves confirmed status the same way the maintainer pipeline does: API route reuses the already-fetched gittensorSnapshot (zero new fetch); MCP predictGate resolves fetchGittensorContributorSnapshot(login) !== null, gated behind the pack so oss-anti-slop stays account/fetch-free. buildPredictedGateVerdict itself unchanged (right surface).
- Meaningful caller-level regression tests: non-confirmed+blocker -> neutral, confirmed+blocker -> failure, API-failure -> fail-safe neutral.
Concerns / required changes:
- package.json adds ws/tar/js-yaml under the lovable overrides block — unrelated to a predict-gate fix, most likely a rebase/transitive-pin artifact. Confirm it's an intentional security pin rather than stray scope; not a blocker.
Completeness vs issue: Fully closes the parity gap in both callers with the correct neutral/failure/fail-safe regression matrix. Correct and complete as a standalone bugfix.
Summary
The pre-submission gate prediction — the
gittensory_predict_gateMCP tool (#693/#712) and the/v1/local/branch-analysisself-gate (#688) — never passedconfirmedContributortobuildPredictedGateVerdict, so it stayedundefined.The prediction promises strict parity with the maintainer gate (see
predicted-gate.tsheader: "the same verdict the gate would compute post-submission" and "Only confirmed Gittensor contributors are ever hard-blocked"). The real gate enforces that inevaluateGateCheck:The maintainer pipeline resolves a concrete boolean (
processors.ts):const confirmedContributor = official?.status === "confirmed";. The prediction callers didn't — andundefined === falseisfalse, so the neutral branch was skipped and any fired blocker producedconclusion: "failure".Impact: under the default
gittensorpack, every non-confirmed contributor (i.e. the first-time / agent users this self-check exists for) whose synthetic PR trips an opted-in blocker (e.g.duplicates: "block", the default) was told "failure — your PR will be blocked", when the real post-submission gate returns neutral / non-blocking for them. The prediction was the opposite of the real outcome for exactly its target audience.Fix
Resolve the caller's own confirmed status the same way the pipeline does (official Gittensor API → confirmed) and pass it through:
/v1/local/branch-analysis): reuse the already-fetchedcontext.gittensorSnapshot— it's non-null only whenfetchGittensorContributorSnapshotconfirms the login, matchingofficial?.status === "confirmed". Zero new fetch.predictGate: resolvefetchGittensorContributorSnapshot(login) !== null, gated behind the pack so theoss-anti-sloppack (which drops the contributor gate entirely) stays account-free and fetch-free.No change to
buildPredictedGateVerdictitself — it already acceptedconfirmedContributorand handled theoss-anti-slopoverride; the callers simply never supplied it.Tests
The existing
predicted-gate.test.tslocked the function-level parity by explicitly passingconfirmedContributor: false— a path no real caller exercised, which masked the bug. Added caller-level regression tests inmcp-predict-gate.test.ts(stubbing the Gittensor/minersendpoint) under thegittensorpack:neutral(confirmedContributor: false),failure(confirmedContributor: true).Full coverage suite green locally (only the known CRLF-local
gittensory-focus-manifestand the localmcp-clitimeouts fail locally; both pass in CI).