Skip to content

fix(providers/openai): keep unindexed stream tool calls apart - #89

Open
mafredri wants to merge 49 commits into
coder_2_33from
mafredri/codagt-1658-unindexed-tool-calls
Open

mafredri wants to merge 49 commits into
coder_2_33from
mafredri/codagt-1658-unindexed-tool-calls

Conversation

@mafredri

@mafredri mafredri commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Relates to CODAGT-1658

Google's OpenAI-compatible Chat Completions endpoint streams each parallel tool call whole in its own chunk and omits tool_calls[].index. The Go SDK decodes an absent index as 0, and providers/openai/language_model.go keys accumulated calls by toolCallDelta.Index, so every parallel call in a turn merged into key 0 with concatenated arguments like {..}{..}.

To fix, only deltas with !toolCallDelta.JSON.Index.Valid() take a new path; indexed deltas take the existing coder_2_33 path unchanged (key = wire index):

  • Index-less calls allocate keys counting up from math.MinInt64, staying far below any wire index providers send so they finalize before indexed calls in arrival order. The next slot advances only after a call is stored there, so skipped empty deltas allocate nothing.
  • An index-less delta with a function name starts a new call unless it carries a non-empty id equal to the latest call's id, or it has no id with the same tool name while the latest call's arguments are non-empty and not yet valid JSON. A nameless index-less delta continues the latest call of either kind (indexed or index-less), or starts one when none exists. latestKey follows the latest call of either kind touched by a delta with a name or arguments.
  • The tool-call-N fallback id numbers new index-less calls from 0 instead of exposing the negative map key.

An index-less stream that ends at clean EOF without a finish reason after whole calls now has those calls dispatched, following the same rule indexed streams already use; before, the merged arguments failed to parse and the step retried.

Known limits: streams that reuse one wire index across several calls (such as Ollama or LiteLLM on index: 0) still merge as before. A same-name index-less delta with empty arguments after a complete call starts a second call; no provider is known to send that shape. providers/kronk/language_model.go also keys streamed tool calls by index and is left untouched.

Verified with go test ./providers/openaicompat/ -run Unindexed -count=1:

  • TestStream_UnindexedGeminiParallelToolCalls: replays a captured three-call stream from Google's OpenAI-compatible endpoint.
  • TestStream_UnindexedToolCallShapes: id-less fragments, repeated id and name, nameless fragments with a fresh id each, two calls in one chunk, id-less whole calls start one call each, id-less fragments repeating the name before the arguments complete, opener with an id continued by id-less named fragments, id-less named call for another tool after an unfinished call, indexed opener continued by an index-less fragment, indexed deltas unchanged, and indexed plus index-less calls in one stream not colliding.
Implementation plan and decision log

An earlier revision of this PR added a unified tracker for mixed indexed/unindexed streams and index-reuse shapes raised during review. We cut it back to this minimal change because no provider we target sends those mixed shapes and the broader heuristic altered behavior on indexed streams.

  • Missing-finish rule: unchanged. An index-less stream that ends at clean EOF without a finish reason after whole calls now has those calls dispatched, following the same complete-JSON check indexed streams already use; before, the merged arguments failed to parse and the step retried.
  • stop finish mapping: unchanged. Google reports stop on tool-call turns; chatd collects tool calls regardless of finish reason, Coder does not use fantasy's Agent stream loop, and remapping stop would affect every provider.
  • Name starts a new call; unfinished and nameless fragments continue latest: Gemini sends each parallel call whole with a function name and is reported to sometimes omit id (Chat Completions streaming merges parallel tool calls when deltas have no index openai/openai-agents-js#2116), so a named index-less delta opens a new call unless its non-empty id matches the latest call's id or it has no id with the same tool name while the latest call's arguments are non-empty and not yet valid JSON. A nameless index-less fragment continues the latest call of either kind (indexed or index-less), preserving base behavior for an indexed opener followed by index-less fragments.
  • Key range (math.MinInt64 upward): stays far below any wire index providers send (including negative indexes such as Bedrock's -1) without a separate tracking map, keeps index-less calls in arrival order on key sort, and keeps fallback IDs zero-based for new index-less calls via toolCallDelta.Index - firstUnindexedToolCallKey.

🤖 Created with the help of Coder Agents.

Google's OpenAI-compatible endpoint streams each parallel tool call as
a whole chunk with a unique id and no index. The capture in testdata
comes from gemini-4-neon through the Coder AI gateway. These tests fail
until the stream accumulator stops keying such calls on the decoded
index, which is 0 for every call.
Stream tool calls were keyed by index. A delta without an index decodes
as 0, so every parallel call from Google's OpenAI-compatible endpoint
merged into one call with concatenated arguments.

A delta without an index now starts a new call when it carries a new
id, or a name without an id after the previous call's arguments are
complete JSON. Other unindexed deltas continue the latest call. Indexed
deltas are handled as before.
Replace draft comment markers with brief rationale on the unindexed
tool-call helpers and the streaming test fixture.
@linear-code

linear-code Bot commented Dec 2, 2026

Copy link
Copy Markdown

CODAGT-1658

Reviewers found shapes the index-less rule mishandles: an index 0
opener continued by unindexed fragments, interleaved fragments
correlated only by id, a whitespace fragment after complete arguments,
a name change on a call without arguments, and an explicit index that
lands on a key a synthetic call already took. collectCalls now also
checks the per-call part sequence and names.
The previous rule compared each unindexed delta only with the latest
unindexed call and allocated keys as latest+1, so interleaved ids
split, an indexed opener lost its unindexed fragments, and a later
explicit index could overwrite a synthetic call.

Unindexed deltas now continue the call with the same id, or the most
recently touched call when they carry no id and do not look like a
new call. Fresh keys never collide: an explicit index whose key is
taken maps to a fresh key. Streams with only indexed deltas keep key
equal to wire index. Skipped empty deltas no longer move any state.
Replace draft comment markers on toolCallKeys and collectCalls, and
update the tool-call finalization comment to reflect key ordering for
synthetic and remapped calls.
@mafredri

This comment has been minimized.

@mafredri

mafredri commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review Please limit the review to P0, P1, P2 issues only. Include only highly relevant P3 issues.

🤖 Created with the help of Coder Agents.

@coder-agents-review

coder-agents-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Chat: Review posted | View chat
Requested: 2026-12-03 14:19 UTC by @mafredri
Spend: $85.48 / $100.00

Review history
  • R1 (2026-12-02): 9 reviewers, 1 P2, 2 P3, COMMENT. Review
  • R2 (2026-12-02): 9 reviewers, 1 P2, 3 P3, COMMENT. Review
  • R3 (2026-12-02): 9 reviewers, 3 P2, 4 P3, COMMENT. Review
  • R4 (2026-12-02): 9 reviewers, 5 P2, 4 P3, COMMENT. Review
  • R5 (2026-12-02), 5 P2, 4 P3, COMMENT. Review
  • R6 (2026-12-02): 10 reviewers, 6 P2, 5 P3, COMMENT. Review
  • R7 (2026-12-02): 9 reviewers, 7 P2, 6 P3, COMMENT. Review
  • R8 (2026-12-03): 10 reviewers, 8 P2, 6 P3, COMMENT. Review
  • R9 (2026-12-03): 8 reviewers, 8 P2, 6 P3, APPROVE. Review
  • R10 (2026-12-03): 7 reviewers, 8 P2, 7 P3, APPROVE. Review
  • R11 (2026-12-03): 5 reviewers, 8 P2, 8 P3, APPROVE. Review
  • R12 (2026-12-03): 5 reviewers, 8 P2, 8 P3, APPROVE. Review

deep-review v0.13.1 | Round 12 | 2286791..13eed89

Last posted: Round 12, 16 findings (8 P2, 8 P3), APPROVE. Review

Finding inventory

Finding inventory: #89

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (d01fedb, a1fa580); reversed R10 by 68c972a (shape now emits {} call), tracked as CRF-82 providers/openai/language_model.go:243 opensArguments("") true: trailing same-name empty-args id-less delta becomes a second {} call; branch untested R1 Netero, Leorio Yes
CRF-2 P4 Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:16 serveRawSSE duplicates serveSSE R1 Netero No
CRF-3 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:811 indices/idx names now hold map keys R1 Netero No
CRF-4 Note Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:142 toolCallKeys coverage lives only in openaicompat R1 Netero No
CRF-5 P2 Out of scope R8 (675ac9b returns indexed deltas to the base path; PR lists index reuse under Known limits; body) providers/openai/language_model.go:192 forWireIndex ignores delta.ID: same-index distinct-id calls (Ollama index: 0) still merge; unindexed-then-indexed same id splits R1 Ryosuke, Melody, Pariston, Mafuuu Yes
CRF-6 P3 Author fixed (a1fa580); verified R2 by Bisky (mutation now fails) providers/openai/language_model.go:209 No test for unindexed delta whose id matches an indexed call; mutation survives R1 Bisky Yes
CRF-7 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:158 toolCallKeys.used duplicates toolCalls key set R1 Ryosuke P4, Leorio P4, Gon Note No
CRF-8 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:227 Five names for unindexed/id-less/synthetic concepts R1 Gon No
CRF-9 P3 Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:295 Case "id-less stream cut mid-arguments by length" carries an id R1 Gon P3, Leorio P4 No
CRF-10 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:171 resolve doc restates itself, omits commit-after-store reason R1 Gon No
CRF-11 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:189 forWireIndex doc narrates branches R1 Gon No
CRF-12 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:202 forUnindexed doc narrates body R1 Gon No
CRF-13 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:223 startsUnidentifiedToolCall doc narrates returns R1 Gon No
CRF-14 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:238 opensArguments doc restates checks R1 Gon No
CRF-15 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:806 Finalize comment lead clause restates sort R1 Gon No
CRF-16 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:52 collectCalls doc restates return type R1 Gon No
CRF-17 P3 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:126 Fixture comment says "models", omits why Google reports stop R1 Gon P2, Leorio P4 No
CRF-18 P3 Dropped by orchestrator (evidence point folded into CRF-1 comment) PR description Rules listed twice; no provider shown to send index-less id-less deltas R1 Leorio No
CRF-19 OOS Out of scope (body) providers/kronk/language_model.go:396 kronk keys streamed tool calls by index alone R1 Netero, Ryosuke, Pariston, Mafuuu, Kite No
CRF-20 OOS Out of scope (body) providers/openai/language_model.go:701 extra_content.google.thought_signature not read or replayed R1 Netero, Ryosuke, Mafuuu, Bisky, Kite No
CRF-21 OOS Out of scope (body) agent.go:1707 Agent.Stream skips dispatch on Gemini stop finish; Agent.Generate runs calls then ends loop (agent.go:638) R1 Ryosuke, Pariston, Melody, Kite No
CRF-22 OOS Out of scope (body) providers/openai/language_model.go:574 toolCalls and keys shared across choices when n > 1 R1 Melody No
CRF-23 OOS Out of scope (body) providers/openai/language_model.go:811 Key collection could use slices.Sorted(maps.Keys(...)) R1 Ging-Go No
CRF-24 P3 Fixed by 68c972a (named id-less delta starts a call); verified R10 by orchestrator shape table, Bisky providers/openai/language_model.go:253 After CRF-1 fix, id-less same-name calls opening with empty args merge R2 Netero Yes
CRF-25 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:208 wireBound guard untested; mutation survives R2 Netero No
CRF-26 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:253 json.Valid(latest.arguments) half of startsUnidentifiedToolCall untested; mutation survives R2 Bisky No
CRF-27 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:161 wireBound duplicates byWireIndex values (extends CRF-7) R2 Ryosuke No
CRF-28 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:159 wireBound comment omits it equals byWireIndex values R2 Gon No
CRF-29 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:195 forWireIndex doc narrates outcomes R2 Gon No
CRF-30 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:204 Inline comment says indexed-only streams never take the id branch; they enter it but never match R2 Gon No
CRF-31 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:256 opensArguments doc restates checks R2 Gon No
CRF-32 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:154 toolCallKeys doc duplicates binding rule, mixes "unindexed" and "synthetic" (extends CRF-8) R2 Gon No
CRF-33 Nit Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:204 "bind", "claimed", wireBound for one relation R2 Gon No
CRF-34 P2 Out of scope R8 (675ac9b returns indexed deltas to the base path; PR lists index reuse under Known limits; body) providers/openai/language_model.go:206 Bound wire index skips startsDuplicateToolCall: same index and same id named calls merge {}{"y":2} R3 Netero P3, Mafuuu Note (emitters) Yes
CRF-35 P2 Out of scope R8 (indexed path back to base; single OCI call parses, several OCI calls on index 0 merge as in base; body) providers/openai/language_model.go:206 Nameless delta with different id at bound index splits a call (LiteLLM oci fresh id per fragment); regression vs base R3 Melody P2, Pariston P2, Mafuuu P3 Yes
CRF-36 P3 Author fixed (e40a5d0, 0e7f826) providers/openai/language_model.go:179 Id continuation decided by three branch-specific rules; one id-first resolver R3 Zoro, Ryosuke Yes
CRF-37 P3 Dropped by orchestrator (folded into CRF-36 comment) providers/openai/language_model.go:206 Id-less delta with different name merges at bound index R3 Ryosuke No
CRF-38 P3 Dropped by orchestrator (folded into CRF-36 comment) providers/openai/language_model.go:207 Interleaved continuation of earlier id on same index becomes nameless third call R3 Ryosuke No
CRF-39 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:257 latestKeyWithID highest key is not newest call R3 Gon P3, Ryosuke P4 No
CRF-40 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:222 unboundContinuation doc says newest unbound call; code gives up when newest is bound R3 Gon, Leorio No
CRF-41 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:155 Binding rule written in three doc comments that disagree R3 Gon No
CRF-42 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:236 forUnindexed doc restates body and duplicate-id rule R3 Gon No
CRF-43 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:276 Name half of startsDuplicateToolCall untested; mutation survives R3 Bisky No
CRF-44 Note Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:93 collectCalls no longer fails on repeated starts per id R3 Bisky No
CRF-45 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:247 newKey wire-index branch untested; mutation survives R4 Netero No
CRF-46 Note Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:241 bound != key in startsNewToolCall is never true R4 Netero No
CRF-47 P2 Out of scope R8 (675ac9b returns indexed deltas to the base path; PR lists index reuse under Known limits; body) providers/openai/language_model.go:229 Bound index: named opener with new id and empty args continues previous same-name call; reopens CRF-5 shape R4 Ryosuke P2, Pariston P2, Mafuuu P2, Leorio P2, Razor P2, Melody P3 Yes
CRF-48 P2 Reopened R8 (675ac9b); tracked as CRF-72; author fixed (5958874) providers/openai/language_model.go:207 Unindexed nameless delta with unknown id starts a nameless call; regression vs base R4 Gon P2, Razor P3 Yes
CRF-49 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:229 current.name != "" guard untested; nameless opener then named delta keeps empty name R4 Bisky No
CRF-50 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:162 latest field and latestKeyWithID mean different things (extends CRF-39) R4 Gon No
CRF-51 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:152 toolCallKeys doc restates rule, scopes type too narrowly R4 Gon No
CRF-52 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:183 commit, candidate, startsNewToolCall, newKey docs narrate bodies (lines 183, 195, 218, 244) R4 Gon No
CRF-53 P2 Code removed in 675ac9b (mixed unindexed-then-indexed streams documented as unsupported) providers/openai/language_model.go:224 Indexed nameless id-less delta at unbound index opens a nameless call; latest fallback only for unindexed R6 Pariston Yes
CRF-54 P3 Author fixed (5b578e5); verified R7 (Razor, Leorio); replacement sentence inaccurate, CRF-67 providers/openai/language_model.go:207 candidate doc says indexes and ids only pick the candidate; false since 28bf452 R6 Gon P3, Razor P4 Yes
CRF-55 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:212 Bound index checked before id: interleaved nameless continuation with earlier id appends to newer call (CRF-38 shape) R6 Melody No
CRF-56 Note Note (body) providers/openai/language_model.go:249 Server re-sending completed calls with fresh ids now runs each call several times (eejd/py-vllm-mlx#10) R6 Mafuuu No
CRF-57 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:247 delta.ID != "" half of the id split untested; mutation survives R6 Bisky No
CRF-58 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:150 idFromWire, created, newestWithID, inline split comment narrate or duplicate (lines 150, 163, 273, 246) R6 Gon No
CRF-59 Nit Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:233 "provider id" vs idFromWire naming R6 Gon No
CRF-60 P3 Dropped by orchestrator (below severity requested on PR) PR description Split rule written twice in different orders R6 Leorio No
CRF-61 OOS Out of scope (body) providers/openai/language_model.go:702 Continuation branch never adopts a later name; nameless opener then named delta dispatches empty tool name (base same) R6 Melody No
CRF-62 Note Note (body) providers/openai/language_model.go:275 Index-less incomplete call then named same-id delta at new wire index merges into invalid JSON (was two calls); documented tradeoff R7 Netero, Pariston No
CRF-63 P4 Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:341 Row for CRF-62 shape rewritten; merged outcome unpinned R7 Netero No
CRF-64 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:222 !k.boundToWireIndex(k.latest) guard untested R7 Netero No
CRF-65 P2 Author fixed (f74b1d9); code removed in 675ac9b providers/openai/language_model.go:275 Unbound complete candidate absorbs a named indexed opener with empty args and no new id; regression vs 3cf333a R7 Ryosuke P2, Melody P3, Chopper P4 Yes
CRF-66 P3 Author fixed (f74b1d9); code removed in 675ac9b providers/openai/language_model.go:231 boundToWireIndex reads current bindings, so a call displaced by a split counts as unbound and absorbs a duplicate-id call R7 Razor P3, Melody P3, Leorio P4 Yes
CRF-67 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:207 "Only nameless deltas never split from their candidate" reads as every named delta splits R7 Gon P2, Leorio Nit No
CRF-68 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:229 boundToWireIndex doc and inline split comment repeat the binding rule (lines 229, 271) R7 Gon No
CRF-69 P3 Dropped by orchestrator (below severity requested on PR) PR description Duplicate-id visibility claim false when the duplicate opens with empty arguments R7 Leorio No
CRF-70 Note Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:80 collectCalls cannot assert the incomplete-stream error outcome R7 Chopper No
CRF-71 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:591 Index-less and indexed fallback ids both produce tool-call-0 in one stream R8 Netero No
CRF-72 P2 Author fixed (5958874, 59af7e4); verified R9 (Netero, Razor, Mafuuu, Chopper, Bisky, Leorio) providers/openai/language_model.go:167 unindexedToolCallKey splits on any new id, including nameless fragments and empty deltas; CRF-48 shape regressed vs base R8 Gon P2, Razor P3, Leorio P3, Mafuuu Note, Chopper Note Yes
CRF-73 P3 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:167 Id compared only with latest index-less call; interleaved ids produce duplicate-id calls; doc says "new" id R8 Melody P3, Gon P3 No
CRF-74 P3 Dropped by orchestrator (below severity requested on PR) providers/openaicompat/unindexed_tool_calls_test.go:132 Missing-finish dispatch for index-less streams claimed in description, untested R8 Bisky P3, Chopper Note, Mafuuu No
CRF-75 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:153 firstUnindexedToolCallKey, finalize, fallback-number comments restate code (lines 153, 734, 590) R8 Gon No
CRF-76 Nit Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:153 "unindexed" in identifiers vs "index-less" in comments R8 Gon No
CRF-77 OOS Out of scope (body) errors.go:137 NewIncompleteStreamError says "unexpected EOF" when the stream ended at [DONE] with no finish reason R8 Chopper No
CRF-78 P3 Dropped by orchestrator (below severity requested on PR); no longer holds R10 (CRF-81) providers/openai/language_model.go:592 Fallback-number comment and subtraction describe a sequence that cannot occur; value is always 0 R9 Gon No
CRF-79 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:158 unindexedToolCallKey, firstUnindexedToolCallKey, finalize, collectCalls docs restate code (lines 158, 153, 736, test 45) R9 Gon No
CRF-80 P3 Dropped by orchestrator (below severity requested on PR); verified R10 by Razor, Mafuuu, Bisky, Kite providers/openai/language_model.go:600 latestKey empty-delta guard untested; unconditional update passes suite; empty indexed delta then index-less fragment opens nameless call R10 Netero No
CRF-81 Note Note (not posted) providers/openai/language_model.go:592 fallbackNumber now counts up per new index-less call; CRF-78 no longer holds R10 Netero No
CRF-82 P3 Author fixed first shape (dc9ed8c, ebc574d); second shape listed in Known limits; verified R11 by Netero, Razor, Leorio, Mafuuu, Bisky, Chopper providers/openai/language_model.go:166 Named id-less index-less delta always starts a call: name-repeating id-less fragments split into invalid calls, trailing same-name empty-args delta dispatches {} (CRF-1 reversed); neither listed in Known limits R10 Razor P3, Leorio P3 (Known limits) Yes
CRF-83 P4 Dropped by orchestrator (below severity requested on PR) providers/openai/language_model.go:165 delta.ID != "" in sameCall is dead: stored ids are never empty R10 Bisky No
CRF-84 P4 Dropped by orchestrator (downgraded from P2; below severity requested on PR) providers/openai/language_model.go:158 unindexedToolCallKey, fallbackNumber (:594), latestKey (:598) comments restate code, omit reasons (Gemini, wrap, empty-delta guard) R10 Gon No
CRF-85 P4 Dropped by orchestrator (below severity requested on PR); verified R11 by Razor, Mafuuu, Bisky, Chopper providers/openai/language_model.go:167 unfinished conjuncts current.arguments != "" and delta.ID == "" untested; mutations pass R11 Netero No
CRF-86 P3 Author fixed (c14c90f); verified R12 by Netero, Mafuuu, Razor, Bisky, Kite; orchestrator timing 0.67 s vs 0.61 s indexed providers/openai/language_model.go:167 unfinished runs json.Valid on accumulated arguments for every id-less index-less delta, including nameless fragments: quadratic in fragment count R11 Mafuuu Yes
CRF-87 P4 Dropped by orchestrator (below severity requested on PR) PR description Known limits "starts a second call" omits that the tool runs with {} input R11 Leorio No
CRF-88 Note Note (not posted) providers/openaicompat/unindexed_tool_calls_test.go:201 New row also pins dispatch of invalid {"x": arguments, coupling it to finalize behavior R12 Bisky No

Contested and acknowledged

CRF-5 (P2, providers/openai/language_model.go:192) - forWireIndex ignores delta.ID

  • Finding: An indexed delta keyed by wire index alone merges parallel calls that share an explicit index with distinct ids (Ollama sends every call on index: 0, OpenAI-compatible streaming: tool_calls index is always 0 for multiple tool calls ollama/ollama#15457 and #15497), producing one call with {"x":1}{"x":2}; the reverse mixed shape (unindexed opener with id a, then index: 0 with id a) split into two calls with id a. Proposed: match non-empty id first for every delta, and remap a bound wire index when the id differs.
  • Author defense (PRRC_kwDORWz1Os8AAAABHHVccg): Fixed the reverse mixed shape in a1fa580 and d01fedb (an unseen wire index binds to an existing unindexed call with the same id). The same-index distinct-id shape is intentionally unchanged: comparing ids on an already-bound wire index would alter indexed-only streams, which the PR leaves unchanged by design, and no provider in scope has been observed reusing one wire index for distinct calls.

CRF-5 panel re-raise (R2, 4/4)

CRF-24 (P3, providers/openai/language_model.go:253) - id-less same-name empty-arguments openers merge

  • Finding: After the CRF-1 fix, two id-less, unindexed calls with the same name that each open with empty arguments merge into {"x":1}{"x":2}; the same-name rule cannot tell this opener from the CRF-1 trailing empty fragment. Proposed: drop the same-name split, or keep the current choice and document in the startsUnidentifiedToolCall doc that this shape merges.
  • Author accepted (IC_kwDORWz1Os8AAAABtjlIFg, R3): Leaves opensArguments unchanged. No provider is known to send deltas with neither index nor id; the CRF-1 trailing fragment and this opener require opposite choices from the same delta; keeping empty arguments attached avoids fabricating a {} second call. The doc note was not added (churn guard). No ticket; a human decision is needed to accept the gap.

Drop and downgrade reasoning

  • Severity filter: a person (@mafredri) asked on the PR to limit the review to P0, P1, P2, plus only highly relevant P3. CRF-2, 3, 4, 7, 8, 9 and the downgraded CRF-10 to 17 are recorded here and not posted.
  • CRF-10 to 16 (Gon P2 to P4). Keep-argument: narrating comments double the text to update when the key rules change, and the resolve doc does not state that commit must run only after the delta is stored. Downgrade: no runtime or API consequence; resolve's doc does state that recording waits for commit.
  • CRF-17 (Gon P2, Leorio P4, set P3). Keep-argument at P2: a maintainer may treat require.Equal(FinishReasonStop) as a bug and change it. Downgrade: the assertion is in a test, and changing it fails the replay of real data; no shipped behavior changes.
  • R2 severity filter: same request repeated by @mafredri for this round. CRF-25 keep-argument: the wireBound guard is the only code that keeps indexed-only streams unchanged and its removal passes the suite. Not posted: the regressed input needs one id on two wire indexes, which no provider is shown to send. CRF-26 keep-argument: removing json.Valid splits nested-object argument streams; not posted because the id-less path has no known provider (PR description now says so).
  • CRF-28 to 32 (Gon P2 to P4). Keep-argument: CRF-30's comment is inaccurate about control flow and could mislead a debugger. Downgrade: no runtime or API consequence; the code next to each comment is short and shows the behavior.
  • R3. CRF-34 raised from Netero P3 to P2: Mafuuu cites emitters (Ollama stream parser reuses index and id for tool calls in separate chunks frozename/sirius-gateway#43, [Bug] LiteRT bridge reuses streamed tool-call indices across separate chunks google-antigravity/antigravity-sdk-python#274; not verified by orchestrator) and the consequence matches CRF-5. CRF-35 at P2 (Melody, Pariston) over Mafuuu P3: regression against base with a live emitter (fix(oci): give each streamed tool call its own index BerriAI/litellm#54628 open, confirmed by orchestrator web search; #40040 shows OCI fresh ids per fragment). CRF-37 and CRF-38 folded into CRF-36: keep-argument for separate posting is that each is a distinct reproduced misparse; folded because the CRF-36 resolver is the shared fix and no provider is shown to send either shape. CRF-39, 40, 43 keep-argument: each is reproduced (wrong attach, doc contradicts code, mutation survives); not posted because the inputs need one id on several wire indexes or a nameless trailing fragment with a repeated id, with no emitter shown. CRF-41, 42 downgraded: doc wording, no runtime consequence. CRF-36 note: Zoro's prototype sends a nameless delta with an unknown id to k.next, which would reintroduce CRF-35; the posted fix routes it to the wire index.
  • R4. CRF-47 at P2: five reviewers P2, Melody P3; orchestrator reproduced at 0a2a900 (a:f={"x":1}{"x":2}; the unindexed variant splits). Emitter evidence is inferred ([Bug]: Responses API streaming bridge emits all parallel tool calls on index=0 in Chat Completions output BerriAI/litellm#21331 index-0 Responses bridge with incremental arguments). Logged as a new finding instead of a re-raise because the CRF-5 thread is resolved and the token cannot unresolve threads. CRF-48 at P2 (Gon) over Razor P3: keep-argument at P2 is a regression against base with fabricated {} and nameless calls and a false doc claim; no unindexed emitter is shown, which is the downgrade argument; tiebreaker kept P2. CRF-52 groups Gon's four narration findings on adjacent docs as one row (same defect class, same fix type, none posted). Wildcard draw this round excluded Zoro (R3 wildcard) by orchestrator choice before the random draw.
  • R6. CRF-53 at P2 (Pariston, single reviewer): keep-argument is a regression against base that dispatches a truncated call and a nameless call, the same basis as CRF-48; downgrade argument is that no provider is shown to send an unindexed opener followed by indexed id-less continuations. Orchestrator reproduced at 3cf333a (a:f={"x": tool-call-1:=1}). Kept P2. CRF-54 posted as P3 (Gon P3, Razor P4, higher wins): the false sentence describes the split rule the CRF-47 fix depends on. CRF-55 keep-argument: reproduced cross-call byte corruption; not posted because no provider sends interleaved fragments on one index. CRF-56 is a Note in the body because it needs a human acceptance decision and no code change is proposed. CRF-61 out of scope: the name-adoption gap is unchanged from base and is not created by this PR.
  • R7. CRF-65 at P2 (Ryosuke P2 over Melody P3, Chopper P4): keep-argument is a regression this round that dispatches invalid JSON and loses the second call, the same basis as CRF-48 and CRF-53; downgrade argument is that no provider is shown to send an unindexed call followed by indexed calls. Orchestrator reproduced the id-less variant (a:f={"x":1}{"x":2}) before the panel reported. CRF-66 posted as P3: three reviewers reproduced it and it falsifies the PR description's duplicate-id visibility claim that chatd's fail-closed check relies on. CRF-67 downgraded: inaccurate doc wording with no code consequence. CRF-62 is a documented tradeoff (Pariston: one delta cannot be both continuation and new call); body Note for human acceptance.
  • R8. Scope: 675ac9b returned indexed deltas to the base path and the PR description lists index reuse under Known limits, so CRF-5, CRF-34, CRF-35, CRF-47 moved to out of scope (root cause in code the PR no longer changes); listed in the body for a ticket or human acceptance. CRF-72 at P2 (Gon P2 over Razor P3, Leorio P3): regression vs base for the CRF-48 shape and the empty-delta variant, and without a finish reason the step errors instead of running (Chopper); no index-less emitter is shown. Orchestrator verified the fix (&& name != ""): go test ./providers/... ./providertests/... . -count=1 passes, Gemini replay and CRF-48 shape correct, then reverted. Posted under a new ID because the CRF-48 thread is resolved and cannot be reopened. CRF-73 keep-argument: duplicate ids reach consumers; not posted, no provider interleaves index-less fragments. CRF-74 keep-argument: the claimed behavior flips a CHARM-2020-guarded path from error to execution with no test; not posted, behavior follows from keying the stop rows cover. Razor was added to the full panel as the CRF-48 raiser (10 with wildcard).
  • R9. CRF-78 keep-argument: the comment promises tool-call-1, tool-call-2 numbering that never happens; not posted, no runtime effect (replacing the expression with 0 passes the suite). CRF-79 downgraded: doc wording, no runtime consequence.
  • R10. CRF-82 posted as P3 under "highly relevant P3": keep-argument is a regression vs base on two shapes, one dispatching a real tool with {} (the outcome the R3 CRF-24 defense rejected) and the description's Known limits omits both; downgrade argument is that no reviewer found an emitter (Mafuuu, Kite: Gemini reports send whole calls or repeat id and name, both correct). Orchestrator verified the proposed id-less incomplete-JSON continuation: only the name-repeating shape changes in the 28-shape table and go test ./providers/... ./providertests/... . -count=1 passes, then reverted. CRF-80 keep-argument: four reviewers reproduced the surviving mutation; not posted, test-only and the shape needs an empty indexed delta inside a mixed stream. CRF-83 P4 dead condition. CRF-84 downgraded: doc wording, no runtime consequence (same class as CRF-79).
  • R11. CRF-86 posted as P3 under "highly relevant P3": keep-argument is a measured CPU regression on the path this PR adds, with a two-line fix; orchestrator reproduced through streamFrom (100 KB arguments in 10,000 id-less nameless 10-byte fragments: 2.35 s at cbdd3a9, 0.41 s for the same stream with index: 0, 0.53 s with a nameless early return; suite passes with the early return, then reverted). Downgrade argument: no provider is shown to stream id-less, index-less fragments. CRF-85 P4 test gap; CRF-87 P4 description wording.
  • CRF-18. Keep-argument: without evidence of an id-less wire shape, the heuristic that CRF-1 shows misfiring may be speculative. Folded into the CRF-1 comment so the author answers both together.

Round log

Round 1

Full panel (round 1). Netero: 1 P3, 2 P4, 1 Note, no P0, panel proceeded. Panel: ging-go, ryosuke, melody (specialists); pariston, mafuuu (core); bisky (tests changed), gon, leorio (once-per-PR floor); kite (wildcard, random draw). Hisoka not selected to stay within the focused size target of 8 plus wildcard. Law not run (451 effective additions). Convergent P2 CRF-5 from 4 reviewers, each reproduced with a scratch test; Ollama index-0 shape confirmed by ollama/ollama#15457 and #15497. Posted CRF-1, CRF-5, CRF-6 per the severity request. Reviewed against 2286791..f20dd8d.

Round 2

Fix round: 3 commits (a1fa580, d01fedb, 074e5ee), no files added, no exported signature change, +40 effective additions. Churn guard PROCEED: CRF-1 and CRF-6 addressed, CRF-5 contested. Panel: Ryosuke, Melody, Pariston, Mafuuu (contested CRF-5, resumed previous agents); Bisky (CRF-6 verification, tests changed); Ging-Go (Go specialist); Gon, Leorio (comment lines changed); Chopper (wildcard, random draw). Netero: 2 P3 (CRF-24 posted on the CRF-1 thread, CRF-25 not posted). CRF-5 re-raised 4/4. Reviewed against 2286791..074e5ee.

Round 3

Restructure round: 5e30fae rewrote the id branches of forWireIndex and forUnindexed and added unboundContinuation, latestKeyWithID, startsDuplicateToolCall. Churn guard PROCEED: CRF-5 addressed, CRF-24 acknowledged (author accepted, no doc note, no ticket; Netero accepted the closure). Netero: CRF-34. Full panel: Ging-Go, Ryosuke, Melody (specialists); Pariston, Mafuuu (core); Bisky (tests); Gon, Leorio (restructure); Zoro (wildcard, random draw). Posted CRF-34, CRF-35, CRF-36. Reviewed against 2286791..dc3589d.

Round 4

Restructure round: e40a5d0 replaced the per-branch functions with candidate, startsNewToolCall, newKey. Churn guard PROCEED: CRF-34, CRF-35, CRF-36 addressed. CRF-24 acknowledged, behavior unchanged (Netero). Netero: CRF-45 (P4), CRF-46 (Note). Full panel: Ging-Go, Ryosuke, Melody, Pariston, Mafuuu, Bisky, Gon, Leorio, Razor (wildcard). CRF-34, CRF-35, CRF-36 verified. Posted CRF-47, CRF-48. Reviewed against 2286791..0a2a900.

Round 5 update

BLOCKED. All findings silent. No review.
Open findings CRF-47 and CRF-48 have no author reply and no code change (churn guard). The new commits (faa6075, 8875a84, 1757bda) replace latestKeyWithID with creation-order newestWithID for Codex thread PRRT_kwDORWz1Os6-wVwe, which also changes the code behind dropped CRF-39. Reviewed against 2286791..1757bda.

Round 6

Fix round after R5 block: e886240, 28bf452, 3cf333a (new unexported field idFromWire, candidate fallback, id split). Churn guard PROCEED: CRF-47, CRF-48 addressed. Netero: no findings. Panel: raisers of CRF-47/48 (Ryosuke, Pariston, Mafuuu, Leorio, Razor, Melody, Gon), specialists Ging-Go, Bisky; Kite wildcard. Orchestrator ran a 12-shape regression table at 3cf333a (all prior shapes correct). Posted CRF-53, CRF-54. Reviewed against 2286791..3cf333a.

Round 7

Fix round: 96f77e3, bbcb29c, 5b578e5 (boundToWireIndex, unbound-latest fallback, split carve-out). Churn guard PROCEED: CRF-53, CRF-54 addressed. Netero: CRF-62 Note, CRF-63, CRF-64 P4. Panel: Pariston, Gon, Razor (raisers); Ging-Go, Ryosuke, Melody, Bisky (specialists); Leorio (comments); Chopper (wildcard). Orchestrator 14-shape table at 5b578e5 (saved to round-shapes/shapes_test.go.txt): all earlier shapes correct, one new merge (CRF-65). Posted CRF-65, CRF-66. Reviewed against 2286791..5b578e5.

Round 8

Restructure round: 675ac9b removed toolCallKeys; indexed path back to base; index-less keys from math.MinInt64. Churn guard PROCEED: CRF-65, CRF-66 addressed (code removed). Inventory validation reopened CRF-48 (orchestrator reproduction). Netero: CRF-71. Full panel: Ging-Go, Ryosuke, Melody, Pariston, Mafuuu, Bisky, Gon, Leorio, Razor (CRF-48 raiser), Chopper (wildcard). Posted CRF-72. Reviewed against 2286791..1362117.

Round 9

Fix round: 59af7e4, 5958874, 655828c (name required for an index-less split). Churn guard PROCEED: CRF-72 addressed. Netero: no findings. Panel: Gon, Razor, Leorio, Mafuuu, Chopper (CRF-72 raisers); Ging-Go, Bisky (specialists); Kite (wildcard). CRF-72 verified by six reviewers; orchestrator shape table at 655828c: all index-less shapes correct, indexed shapes match base. No posted findings; APPROVE. Reviewed against 2286791..655828c.

Round 10

Behavior change round: d9f41d9, 68c972a, 4d74646 (a named index-less delta starts a call unless its id equals the latest call's id; nameless index-less fragments continue the latest call of either kind). Churn guard PROCEED: no open findings. Netero: CRF-80 (P3), CRF-81 (Note). Panel: Razor, Leorio, Mafuuu, Bisky, Ging-Go, Gon; Kite (wildcard). Orchestrator shape table (28 shapes, saved): CRF-24 now split, indexed opener plus index-less fragment now one call, CRF-1 and id-less name-repeating fragments regressed vs R9 and base; all other shapes unchanged. Posted CRF-82 (P3); APPROVE. Reviewed against 2286791..4d74646.

Round 11

Fix round: ebc574d, dc9ed8c, cbdd3a9 (unfinished continuation for id-less named deltas). Churn guard PROCEED: CRF-82 addressed. Netero: CRF-85 (P4). Panel: Razor, Leorio (CRF-82 raisers), Mafuuu, Bisky; Chopper (wildcard). CRF-82 verified by six reviewers. Orchestrator 34-shape table: CRF-82 first shape fixed; truncated-call shapes now merge as on base. Posted CRF-86 (P3); APPROVE. Reviewed against 2286791..cbdd3a9.

Round 12

Fix round: 42fdd7d, c14c90f, 13eed89 (nameless early return before json.Valid; same-name requirement for the id-less unfinished continuation). Churn guard PROCEED: CRF-86 addressed. Netero: no findings. Panel: Mafuuu (CRF-86 raiser), Razor, Bisky, Ging-Go; Kite (wildcard). CRF-86 verified by five reviewers and orchestrator timing (round-shapes/perf_test.go.txt). Shape table: truncated-call shapes with a different name split again; all others unchanged. No posted findings; APPROVE. Reviewed against 2286791..13eed89.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T14:21:16.952305Z 13eed89 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

mafredri added a commit to coder/coder that referenced this pull request Dec 2, 2026
chatgpt-codex-connector[bot]

This comment was marked as outdated.

@coder-agents-review coder-agents-review 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.

This PR assigns streamed tool calls without a wire index to their own keys by id, then by name and argument shape. 1 P2 and 2 P3 findings; as requested, the review is limited to P0 to P2 plus closely related P3.

Out of scope (needs a ticket or explicit acceptance by a human):

  • providers/kronk/language_model.go:396: streamed tool calls are keyed by tc.Index alone, so unindexed or same-index parallel calls merge into one call with concatenated arguments.
  • providers/openai/language_model.go:701: tool_calls[].extra_content.google.thought_signature, present in the Gemini fixture, is not read or sent back, so Gemini models that require signed function calls may reject the follow-up request (unverified against the live endpoint).
  • agent.go:1707: Gemini ends tool turns with finish_reason: "stop", so Agent.Stream does not run the now-separated calls, and Agent.Generate runs them and then ends the loop at agent.go:638 without sending the results to the model.
  • providers/openai/language_model.go:574: toolCalls and callKeys are shared across all chunk.Choices, so with n > 1 calls from different choices share keys and latest.
  • providers/openai/language_model.go:811: the key collection and sort could be slices.Sorted(maps.Keys(toolCalls)); behavior is the same.

🤖 This review was automatically generated with Coder Agents.

Comment thread providers/openai/language_model.go Resolved
Comment thread providers/openai/language_model.go Resolved
Comment thread providers/openai/language_model.go Resolved
Adds rows for an unindexed opener continued by indexed deltas with the
same id, an unindexed delta continuing an indexed call by id, and a
same-name delta with empty arguments after complete arguments.
An unindexed opener followed by a continuation that carries the same
id and an index took a fresh key, so the call split into two calls
with the same id. A wire index seen for the first time now binds to an
existing call with the delta's id, as long as no wire index already
maps to that call. Indexed-only streams never match, so their keys
stay equal to the wire index.

A same-name delta with empty arguments after complete arguments also
started a phantom call dispatched with "{}". Only non-empty arguments
that start with "{" or "[" now open a new same-name call.
Update toolCallKeys, forWireIndex, and opensArguments comments to match
wire-index binding by id and the non-empty opening-arguments rule.
@mafredri

This comment has been minimized.

@mafredri

mafredri commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review Please limit the review to P0, P1, P2 issues only. Include only highly relevant P3 issues.

🤖 Created with the help of Coder Agents.

mafredri added a commit to coder/coder that referenced this pull request Dec 2, 2026
@chatgpt-codex-connector

This comment has been minimized.

coder-agents-review[bot]

This comment was marked as outdated.

coder/coder chatd fails closed on a duplicate tool use id, so a second
call that reuses an id must reach it as its own call. Adds rows for a
named delta reusing the id of a complete or incomplete unindexed call,
with and without a new wire index, and for a different id at a bound
wire index. collectCalls now tracks calls that share an id separately.
d01fedb bound a first-seen wire index to any unindexed call with the
same id, so a named second call with a duplicate id merged into the
first and chatd no longer saw the collision. A wire index now binds
only for a nameless continuation. An unindexed named delta whose id
matches a call with complete arguments starts a second call with that
id.

A delta with a different non-empty id at a bound wire index now starts
a new call, which separates parallel calls that Ollama and LiteLLM send
on index 0. Spec streams send the id only on the first delta or repeat
it, so their keys are unchanged.
Update toolCallKeys and collectCalls comments for nameless id binding,
bound-index id changes, duplicate-id separation, and per-call lifecycle
tracking.
@mafredri

This comment has been minimized.

@mafredri

This comment has been minimized.

@mafredri

mafredri commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review Please limit the review to P0, P1, P2 issues only. Include only highly relevant P3 issues.

🤖 Created with the help of Coder Agents.

mafredri added a commit to coder/coder that referenced this pull request Dec 3, 2026
chatgpt-codex-connector[bot]

This comment was marked as outdated.

coder-agents-review[bot]

This comment was marked as outdated.

@mafredri
mafredri marked this pull request as ready for review December 3, 2026 12:49
…openers

Gemini's OpenAI-compatible endpoint is reported to sometimes send
parallel calls with an empty id, so two whole id-less calls must stay
two calls. An indexed opener continued by an index-less fragment must
stay one call, as on coder_2_33.
A named index-less delta with an empty id continued the latest call,
merging id-less parallel calls into invalid JSON, and an index-less
fragment after an indexed opener started a separate nameless call.

A named index-less delta now starts a new call unless its id equals
the latest call's id. A nameless one continues the latest call of
either kind, so the latest key now follows indexed calls too.
Update unindexedToolCallKey, fallbackNumber, and latestKey comments for
starting new index-less calls on a function name and continuing the
latest call of either kind on nameless deltas.
mafredri added a commit to coder/coder that referenced this pull request Dec 3, 2026
@mafredri

This comment has been minimized.

@mafredri

mafredri commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review Please limit the review to P0, P1, P2 issues only. Include only highly relevant P3 issues.

🤖 Created with the help of Coder Agents.

@chatgpt-codex-connector

This comment has been minimized.

coder-agents-review[bot]

This comment was marked as outdated.

Id-less fragments that repeat the function name before the arguments
complete, alone or after an opener with an id, must stay one call as
on coder_2_33.
…gments

An id-less delta with a function name always started a new index-less
call, splitting fragments that repeat the name into calls with
unparseable input. Such a delta now continues the latest call while
that call's arguments are non-empty and not yet valid JSON.
Update unindexedToolCallKey comment to note that an id-less named delta
continues latest while latest's arguments are non-empty and incomplete
JSON.
mafredri added a commit to coder/coder that referenced this pull request Dec 3, 2026
@mafredri

This comment has been minimized.

@mafredri

mafredri commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review Please limit the review to P0, P1, P2 issues only. Include only highly relevant P3 issues.

🤖 Created with the help of Coder Agents.

chatgpt-codex-connector[bot]

This comment was marked as outdated.

coder-agents-review[bot]

This comment was marked as outdated.

An id-less named delta for tool g after an unfinished call to f must
start its own call, so f never runs with g's arguments.
…alls

An id-less named delta continued any unfinished call, so a call to a
different tool could append its arguments to the previous one. It now
continues only when the name matches. The JSON check also moves behind
the name and id checks, so nameless fragments no longer re-parse the
accumulated arguments on every delta.
Update unindexedToolCallKey comment to reflect that id-less unfinished
continuation requires the same tool name.
@mafredri

mafredri commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

@codex review

🤖 Created with the help of Coder Agents.

@mafredri

mafredri commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review Please limit the review to P0, P1, P2 issues only. Include only highly relevant P3 issues.

🤖 Created with the help of Coder Agents.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 13eed89e6d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

mafredri added a commit to coder/coder that referenced this pull request Dec 3, 2026

@coder-agents-review coder-agents-review 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.

This round returns early for nameless index-less deltas before the JSON check and requires the same tool name before an id-less delta continues an unfinished call. A 100 KB call streamed in 10,000 index-less fragments now parses in about the same time as the indexed stream (0.67 s vs 0.61 s, was 2.35 s), a call to another tool after an unfinished call stays separate, and the other shapes the review tracks are unchanged. No new findings at P0 to P2 or closely related P3.

Still awaiting a human decision from earlier rounds: the index-reuse merge listed under Known limits has no linked ticket. File one or explicitly accept the gap.

🤖 This review was automatically generated with Coder Agents.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant