Skip to content

fix(mcp): align linked-issue extraction with server after #4039 - #4054

Closed
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-mcp-linked-issue-extractor-parity
Closed

fix(mcp): align linked-issue extraction with server after #4039#4054
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-mcp-linked-issue-extractor-parity

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

Fixes a correctness bug where MCP local-branch analysis and the predicted-gate engine still used a stale linked-issue extractor after server-side fixes in #4039 (inline code spans) and #3862 (qualified owner/repo#N scoping).

Root cause

packages/gittensory-mcp/lib/local-branch.js extractLinkedIssues() scanned raw text without stripping markdown inline code. This repo's PR template checklist literally contains (e.g. Closes #123), so every local branch analysis that keeps that line spuriously reports linkedIssues: [123]. Those values are POSTed to /v1/local/branch-analysis and merged server-side, corrupting predicted-gate verdicts, collision signals, and duplicate detection.

The predicted-gate engine copy in packages/gittensory-engine/src/signals/predicted-gate-engine.ts had the same missing code-span strip, causing predictedGate and preflight to disagree inside one API response.

Fix

  • Port the canonical repositories.ts extractor logic into MCP extractLinkedIssues(text, repoFullName)
  • Pass repoFullName from collectLocalBranchMetadata
  • Align predicted-gate-engine extractLinkedIssueNumbers with the same strip + unified regex
  • Regression tests mirroring test/unit/db-parsers.test.ts template-checklist case

Impact

Local MCP users and miners running gittensory_predict_gate no longer get false linked-issue matches from template boilerplate; gate predictions align with server preflight.

Tracking issue

No open contributor-eligible upstream issue exists for this parity gap (maintainer PR #4039 merged without filing one; CreateIssue is denied for external contributors). Please create/associate a gittensor:bug tracking issue before merge per CONTRIBUTING policy.

Test plan

  • npm run typecheck
  • npm run build:mcp
  • npx vitest run test/unit/local-branch.test.ts test/unit/predicted-gate-engine-branch-coverage.test.ts test/unit/db-parsers.test.ts

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 7, 2026 16:13
@RealDiligent RealDiligent mentioned this pull request Jul 7, 2026
12 tasks
@superagent-security

Copy link
Copy Markdown
Contributor

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

Port inline code-span stripping and qualified owner/repo#N scoping from
repositories.ts (JSONbored#4039/JSONbored#3862) into the MCP local-branch mirror and the
predicted-gate engine so template checklist text does not spuriously link
issue JSONbored#123 and branch-analysis gate predictions match server preflight.

Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-07 16:20:06 UTC

4 files · 1 AI reviewer · 2 blockers · readiness 100/100 · CI pending · blocked

🛑 Suggested Action - Reject/Close

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • AI reviewers agree on a likely critical defect: No linked/associated eligible open issue: the PR description itself states none exists and explicitly asks a maintainer to file a `gittensor:bug` tracking issue before merge, which this repo's contributor-PR policy requires regardless of fix quality. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This ports the canonical server-side linked-issue extractor (inline code-span stripping + owner/repo#N scoping from #4039/#3862) into the MCP local-branch analyzer and the predicted-gate engine, closing a real divergence where this repo's own PR template checklist text `(e.g. \`Closes #123\`)` was being parsed as a genuine issue link. The fix lands at the correct layer (all three extractors now share identical strip+regex+dedup logic) and the new tests exercise the actual failing input — the literal template line — rather than a fabricated payload, so this is real coverage, not theater. The PR's own description states no eligible tracking issue exists for this repo and asks a maintainer to create one before merge, which is the primary open item.

Blockers

  • No linked/associated eligible open issue: the PR description itself states none exists and explicitly asks a maintainer to file a `gittensor:bug` tracking issue before merge, which this repo's contributor-PR policy requires regardless of fix quality.
Nits — 5 non-blocking
  • packages/gittensory-mcp/lib/local-branch.js: the diff only shows the call-site line passing `repoFullName` into `extractLinkedIssues(...)`; confirm `repoFullName` is actually in scope in `collectLocalBranchMetadata` (not shown in the truncated diff) since the function previously didn't reference it.
  • packages/gittensory-mcp/lib/local-branch.js: `extractLinkedIssues` now dedupes internally via a `seen` Set, but its only call site already wraps the result in `[...new Set([...])]` — the internal dedup is redundant, not wrong.
  • The intentional behavior change of dropping keyword-less bare `feat(data): add contributor reconciliation reports #123` matching in the MCP extractor is a user-visible change for any local caller relying on old behavior; worth a one-line CHANGELOG/README note since MCP is also consumed by external tooling, not just this repo's server.
  • Attach or create the tracking issue referenced in the PR description before merge, per repo policy.
  • Add a brief comment or test at the `local-branch.js` call site confirming `repoFullName`'s source (e.g. parsed from git remote) so future readers don't need to trace it themselves.

Why this is blocked

  • No linked/associated eligible open issue: the PR description itself states none exists and explicitly asks a maintainer to file a `gittensor:bug` tracking issue before merge, which this repo's contributor-PR policy requires regardless of fix quality.
  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ✅ Linked #123
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: 248 registered-repo PR(s), 73 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 248 PR(s), 0 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, Ruby, Svelte, TypeScript, Cuda, Markdown
  • Official Gittensor activity: 248 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (No linked issue detected; AI reviewers agree on a likely critical defect: No linked/associated eligible open issue: the PR description itself states none exists and explicitly asks a maintainer to file a `gittensor:bug` tracking issue before merge, which this repo's contributor-PR policy requires regardless of fix quality.; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 7, 2026
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.58%. Comparing base (0979321) to head (cd4f08f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ensory-engine/src/signals/predicted-gate-engine.ts 90.90% 0 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (90.90%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4054      +/-   ##
==========================================
- Coverage   93.59%   93.58%   -0.01%     
==========================================
  Files         379      379              
  Lines       35575    35582       +7     
  Branches    13044    13045       +1     
==========================================
+ Hits        33295    33301       +6     
  Misses       1618     1618              
- Partials      662      663       +1     
Files with missing lines Coverage Δ
...ensory-engine/src/signals/predicted-gate-engine.ts 99.67% <90.90%> (-0.33%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant