fix(engine): keep renderRepoMap's output within maxOutputChars including the marker (#9617) - #9623
Conversation
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-29 01:23:53 UTC
Review summary Nits — 4 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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9623 +/- ##
==========================================
- Coverage 90.02% 90.01% -0.01%
==========================================
Files 888 888
Lines 111983 112000 +17
Branches 26570 26573 +3
==========================================
+ Hits 100810 100815 +5
- Misses 9843 9851 +8
- Partials 1330 1334 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…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.
|
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 that stops oncemaxOutputCharswould be exceeded and appends a truncation marker. ButpushLinebudgets only the content lines — the marker was appended vialines.pushunbudgeted:So a truncated result overshot
maxOutputCharsby up to the marker's length + a newline, and when the very first line already exceeded the budget it returned only the marker — a string longer than the budget with no content.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< the marker's length → return the empty string rather than an over-budget marker.Tests
test/unit/repo-map.test.ts: tightened the existing truncation test to the strict<= maxOutputCharsbound; added a case asserting the bound holds across a spread of budgets (0, near/below/above the marker length, …) 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 (a below-marker budget truncates at each site to""; the multi-symbol case keeps the fitting symbol alongside the reserved marker). 100% branch coverage on the changed file.