Skip to content

Fix false-positive system tool parsing for quoted TOOL_NAME examples#11094

Open
siewcapital wants to merge 1 commit intocontinuedev:mainfrom
Siew-s-Capital:fix/system-tools-quoted-syntax-11070
Open

Fix false-positive system tool parsing for quoted TOOL_NAME examples#11094
siewcapital wants to merge 1 commit intocontinuedev:mainfrom
Siew-s-Capital:fix/system-tools-quoted-syntax-11070

Conversation

@siewcapital
Copy link

@siewcapital siewcapital commented Mar 5, 2026

Summary

  • prevent fallback TOOL_NAME: parsing once the assistant has already emitted non-whitespace conversational text
  • keep canonical ```tool block parsing unchanged, even when a response includes explanatory text first
  • make canonical start detection explicit in detectToolCallStart instead of relying on tuple ordering
  • add regression coverage so quoted syntax examples stay as plain assistant text

Why

When a model explains tool syntax (for example, TOOL_NAME: read_file in a normal paragraph), the parser could misclassify that quoted text as a real tool invocation. This patch narrows the fallback path to reduce those false positives while preserving standard fenced tool-call behavior.

Testing

  • Added/updated unit tests in core/tools/systemMessageTools/toolCodeblocks/interceptSystemToolCalls.vitest.ts
  • Local run in this environment is blocked because vitest is not installed (ERR_MODULE_NOT_FOUND)

Closes #11070


Continue Tasks: 🔄 7 running — View all


Summary by cubic

Prevents false-positive tool calls when the assistant shows quoted TOOL_NAME examples in normal text by limiting fallback parsing to the very start of a response. Canonical ```tool code blocks still parse normally.

  • Bug Fixes
    • Allow non-codeblock TOOL_NAME starts only at response start; disable once any non-whitespace assistant text appears.
    • Continue to parse canonical ```tool blocks even after conversational text.
    • Add explicit canonical-start detection with an allowNonCodeblockStarts option and regression tests to keep quoted examples as plain text.

Written for commit 059a085. Summary will update on new commits.

@siewcapital siewcapital requested a review from a team as a code owner March 5, 2026 21:06
@siewcapital siewcapital requested review from sestinj and removed request for a team March 5, 2026 21:06
@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


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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


You can retrigger this bot by commenting recheck in this Pull Request. 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 3 files

@Co-Messi
Copy link

Co-Messi commented Mar 6, 2026

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

1 similar comment
@Co-Messi
Copy link

Co-Messi commented Mar 6, 2026

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

@RomneyDa RomneyDa closed this Mar 10, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs Mar 10, 2026
@RomneyDa RomneyDa reopened this Mar 10, 2026
@github-project-automation github-project-automation bot moved this from Done to In Progress in Issues and PRs Mar 10, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

System message tools parser intercepts quoted tool syntax as real tool calls

3 participants