fix(engine): keep renderRepoMap's output within maxOutputChars including the marker (#9617) - #9628
Conversation
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-29 01:55:10 UTC
Review summary Nits — 5 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…ing the marker renderRepoMap's pushLine budgets every content line against maxOutputChars, but the truncation marker was appended via lines.push unbudgeted — so a truncated result overshot by up to the marker's length plus a newline, and in the degenerate case returned a marker longer than the budget with no content. maxOutputChars is a token-budget guarantee the prompt builder relies on. Reserve the marker (plus its joining newline) from the budget: on truncation, drop trailing content lines until the marker fits, and when the budget can't hold even the marker alone, return the empty string rather than an over-budget marker. A complete (non-truncated) render is byte-for-byte unchanged.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (55.55%) 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 #9628 +/- ##
==========================================
- Coverage 90.08% 90.07% -0.01%
==========================================
Files 889 889
Lines 112024 112041 +17
Branches 26587 26590 +3
==========================================
+ Hits 100921 100926 +5
- Misses 9773 9781 +8
- Partials 1330 1334 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
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. |
Problem
Closes #9617.
renderRepoMap(packages/loopover-engine/src/miner/repo-map.ts) is documented as a bounded outline, butpushLinebudgets only content lines — the truncation marker was appended vialines.pushunbudgeted, so a truncated result overshotmaxOutputCharsby up to the marker's length + a newline, and when the first line alone exceeded the budget it returned only an over-budget marker.maxOutputCharsis a token-budget guarantee the prompt packet relies on.Fix
Reserve the marker from the budget (extracted to a
TRUNCATION_MARKERconst):result.length <= maxOutputCharsalways.maxOutputChars< marker length → return the empty string, never an over-budget marker.Tests
test/unit/repo-map.test.ts: tightened the truncation test to the strict<= maxOutputCharsbound; added a case asserting the bound across a spread of budgets and that a sub-marker budget yields""while a marker-sized budget yields the marker alone; updated the four break-site tests to the new contract. 100% line + branch coverage on the changed file (verified via lcov: 119/119 lines, 90/90 branches).