Skip to content

fix(predict-gate): resolve contributor confirmation for gate prediction - #715

Merged
JSONbored merged 9 commits into
JSONbored:mainfrom
galuis116:fix/predict-gate-confirmed-contributor
Jun 17, 2026
Merged

fix(predict-gate): resolve contributor confirmation for gate prediction#715
JSONbored merged 9 commits into
JSONbored:mainfrom
galuis116:fix/predict-gate-confirmed-contributor

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

The pre-submission gate prediction — the gittensory_predict_gate MCP tool (#693/#712) and the /v1/local/branch-analysis self-gate (#688) — never passed confirmedContributor to buildPredictedGateVerdict, so it stayed undefined.

The prediction promises strict parity with the maintainer gate (see predicted-gate.ts header: "the same verdict the gate would compute post-submission" and "Only confirmed Gittensor contributors are ever hard-blocked"). The real gate enforces that in evaluateGateCheck:

if (policy.confirmedContributor === false && blockers.length > 0) {
  return { conclusion: "neutral", ... }; // non-confirmed authors are never hard-blocked
}

The maintainer pipeline resolves a concrete boolean (processors.ts): const confirmedContributor = official?.status === "confirmed";. The prediction callers didn't — and undefined === false is false, so the neutral branch was skipped and any fired blocker produced conclusion: "failure".

Impact: under the default gittensor pack, 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:

  • API route (/v1/local/branch-analysis): reuse the already-fetched context.gittensorSnapshot — it's non-null only when fetchGittensorContributorSnapshot confirms the login, matching official?.status === "confirmed". Zero new fetch.
  • MCP predictGate: resolve fetchGittensorContributorSnapshot(login) !== null, gated behind the pack so the oss-anti-slop pack (which drops the contributor gate entirely) stays account-free and fetch-free.

No change to buildPredictedGateVerdict itself — it already accepted confirmedContributor and handled the oss-anti-slop override; the callers simply never supplied it.

Tests

The existing predicted-gate.test.ts locked the function-level parity by explicitly passing confirmedContributor: false — a path no real caller exercised, which masked the bug. Added caller-level regression tests in mcp-predict-gate.test.ts (stubbing the Gittensor /miners endpoint) under the gittensor pack:

  • non-confirmed contributor + blocker → neutral (confirmedContributor: false),
  • confirmed contributor + same blocker → failure (confirmedContributor: true).

Full coverage suite green locally (only the known CRLF-local gittensory-focus-manifest and the local mcp-cli timeouts fail locally; both pass in CI).

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.
@ghost

ghost commented Jun 14, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #715 is no longer open. No action.

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

@ghost ghost added the gittensory:reviewed label Jun 14, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@ghost

ghost commented Jun 14, 2026

Copy link
Copy Markdown

gittensory · advisory review

Reviewed 3 changed file(s) — two independent AI reviewers.

Changed files: package.json, src/mcp/server.ts, test/unit/mcp-predict-gate.test.ts

Suggested action:Safe to merge — both reviewers found no blocking issues.

Reviewer A · gpt-oss-120b — recommends ✅ merge
The PR adds contributor confirmation handling to gate prediction, updates dependencies, and introduces comprehensive tests verifying the new logic under various scenarios.

Suggestions

  • Remove the newly added ws, tar, and js-yaml dependencies from package.json if they are not used, to keep the bundle size minimal.
  • Confirm that fetchGittensorContributorSnapshot safely catches network errors and returns null so the added await does not cause unhandled rejections.
  • Verify that buildPredictedGateVerdict’s TypeScript signature includes the optional confirmedContributor field to avoid compile‑time errors.

Worth double-checking

  • If fetchGittensorContributorSnapshot does not handle fetch failures internally, the prediction endpoint could throw on network errors.
  • Unused dependencies could increase build time and surface attack surface.

Reviewer B · mistral-small-3.1-24b-instruct — recommends ✅ merge
This PR fixes a parity issue in the contributor confirmation logic for gate prediction in the Gittensory MCP server. It adds necessary checks to ensure that only confirmed Gittensor contributors are hard-blocked, and it includes comprehensive tests to cover the new behavior. The changes are well-documented and follow the project's conventions.

Suggestions

  • Consider adding a comment explaining why ws, tar, and js-yaml are being added to package.json.
  • Ensure that the fetchGittensorContributorSnapshot function is thoroughly tested, especially for edge cases like network failures.

Worth double-checking

  • Verify that the new logic does not introduce any performance bottlenecks, especially with the additional network call to the Gittensor API.
  • Double-check that the tests cover all possible scenarios, including cases where the Gittensor API might return unexpected results.

…nfirmed-contributor

# Conflicts:
#	src/api/routes.ts
#	test/unit/mcp-predict-gate.test.ts
@dosubot dosubot Bot added size:XS and removed size:S labels Jun 16, 2026
@ghost ghost removed gittensory-review labels Jun 16, 2026
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 JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 16, 2026

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ghost ghost mentioned this pull request Jun 16, 2026
5 tasks
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.68%. Comparing base (8bdd2bd) to head (be92de6).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

galuis116 and others added 2 commits June 16, 2026 15:30
…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.
@galuis116
galuis116 requested a review from JSONbored June 17, 2026 02:25

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dosubot dosubot Bot added the lgtm label Jun 17, 2026
@JSONbored
JSONbored merged commit e99d427 into JSONbored:main Jun 17, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 17, 2026
@github-actions github-actions Bot mentioned this pull request Jun 17, 2026
12 tasks
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.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants