Skip to content

feat(mcp): add deterministic output budgets#74

Open
100yenadmin wants to merge 1 commit into
reconcile/r11-mcp-parameter-aliasesfrom
reconcile/r12-mcp-output-budgets
Open

feat(mcp): add deterministic output budgets#74
100yenadmin wants to merge 1 commit into
reconcile/r11-mcp-parameter-aliasesfrom
reconcile/r12-mcp-output-budgets

Conversation

@100yenadmin

Copy link
Copy Markdown
Member

Capability

Implements R12: deterministic MCP output budgets for query, context, and impact.

  • Adds optional positive-integer maxTokens to the three bounded tools.
  • Adds optional GITNEXUS_MCP_DEFAULT_MAX_TOKENS; an explicit request wins.
  • Applies the budget to the complete formatted response, including next-step hints and the truncation marker.
  • Keeps responses byte-for-byte unchanged when no budget is configured.
  • Truncates deterministically at UTF-8 code-point boundaries with the complete marker inside the estimated budget.
  • Strips the transport-only maxTokens field before backend dispatch.
  • Applies the same bound to backend error text while rejecting malformed budgets before backend execution.

The budget uses a documented deterministic estimate of four UTF-8 bytes per token. It is an output-envelope control, not provider-specific tokenization.

Evidence

  • Focused Vitest: 57 passed across budget helpers, MCP server behavior, and tool schemas.
  • TypeScript: npx tsc --noEmit passed.
  • Build: npm run build passed, including the web bundle.
  • Targeted ESLint: zero errors; existing warnings only.
  • Prettier and git diff --check: passed.
  • Live-index safety: the isolated worktree remains unregistered; gitnexus detect-changes refused rather than touching the registered index.
  • Detailed retained evidence: /Volumes/LEXAR/Codex/session-notes/2026-07-13/gitnexus-fork-upstream-reconciliation/r12-mcp-output-budgets.md.

Stack And Gate

  • Base: reconcile/r11-mcp-parameter-aliases.
  • Head: f5b218c4bfb94171771bdeceb3371e94a2924484.
  • This PR is intentionally stacked and must not merge before R11 lands and the base is retargeted to the integration branch.
  • Publication, runtime rollout, live-index mutation, and default-branch promotion are outside this PR.

Closes #51 after merge.
Parent epic: #39.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0130f831-a153-4131-ae93-cfad921d91a7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch reconcile/r12-mcp-output-budgets

Comment @coderabbitai help to get the list of available commands.

@evaos-code-review-bot

evaos-code-review-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

evaOS review status: completed

PR: #74 - feat(mcp): add deterministic output budgets
Head: f5b218c4bfb94171771bdeceb3371e94a2924484
Updated: 2026-07-13T13:19:36.551Z

evaOS review completed for this PR head.

Automation note: agents should wait for this comment to reach completed, stale_head, closed_or_merged_before_review, skipped, or failed before treating evaOS review as settled for this head. provider_deferred means evaOS still intends to retry.

PR URL: #74

Review URL: #74 (review)

@github-actions

Copy link
Copy Markdown

CI Report

All checks passed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
✅ Tests success unit tests, 3 platforms
✅ E2E success gitnexus-web changes only

Test Results

Tests Passed Failed Skipped Duration
14578 14516 0 62 21s

✅ All 14516 tests passed

62 test(s) skipped — expand for details

Code Coverage

Tests

Metric Coverage Covered Base Delta Status
Statements 80.73% 54077/66977 N/A% 🟢 ████████████████░░░░
Branches 67.77% 33071/48798 N/A% 🟢 █████████████░░░░░░░
Functions 86.8% 6234/7182 N/A% 🟢 █████████████████░░░
Lines 84.26% 48240/57249 N/A% 🟢 ████████████████░░░░

📋 View full run · Generated by CI

@evaos-code-review-bot evaos-code-review-bot 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.

Walkthrough

PR: #74 - feat(mcp): add deterministic output budgets
Head: f5b218c4bfb94171771bdeceb3371e94a2924484 into reconcile/r11-mcp-parameter-aliases. Review event: COMMENT.
Provider: GLM/Z.ai through ZCode (zcode-glm, zcode, model GLM-5.2).

Estimated review effort: 1/5 (~10 min)

Changed Files

File Status Churn Purpose Risk

Review Signal

No validated inline findings.
Dropped findings before posting: 2. High-severity findings: 0.

Risk Taxonomy

No finding categories.

Validation and Proof

1 required validation/proof recommendation(s) selected from changed files.

  • required: TypeScript/web build or CI proof - Runtime TypeScript/web files or package/config files changed. Proof: npm run build; typecheck; focused Vitest; green GitHub check.
    Proof status: sufficient - PR metadata mentions acceptable proof for each required validation recommendation.
    Profile validation hints: Call out stale index, wrong repo identity, memory growth, and destructive analyze behavior.
    Profile proof expectations: Look for focused CLI, index, query, or migration proof.

Related Context

Related issues/PRs: #51, #39.
Suggested labels: none.
Suggested reviewers: none from current metadata.

Review Settings Preview

  • Profile: assertive
  • Enabled sections: Review summary (inline_review); Walkthrough (inline_review); Changed-files table (walkthrough); Effort estimate (walkthrough); Related issues/PRs (walkthrough); Suggested labels (suggestion_only); Review status comment (sticky_status)
  • Path instructions: none
  • Label suggestions: gitnexus, code-intelligence, backend
  • Reviewer suggestions: none
  • Suggestion behavior: suggestions only; labels and reviewers are not auto-applied.
  • Roadmap-only settings: auto-apply labels; auto-request reviewers; required status checks

Pre-merge checklist

  • Inline comments target current RIGHT-side diff lines.
  • No secret-like content survived into posted inline comments.
  • REQUEST_CHANGES is only used when eligible P0/P1 findings survive validation.
  • Required behavior proof is present or not applicable.
  • Labels and reviewers are suggestions only; the bot did not auto-apply them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant