GeezerVison is showing github.com — fix(server): clamp t3_thread_read page sizes instead of rejecting them by fixfon · Pull Request #22622 · pingdotgg/t3code
Conversation
Closes #22618
Problem
Codex drops minimum and maximum from the tool declaration it shows the model, so models can't see the bounds on t3_thread_read's limit (100), runLimit (50) and maxCharsPerItem (50000). They send values like maxCharsPerItem: 60000, and the call fails with InvalidParams (-32602) before the handler runs. The report saw this on 37 of 202 calls.
Change
packages/contracts/src/orchestratorMcp.ts: the three fields now use a small clampedPositiveInt(maximum, description) schema. A value above the maximum is clamped to it on decode, so the handler sees the clamped value and the existing nextPosition / nextTextOffset pagination covers the rest.
- Each field's description states its range and the clamp, since the description is the part Codex keeps. The
t3_thread_read tool description is unchanged.
- Values below 1 still fail.
runLimit: 0 means "no runs", and answering it with one run would be a different request.
The advertised JSON schema no longer carries maximum: 100 / 50 / 50000, because it's exported from the same schema the server decodes with, and that schema now has to accept larger values.
Verification
- Three tests in
apps/server/src/mcp/McpHttpServer.test.ts go through the real toolkitRegistration path with the real t3_thread_read definition: over-maximum values reach the handler clamped and in-range values are unchanged; 0 on each field is still rejected without calling the handler; the advertised input schema contains each field's bound text. No timeouts, polling or clocks.
vp test run src/mcp/McpHttpServer.test.ts in apps/server: 19/19 pass. With orchestratorMcp.ts reverted to main, the clamp and description tests fail (the clamp test with Expected a value less than or equal to 100) and the other 17 pass.
OrchestratorMcpToolkit.integration, OrchestratorMcpService, OrchestratorMcpService.activity, McpToolAccess and the contracts orchestratorMcp.test.ts pass.
vp fmt and vp lint on both files are clean, and typecheck passes for packages/contracts and apps/server.
Not changed here: other tools with the same reject-above-maximum pattern (t3_thread_list's limit and a few toolkit inputs). The helper can be reused for them if that's wanted.
Claude Sonnet 5.5 (xhigh) via T3 Code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex hides the minimum/maximum bounds on `limit`, `runLimit` and
`maxCharsPerItem`, so models sent values like `maxCharsPerItem: 60000` and
the call failed with -32602 (19% of calls in one report).
Values above the maximum now clamp to it on decode, and the existing
nextPosition/nextTextOffset pagination covers the rest. Each field's
description states its bound. Values below 1 still fail.
Fixes pingdotgg#22618
Approvability
Verdict: Approved at e34533a
Macroscope's review found this PR approvable — This is a focused MCP input-validation fix: oversized t3_thread_read parameters are normalized to the existing limits instead of rejecting the call, while defaults and downstream limits remain unchanged. The behavior is covered by targeted tests, including lower-bound rejection and schema descriptions.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e8161c26-3fd8-4d6b-8a5b-8d6d7837307e
📥 Commits
-
Reviewing files that changed from the base of the PR and between e64766c and e34533a.
📒 Files selected for processing: 2
-
apps/server/src/mcp/McpHttpServer.test.ts
packages/contracts/src/orchestratorMcp.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
-
t3_thread_read now clamps oversized limit, runLimit, and maxCharsPerItem inputs to their maximums. Values below 1 remain invalid. The field descriptions state their bounds and clamping behavior.
Changes: t3_thread_read pagination
| Layer / File(s) |
Summary |
Bounded input schema packages/contracts/src/orchestratorMcp.ts |
A schema helper clamps values above the configured maximum during decoding and documents the bounds. limit, runLimit, and maxCharsPerItem use maxima of 100, 50, and 50,000. Values below 1 remain invalid. |
Pagination validation tests apps/server/src/mcp/McpHttpServer.test.ts |
Tests cover clamping oversized values, rejection of zero, and descriptions of each field's bounds and clamping behavior. |
Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers: juliusmarminge
Merge Risk: ⚪ Minimal · up to e3453
-
No actionable issue is identified with the thread-read pagination change; it is ready for normal merge checks.
Security architecture risk: ⚪ Minimal · up to e3453
-
Oversized requests are reduced to the same limits already available to callers. The change preserves access scope, response bounds, and existing task-acknowledgement safeguards. No material security risk introduced or worsened by this change was identified.
Retained concerns
No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — Newly accepted oversized requests can perform the same environment-scoped thread reads already reachable with valid maximum values. They do not increase the effective pagination or text limits, change the selected thread identity, or expand caller authority.
Security Findings and Attack Paths
- inferred — The examined oversized-input path does not bypass the former effective resource bounds: normalization occurs before downstream reads and acknowledgement checks. No introduced or materially worsened security condition was identified in that path.
Trust Boundaries and Controls
- observed — Pagination fields do not select the caller or target identity. Existing acknowledgement controls separately require the calling parent’s app-owned child task, a matching returned terminal result, and complete result text within the effective character bound. The schema change does not replace these checks.
Resilience and Maintainability Implications
- inferred — Oversized requests inherit the existing maximum-request transition semantics. Acknowledgement occurs before response completion, so a subsequent failure or interruption can leave an acknowledgement committed; this is pre-existing behavior. Repeated or concurrent acknowledgements are idempotent no-ops once acknowledged. Clamping does not introduce a new ordering, recovery, or state-loss path.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly and concisely describes the primary change: clamping t3_thread_read page sizes instead of rejecting values above the maximum. |
| Description check |
 |
The description covers the problem, implementation, scope, linked issue, and detailed verification results. It does not explicitly document maintainer approval or explain why the focused fix qualifies… |
| Linked Issues check |
 |
Issue #22618 requires preventing avoidable t3_thread_read failures when the model sends values above the hidden bounds. The PR applies clamping to limit (100), runLimit (50), and `maxCharsPerIte… |
| Out of Scope Changes check |
 |
The changed files contain only the scoped t3_thread_read schema behavior and its tests. The helper supports the three fields required by issue #22618. The reported validation covers the affected ser… |
Full details: Description check
-
Explanation
The description covers the problem, implementation, scope, linked issue, and detailed verification results. It does not explicitly document maintainer approval or explain why the focused fix qualifies without prior approval, but the remaining required information is complete.
Full details: Linked Issues check
-
Explanation
Issue #22618 requires preventing avoidable t3_thread_read failures when the model sends values above the hidden bounds. The PR applies clamping to limit (100), runLimit (50), and maxCharsPerItem (50,000) during decoding. Values below 1 remain rejected. The field descriptions state the ranges and clamping behavior. The reported tests verify clamping, unchanged in-range values, rejection of zero without handler calls, advertised bound text, and the real toolkitRegistration path. Existing pagination remains in use for continuation.
Full details: Out of Scope Changes check
-
Explanation
The changed files contain only the scoped t3_thread_read schema behavior and its tests. The helper supports the three fields required by issue #22618. The reported validation covers the affected server and contract behavior. Other tools with similar validation are explicitly unchanged, so no unrelated implementation is demonstrated.
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note 🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for this fix. We took it over in #22901 so it can land now: your commit is kept with your authorship, rebased on current main, with a small follow-up commit on top. Closing this one in favor of #22901.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|