Skip to content

fix(github): search up to 10 comment pages for the marker before posting a duplicate (#7232)#7278

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/comment-marker-search-pagination-7232
Jul 19, 2026
Merged

fix(github): search up to 10 comment pages for the marker before posting a duplicate (#7232)#7278
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/comment-marker-search-pagination-7232

Conversation

@xfodev

@xfodev xfodev commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

createOrUpdateIssueCommentWithMarker — the single chokepoint every LoopOver PR-panel / agent-command comment
goes through — searches an issue/PR's existing comments for LoopOver's own marker comment so it can PATCH it
instead of posting a duplicate. That search was capped at COMMENT_SEARCH_PAGE_LIMIT = 3 (the first 300
comments). On a PR/issue that accrued more than 300 comments before LoopOver's own, the marker fell outside the
search window, so every re-gate cycle POSTed a brand-new panel comment instead of updating the existing one.

This raises the cap to 10 pages (up to 1,000 comments), matching src/github's other pagination bounds
(app.ts's MAX_WORKFLOW_RUN_LIST_PAGES, pr-actions.ts's REVIEW_PAGE_LIMIT). The existing
if (batch.length < 100) break; early-exit is unchanged, so a short comment list still costs a single request;
per_page: 100 and the bot/marker filtering are untouched. Common-case behavior (< 300 comments) is identical.

Closes #7232

Scope

  • Conventional Commit title; focused (one constant + its tests); no site//CNAME/lovable; no new dependency.
  • Linked a currently open issue (Closes #7232).

Validation

  • git diff --check
  • npm run typecheck (root — clean)
  • npm run test:coverage100% of the changed lines covered. New regression: a marker comment on page 4
    (beyond the old 300-comment cap) is now found and PATCHed rather than duplicated; the existing bound-enforcement
    test is updated to assert the search still stops (now at 10 pages, not unbounded).

If any required check was skipped, explain why:

  • Change confined to src/github/comments.ts (a non-guarded path) + its test; CI runs the full suite.

Safety

  • No secrets, wallets, hotkeys, coldkeys, PATs, trust scores, or private data exposed.
  • Public GitHub text stays sanitized and low-noise — this REDUCES duplicate public comments.
  • The search remains bounded (10 pages), so it cannot spin unboundedly on a pathological comment list.
  • No auth/CORS/session/API/OpenAPI/MCP surface change — one internal pagination bound; the read is idempotent.
  • No UI change — no UI Evidence needed.

@xfodev
xfodev requested a review from JSONbored as a code owner July 19, 2026 12:03
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.81%. Comparing base (c743eca) to head (915bdba).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7278   +/-   ##
=======================================
  Coverage   93.81%   93.81%           
=======================================
  Files         704      704           
  Lines       69458    69458           
  Branches    18896    18896           
=======================================
  Hits        65163    65163           
  Misses       3302     3302           
  Partials      993      993           
Flag Coverage Δ
shard-1 43.16% <100.00%> (-0.45%) ⬇️
shard-2 37.39% <100.00%> (+0.16%) ⬆️
shard-3 33.05% <100.00%> (-0.05%) ⬇️
shard-4 32.73% <100.00%> (-1.60%) ⬇️
shard-5 32.77% <100.00%> (+0.59%) ⬆️
shard-6 46.06% <100.00%> (+0.27%) ⬆️

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

Files with missing lines Coverage Δ
src/github/comments.ts 100.00% <100.00%> (ø)

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

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-19 12:15:42 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a minimal, well-targeted one-constant fix: raising COMMENT_SEARCH_PAGE_LIMIT from 3 to 10 so the marker-comment search covers up to 1,000 comments instead of 300, matching sibling pagination caps elsewhere in src/github. The change is correctly traced to its real cause (the search loop in comments.ts genuinely stops early at page 3, so a marker beyond comment 300 was unreachable and would cause a duplicate POST), and the new test manufactures a realistic scenario (100-comment pages of chatter, marker on page 4) that actually exercises the same loop and PATCH path used in production. The existing bound-enforcement test was correctly updated to assert the loop still stops, now at 10 pages rather than 3, preserving the guarantee against unbounded pagination.

Nits — 4 non-blocking
  • The 10-page/1,000-comment cap is still an arbitrary ceiling — an issue with >1,000 comments before the marker will still regress to duplicate-posting, so consider a code comment noting this residual limit is accepted as unlikely in practice.
  • test/unit/github-comments.test.ts's new page-4 test builds comment IDs via `page * 1000 + i`, which is fine here but slightly fragile if page counts change; a named constant would make intent clearer.
  • Consider whether COMMENT_SEARCH_PAGE_LIMIT should be extracted to a shared constants module since three files now duplicate similar pagination-cap patterns (app.ts, pr-actions.ts, comments.ts).
  • The new test could assert on the exact number of GET calls made (4) to further guard against accidental over-fetching beyond the marker's page, similar to the bound-enforcement test's assertion on page order.

Decision drivers

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

Addressed
The PR raises COMMENT_SEARCH_PAGE_LIMIT from 3 to 10 with an explanatory comment matching sibling bounds, preserves the batch.length<100 early-exit, and adds a regression test placing the marker comment on page 4 to verify PATCH-not-duplicate behavior plus an updated bound-enforcement test.

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: 27 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.
🧪 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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 18fe746 into JSONbored:main Jul 19, 2026
15 checks passed
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.

comments.ts's marker-comment search caps at 300 comments, unlike every sibling pagination bound in src/github/**

1 participant