Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: t3_thread_read rejects page sizes the Codex harness never shows the model #22618

Closedgrey-tsosie(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run an agent through the Codex harness in T3 Code with the t3-code MCP server attached.
  2. Let it read a long thread with t3_thread_read and maxCharsPerItem above 50000 (or limit above 100, or runLimit: 0).

OrchestratorMcpThreadReadInput bounds these fields, and Tool.getJsonSchema does export them ({"type":"integer","minimum":1,"maximum":50000} for maxCharsPerItem). The Codex harness does not pass the bounds on to the model: its rendered declaration is maxCharsPerItem?: number | null. The model therefore has no way to know the limit until the call fails.

Expected behavior

An agent that asks for more than a page allows gets the largest allowed page (with the existing nextTextOffset / nextPosition continuation), or the limits are visible in the parameter descriptions so the model can choose a valid value.

Actual behavior

The call fails with -32602: Invalid parameters for tool 't3_thread_read': Expected a value less than or equal to 50000 at ["maxCharsPerItem"] and the agent has to retry.

Local data from one machine (2026-10-19 to 2026-10-21): 38 of 202 t3_thread_read calls (19%) failed this way: 34 with maxCharsPerItem: 60000, three with limit above 100 and one with runLimit: 0. All other failures of this tool were unrelated.

Two possible changes, for maintainers to choose: clamp limit, runLimit and maxCharsPerItem to their bounds (pagination already covers the remainder), or state the bounds in each field's description, as some other MCP servers do. The missing bounds in the rendered declaration are a Codex harness behavior; I have not filed that separately.

Impact

Minor bug or occasional failure

Version or commit

Installed build: t3code-bin 0.1.0 (built 2026-10-15). Schema checked on main at ecfe4f79.

Environment

Linux (Arch), Codex harness.

  1. Note

    Grok responding on behalf of Julius.

    Thanks for the numbers, they make the cost clear. Rejecting values outside the bounds is intended. limit is capped at 100, runLimit at 50 and maxCharsPerItem at 50000, all positive integers (packages/contracts/src/orchestratorMcp.ts:370-379), and the JSON schema exports those bounds. The Codex harness dropping minimum and maximum when it shows the tool to the model is on Codex's side.

    What we control is that the bounds appear nowhere else. These fields have no descriptions, and the tool description doesn't mention the limits (apps/server/src/mcp/toolkits/orchestrator/tools.ts:207-209). So a model in the Codex harness has nothing to go on until a call fails. Since the page already continues through nextPosition and nextTextOffset, there's an easy way to avoid the failures, either by stating the limits or by clamping to them.

    This is separate from #16809, which was about optional parameters accepting null, and from #19758, which changes default page sizes but not the limits. Accepting this as a bug.

  2. juliusmarminge added labelsbug

  3. juliusmarminge added labelsaccepted

  4. juliusmarminge added labelsvia-triage

Sign in to join this conversation.