Skip to content

feat(miner): extract contribution rules from AGENTS.md/CLAUDE.md as an agent_docs source - #8490

Closed
xfodev wants to merge 1 commit into
JSONbored:mainfrom
xfodev:feat/miner-agent-docs-contribution-source-8316
Closed

feat(miner): extract contribution rules from AGENTS.md/CLAUDE.md as an agent_docs source#8490
xfodev wants to merge 1 commit into
JSONbored:mainfrom
xfodev:feat/miner-agent-docs-contribution-source-8316

Conversation

@xfodev

@xfodev xfodev commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

The ContributionProfile schema (#6795) defines an "agent_docs" ContributionSignalSource — for repos that state contribution rules only in AI-agent docs — but the extractor (#6796) only ever fetched labels + CONTRIBUTING.md, leaving that source permanently unused despite #6794's research flagging it as a real-world pattern.

  • fetchAgentDocs — mirrors fetchContributing's exact shape (same signature, getJson+decodeContents probe loop, string | null return), probing AGENTS.md then CLAUDE.md at the repo root only (no .github/ variants — neither file follows that convention).
  • extractPrBody parameterized with an optional source/detail (defaulting to the current contributing_md/CONTRIBUTING.md literals) so existing callers are behavior-identical.
  • Precedence (exact): CONTRIBUTING.md stays authoritative whenever it yields a non-absent prBody rule (zero regression for any repo with a real CONTRIBUTING.md, including the "no linked-issue rule" case). Only when extractPrBody(contributing) is absent (no CONTRIBUTING.md at all) does the agent-doc candidate run through the same CONTRIBUTING_SIGNPOST_MAX_BYTES floor + LINKED_ISSUE_TERMS logic, tagged provenance source: "agent_docs".
  • No ContributionProfile field added — the result still lands in the existing prBody slot; only the provenance source differs.

Tests

test/unit/contribution-profile-extract.test.ts (+5, 31 pass): (1) CONTRIBUTING.md present → agent docs never fetched, source stays contributing_md; (2) no CONTRIBUTING.md, AGENTS.md large → agent_docs; (3) AGENTS.md missing but CLAUDE.md present → agent_docs (second probe path); (4) neither → stays absent; (5) agent doc below the signpost floor → stays unknown. Covers both sides of the absent gate, both probe paths, and the size-floor branch.

Validation

  • packages/loopover-miner builds clean (tsc -p); contribution-profile-extract test file green (31); sibling suites green (no regressions).
  • Rebased on latest main; no base conflict.
  • packages/loopover-miner/** is not Codecov-gated; still covered every new branch. No secret/wallet/hotkey/trust/reward terms.

Closes #8316

…n agent_docs source (JSONbored#8316)

The ContributionProfile schema (JSONbored#6795) defines an "agent_docs" ContributionSignalSource
for repos that state contribution rules only in AI-agent docs, but the extractor (JSONbored#6796)
only ever fetched labels + CONTRIBUTING.md, leaving that source permanently unused.

Add fetchAgentDocs (mirroring fetchContributing exactly — probe AGENTS.md then CLAUDE.md
at the repo root, first hit or null). Parameterize extractPrBody with an optional
source/detail (defaults preserve the CONTRIBUTING.md path unchanged). In
extractContributionProfile, agent docs are a strict fallback: CONTRIBUTING.md stays
authoritative whenever it yields a non-absent prBody rule; only when it is absent entirely
does the agent-doc candidate run through the same signpost-size + linked-issue logic,
tagged provenance source "agent_docs". No ContributionProfile field added — the result
still lands in the existing prBody slot.

Closes JSONbored#8316
@xfodev
xfodev requested a review from JSONbored as a code owner July 24, 2026 15:23
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.19%. Comparing base (e3a091e) to head (1d9443d).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...loopover-miner/lib/contribution-profile-extract.ts 0.00% 14 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) 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    #8490       +/-   ##
===========================================
+ Coverage   60.60%   89.19%   +28.59%     
===========================================
  Files         791       98      -693     
  Lines       79334    22804    -56530     
  Branches    23960     3905    -20055     
===========================================
- Hits        48078    20341    -27737     
+ Misses      27712     2285    -25427     
+ Partials     3544      178     -3366     
Flag Coverage Δ
shard-1 0.00% <0.00%> (?)
shard-2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...loopover-miner/lib/contribution-profile-extract.ts 0.00% <0.00%> (-46.60%) ⬇️

... and 693 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-24 15:43:47 UTC

2 files · 1 AI reviewer · 1 blocker · CI failing · unstable

🛑 Suggested Action - Reject/Close

Review summary
This adds an `agent_docs` fallback (AGENTS.md → CLAUDE.md) for the linked-issue prBody signal, wired to run only when CONTRIBUTING.md yields `absent`, with `extractPrBody` parameterized to keep existing CONTRIBUTING.md callers behavior-identical. The gating logic and precedence are correct and well tested for the source/confidence outcomes, but the provenance `detail` is hardcoded to `"AGENTS.md"` regardless of which file actually supplied the text, so a CLAUDE.md-sourced rule is misreported — and this is codified rather than caught by the new test suite.

Blockers

  • packages/loopover-miner/lib/contribution-profile-extract.ts:378 hardcodes `extractPrBody(agentDocs, "agent_docs", "AGENTS.md")` regardless of which file `fetchAgentDocs` actually returned; when AGENTS.md is absent and CLAUDE.md supplies the text (the exact scenario the new 'probes CLAUDE.md' test exercises), `provenance.detail` is wrongly recorded as `AGENTS.md` instead of `CLAUDE.md`, and the test at test/unit/contribution-profile-extract.test.ts:~871 asserts this wrong value instead of catching it — `fetchAgentDocs` needs to return (or the caller track) which path actually matched.
Nits — 5 non-blocking

Why this is blocked

  • packages/loopover-miner/lib/contribution-profile-extract.ts:378 hardcodes `extractPrBody(agentDocs, "agent_docs", "AGENTS.md")` regardless of which file `fetchAgentDocs` actually returned; when AGENTS.md is absent and CLAUDE.md supplies the text (the exact scenario the new 'probes CLAUDE.md' test exercises), `provenance.detail` is wrongly recorded as `AGENTS.md` instead of `CLAUDE.md`, and the test at test/unit/contribution-profile-extract.test.ts:~871 asserts this wrong value instead of catching it — `fetchAgentDocs` needs to return (or the caller track) which path actually matched.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. packages/loopover-miner/lib/contribution-profile-extract.ts:378 hardcodes \`extractPrBody\(agentDocs, "agent\_docs", "AGENTS.md"\)\` regardless of which file \`fetchAgentDocs\` actually returned; when AGENTS.md is absent and CLAUDE.md supplies the text \(the exact scenario the new 'probes CLAUDE.md' test exercises\), \`provenance.detail\` is wrongly recorded as \`AGENTS.md\` instead of \`CLAUDE.md\`, and the test at test/unit/contribution-profile-extract.test.ts:~871 asserts this wrong value instead of catching it — \`fetchAgentDocs\` needs to return \(or the caller track\) which path actually matched.

CI checks failing

  • codecov/patch — 0.00% of diff hit (target 99.00%)

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8316
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: 64 registered-repo PR(s), 29 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor xfodev; Gittensor profile; 64 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds fetchAgentDocs probing AGENTS.md then CLAUDE.md at repo root using the same getJson/decodeContents helpers, wires it into extractContributionProfile with the exact precedence rule (only invoked when CONTRIBUTING.md's prBody is absent), and tags provenance source as agent_docs, with tests covering all five required scenarios (CONTRIBUTING.md present, AGENTS.md fallback, CLAUDE.md fall

Review context
  • Author: xfodev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, TypeScript
  • Official Gittensor activity: 64 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). 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 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(miner): contribution-profile-extract.ts never checks AGENTS.md/CLAUDE.md despite the schema defining agent_docs as a signal source

1 participant