Skip to content

Fix system-message tools parser when tool call is non-terminal#11092

Open
MumuTW wants to merge 5 commits intocontinuedev:mainfrom
MumuTW:fix-system-tools-non-terminal-11074
Open

Fix system-message tools parser when tool call is non-terminal#11092
MumuTW wants to merge 5 commits intocontinuedev:mainfrom
MumuTW:fix-system-tools-non-terminal-11074

Conversation

@MumuTW
Copy link

@MumuTW MumuTW commented Mar 5, 2026

Summary

  • stop treating a completed system-message tool call as terminal for the entire stream
  • reset parser state after each completed tool call so later chunks/messages continue to be processed
  • preserve assistant content that appears after a parsed tool call
  • add regression coverage for post-tool content and mid-message tool-call placement

Testing

@continuedev/core@1.1.0 vitest /home/opc/.paperclip/instances/default/workspaces/7948d02f-b91e-4189-b9eb-32bf0b5923d2/continue/core
vitest run core/tools/systemMessageTools/toolCodeblocks/interceptSystemToolCalls.vitest.ts

 ELIFECYCLE  Command failed.
 WARN  Local package.json exists, but node_modules missing, did you mean to install? (fails in this workspace because is missing and is unavailable)


Continue Tasks: 🔄 7 running — View all


Summary by cubic

Fix system-message tool-call parsing so completed calls don’t end the stream and trailing or mid-message assistant text is preserved. Also skip the stray newline after a closed tool-call codeblock, dedupe dynamic tool definitions, and map "reasoning-delta" to reasoning_content.

  • Bug Fixes
    • System tools: make tool calls non-terminal; reset state after each call; preserve text around calls; skip the newline emitted after a closed tool-call codeblock; avoid duplicate dynamic tool definitions.
    • OpenAI adapter: map "reasoning-delta" to delta.reasoning_content; update tests; simplify a TS type assertion.

Written for commit b4fe40c. Summary will update on new commits.

@MumuTW MumuTW requested a review from a team as a code owner March 5, 2026 19:36
@MumuTW MumuTW requested review from RomneyDa and removed request for a team March 5, 2026 19:36
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 5, 2026
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@MumuTW MumuTW force-pushed the fix-system-tools-non-terminal-11074 branch from 15c0036 to cc09312 Compare March 5, 2026 23:37
@MumuTW
Copy link
Author

MumuTW commented Mar 5, 2026

I have read the CLA Document and I hereby sign the CLA

MumuTW and others added 3 commits March 5, 2026 23:44
The `as typeof X & Y` type assertion was ambiguous to the TypeScript
parser without parentheses, causing TS1005 errors across all CI checks.
Simplify to `as any` since this is a test assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When ```` ``` ```` closes a tool call, splitAtCodeblocksAndNewLines splits
```` ```\n ```` into [```` ``` ````, `\n`]. The ```` ``` ```` chunk completes
the tool call and the `\n` was incorrectly emitted as a text content
yield, throwing off yield counts and causing the trailing content test
to see `undefined` instead of the preserved text.

Skip the newline immediately following a completed tool call codeblock
and fix the test loop count (4 tool deltas, not 6).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant