feat(output-budget): adaptive caps for trace, explore, and node#152
Conversation
Scale snippet char budgets and explore row limits from indexed file count when callers omit budget_chars; explicit overrides unchanged.
🦋 Changeset detectedLatest commit: 4c557c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reached
More reviews will be available in 30 minutes and 58 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR implements adaptive output budgeting where snippet character limits and explore row caps scale dynamically based on indexed file count, replacing fixed compile-time defaults. The system is integrated into trace/explore/node composition and includes comprehensive test coverage and documentation updates. ChangesAdaptive Output Budgets
Sequence DiagramsequenceDiagram
participant Client
participant TraceEngine
participant OutputBudget
participant Database
Client->>TraceEngine: explore(rowLimit?, budgetChars?)
TraceEngine->>Database: open()
TraceEngine->>OutputBudget: resolveEffectiveExploreRowLimit(db, rowLimit?)
OutputBudget->>Database: readIndexedFileCount(db)
Database-->>OutputBudget: indexed_file_count
OutputBudget->>OutputBudget: resolveOutputBudget(file_count)
OutputBudget-->>TraceEngine: adaptive_row_limit
TraceEngine->>OutputBudget: resolveEffectiveSnippetBudget(db, budgetChars?)
OutputBudget->>OutputBudget: resolveOutputBudget(file_count)
OutputBudget-->>TraceEngine: adaptive_snippet_budget
TraceEngine->>TraceEngine: compose explore result with caps
TraceEngine-->>Client: truncated result
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…COUNT Add composer-level adaptive budget tests, resolveEffectiveOutputBudget for one file-count read in explore, and doc/MCP tier alignment.
Cover composeExploreResult snippet truncation parity with trace/node and align architecture/skill docs with 15k/10k/6k tier numerics.
Explore row limits are always adaptive; only snippet budgets honor explicit budget_chars on MCP/HTTP.
Remove unused resolveEffectiveExploreRowLimit export, add mid-tier and split-budget integration tests, MCP explore/node transport smoke, and mcp-instructions tier docs.
Summary
resolveOutputBudget(file_count)inoutput-budget.tswith the same 500 / 5000 tier boundaries asresolveContextBudget.composeTraceResult,composeExploreResult, andcomposeNodeResultwhenbudget_chars/ row cap are omitted.budget_charsandrowLimitoverrides remain unchanged.Tier table (when omitted)
Test plan
output-budget.test.ts— tier unit tests + DB-backed effective budget resolutiontrace-engine.test.ts— existing trace/explore/node tests passbun run checkgreenSummary by CodeRabbit
New Features
Tests
Documentation
Chores