Skip to content

test(executors): drop the tool-truncation assertion #11444 removed the code for - #11591

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
ntdatt812:fix/11444-ts7-stale-tool-truncation
Aug 26, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
ntdatt812:fix/11444-ts7-stale-tool-truncation

Conversation

@ntdatt812

Copy link
Copy Markdown
Contributor

Part of the "every gate is red on every branch" cleanup — one of six independent unit-test failures on release/v3.8.51.

The red test

✖ truncates an over-long tools array to 128 entries
  AssertionError: upstream rejects more than 128 tools
  200 !== 128

Two tests asserted opposite contracts for the same call

tests/unit/opencode-tools-no-truncation.test.ts exists specifically to pin the
opposite, and it passes today:

OpencodeExecutor.transformRequest contained a second hardcoded tool-list truncation
(mb.tools.slice(0, 128))… When a client (opencode/claude-code) sends >128 tools, the
opencode executor silently dropped every tool after the 128th (e.g. task, skill,
write, read), leaving subagent tasks paralyzed.

Tool-list limiting is the chatCore upstreamBody.truncateToolList()'s job
(per-provider known/effective limits via toolLimitDetector), NOT the executor's.

So the removal was deliberate and fixed a real user-facing bug (#11444). This file still
asserted the truncation that fix removed.

Why the behaviour is better where it moved

upstreamBody.truncateToolList() reads a per-provider limit
(getKnownToolLimit → PROVIDER_TOOL_LIMITS) rather than a hardcoded 128, so
grok-cli (200) and nvidia (1536) are no longer cut at someone else's ceiling, and
bypassDefaultToolLimit gives callers an escape the executor-level slice never had.

What changed

I did not delete the case. It now pins the same direction from this file's angle — the
TS 7 narrowing fix (#8484) must not let the cap creep back in here — so the two files
agree instead of racing:

it("forwards an over-long tools array intact, leaving the limit to chatCore (#11444)", () => {
  assert.equal(out.tools.length, 200, "the executor must not impose a tool cap");
  assert.equal(out.tools[199].function.name, "tool_199", "order and tail preserved");
});

The describe title lost the word "truncation" for the same reason.

Verification

Both files, run together:

# base branch
✖ truncates an over-long tools array to 128 entries    200 !== 128

# with this change
✔ preserves all 150 tools (no slice(0,128))
✔ preserves all 300 tools (well beyond the old hardcoded 128 cap)
✔ preserves tool order (first AND last tool intact)
✔ preserves empty tools array intact
✔ preserves tool objects content exactly without mutation
✔ is a no-op when tools is absent
✔ OpencodeExecutor — no hardcoded 128-tool truncation (#11444)
✔ forwards an over-long tools array intact, leaving the limit to chatCore (#11444)
✔ leaves a within-limit tools array untouched
✔ is a no-op when the body carries no tools
✔ leaves an array-shaped body alone (pins the !Array.isArray guard)
ℹ tests 10  ℹ pass 10  ℹ fail 0

Test-only; no production code touched.

…#11444 removed the code for

`Unit Tests fast-path` is red on every branch:

    ✖ truncates an over-long tools array to 128 entries
      200 !== 128

Two tests in this repo asserted opposite contracts for the same call.
`opencode-tools-no-truncation.test.ts` (cheaper-inference#11444) pins that
`OpencodeExecutor.transformRequest` forwards a 150+ tool array intact, because the
executor's own `tools.slice(0, 128)` dropped every tool past the 128th — task, skill,
write, read — and left subagent runs paralyzed. This file still asserted the truncation
that fix removed.

Limiting is the chatCore layer's job now: `upstreamBody.truncateToolList()` reads a
per-provider limit from `toolLimitDetector` instead of a hardcoded 128, so grok-cli
(200) and nvidia (1536) are not cut at someone else's ceiling.

Rather than delete the case, it now pins the same direction from this file's angle —
the TS 7 narrowing fix must not let the cap creep back in here — so the two files agree
instead of racing.
@ntdatt812

Copy link
Copy Markdown
Contributor Author

CI note: this run shows one failure that is not from this PR — handleChat recovers from a real 429 once the connection cooldown expires (chat-cooldown-aware-retry.test.ts:197), 429 !== 200 after 3683ms.

Evidence it is unrelated:

It looks like a timing-boundary flake rather than a one-off: the test sets maxRetryIntervalSec: 3 while the stub returns Retry-After: 2 on three consecutive calls and then expects a 4th call to succeed. That leaves almost no margin between the retry budget and the mandated waits, so accumulated per-attempt overhead on a loaded runner can exhaust the budget before the 4th call — which matches the observed 3683ms, short of the ~6s of Retry-After waits the happy path needs.

I have not read the retry internals closely enough to be sure that is the mechanism, so I am flagging it rather than sending a fix. Happy to dig in and send one if you would like.

@diegosouzapw
diegosouzapw merged commit 88939a3 into cheaper-inference:release/v3.8.51 Aug 26, 2026
10 of 16 checks passed
diegosouzapw pushed a commit that referenced this pull request Aug 26, 2026
…es registration (#9282) (#11609)

Merged via /merge-batch (lote 2026-08-26 batch 2, v3.8.51). Dois conflitos, ambos triviais: (1) stryker.conf.json — mesma linha com indentação diferente, mantida a indentação correta; (2) ts7-executor-shared-shapes.test.ts — mesma correção já coberta por #11591/#11608 (mergeados neste lote), mantido o describe/comentário melhor deste PR sobre a asserção já validada. Validado: 4/4 testes passando. Obrigado pela contribuição.
diegosouzapw pushed a commit that referenced this pull request Aug 26, 2026
Merged via /merge-batch (lote 2026-08-26 batch 2, v3.8.51). 7 conflitos, todos triviais/duplicados (mesmos base-reds já corrigidos por PRs paralelas mergeadas neste lote — #11580/#11582/#11583/#11585/#11588/#11589/#11590/#11591/#11609): mantida a versão já validada nesses casos. Validado: 68/68 testes passando. Obrigado por resolver os base-reds.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…#11444 removed the code for (cheaper-inference#11591)

Merged via /merge-batch (lote 2026-08-26, v3.8.51). Boarded no worktree combinado junto com outras ~30 PRs; validação única: typecheck/complexity/cognitive-complexity/changelog-integrity verdes, file-size rebaseado onde necessário (crescimento legítimo), lint com os mesmos 228 achados pré-existentes confirmados via sonda contra o tip puro (não introduzidos por este lote), e ~370 testes focados (unit + vitest) passando. Obrigado pela contribuição.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…es registration (cheaper-inference#9282) (cheaper-inference#11609)

Merged via /merge-batch (lote 2026-08-26 batch 2, v3.8.51). Dois conflitos, ambos triviais: (1) stryker.conf.json — mesma linha com indentação diferente, mantida a indentação correta; (2) ts7-executor-shared-shapes.test.ts — mesma correção já coberta por cheaper-inference#11591/cheaper-inference#11608 (mergeados neste lote), mantido o describe/comentário melhor deste PR sobre a asserção já validada. Validado: 4/4 testes passando. Obrigado pela contribuição.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…per-inference#11608)

Merged via /merge-batch (lote 2026-08-26 batch 2, v3.8.51). 7 conflitos, todos triviais/duplicados (mesmos base-reds já corrigidos por PRs paralelas mergeadas neste lote — cheaper-inference#11580/cheaper-inference#11582/cheaper-inference#11583/cheaper-inference#11585/cheaper-inference#11588/cheaper-inference#11589/cheaper-inference#11590/cheaper-inference#11591/cheaper-inference#11609): mantida a versão já validada nesses casos. Validado: 68/68 testes passando. Obrigado por resolver os base-reds.
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.

2 participants