Repository navigation
fix(llm): parse emulated tool calls from content when the gateway ignores tool_choice (#129) - #216
Conversation
…ores tool_choice (trailhq#129) DeepSeek-class gateways drop tool_calls and write the payload in content, so ChatSynthesizer returned [] with no warning. Recover the same JSON conservatively (array / object / fence), reuse trailhq#177's empty-result retry, and log per-batch node/link counts so a 0-link multi-batch run is visible. Co-authored-by: Cursor <[email protected]>
…railhq#129) Co-authored-by: Cursor <[email protected]>
🌱 graft blast radius3 areas changed → 2 areas can be affected. 2 dependent symbols, depth 2. flowchart TB
A0(("Workspace CLI<br/>1 symbol"))
A1(("Engine Initialization<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1 reached;
All 2 dependent symbols, grouped by areaWorkspace CLI — 1 symbol in 1 file
Engine Initialization — 1 symbol in 1 file
Test signal per changed area — 1 ✓ · 2 ✗Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
3 test suites also reference this code3 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
|
Verified locally on top of current Fixes #129: extracts a shared, ReDoS-safe Empty→populated proof (PR's own tests, passing): a fake model returning the payload in |
…ores tool_choice (trailhq#129) (trailhq#216) * fix(llm): parse emulated tool calls from content when the gateway ignores tool_choice (trailhq#129) DeepSeek-class gateways drop tool_calls and write the payload in content, so ChatSynthesizer returned [] with no warning. Recover the same JSON conservatively (array / object / fence), reuse trailhq#177's empty-result retry, and log per-batch node/link counts so a 0-link multi-batch run is visible. Co-authored-by: Cursor <[email protected]> * fix(llm): parse gateway tool-call content without backtracking regex (trailhq#129) Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
Summary
ChatSynthesizer(and the shared helper now used byChatCruxSummarizer) only readres.toolCalls[0]. Gateways that ignore forcedtool_choice(deepseek-v3.2) put[{"name":"emit_json","parameters":{...}}]incontentwithtool_calls: null, so synthesize returned[]with no warning. WhentoolCallsis empty, conservatively parsecontentas tool-call JSON (array, single object, or fenced block). Recovered args go through the sameclean()/parseResults()validation as a real tool call. Unparseable or empty → one stderr line, no guessing.--deepretries. Failed content recovery does not invent a second error channel.nodes/links. A multi-batch run that produces 0 links gets one summary warning at the end of build. No quality scoring.christian-jorge's #107/#111 were the adapter-level attempt at mode 1 (plus a corrective retry). They closed unmerged, and
origin/mainstill only readtoolCalls[0]. This PR redoes the remaining #129 slice at the call site, matching #177, and does not reopen those branches or change provider protocols.#177 already recovered crux payloads from content (meaning pass). This PR shares that parser and covers synthesis. Together they address both silent failures in #129.
Test plan
tool_callsnull + content JSON array (emit_json) → nodes[]toolCallspreferred over content JSONtsc --noEmitcleannpm teston Node 20 (local Node 26 cannot loadtree-sitter-kotlinprebuilds — pre-existing, unrelated)Closes #129
Made with Cursor