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
Contributor

@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 text before/after a call is preserved, including mid-message calls. Also 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 surrounding text; skip the newline after a closed tool-call codeblock; avoid duplicate predefined tools in the dynamic section.
    • OpenAI adapter: map "reasoning-delta" to delta.reasoning_content; update tests; simplify a test-only TS assertion.

Written for commit ee012d3. 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
Contributor

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
Contributor Author

MumuTW commented Mar 5, 2026

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

MumuTW and others added 2 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>
Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

@MumuTW I think looks good, just a nitpick on unrelated changes

});

case "reasoning-delta":
return chatChunk({
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change looks unrelated to PR description, could you remove this and the test file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch — removed in ee012d3. Will open a separate PR for the reasoning-delta fix.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Mar 10, 2026
Per reviewer feedback — keeping this PR focused on the
system-message tools parser fix.
@MumuTW MumuTW force-pushed the fix-system-tools-non-terminal-11074 branch from b4fe40c to ee012d3 Compare March 10, 2026 23:38
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants