Skip to content

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Dec 1, 2025

Description

Previously, the subsequent tool calls for gpt-5 models always produced empty tool arguments. This PR fixes that

Diagnosis:

GPT-5 models tend to be less verbose between tool calls - meaning they do tool calls without explanations in between.

streamUpdate was transforming the second tool call message twice here and here for the same first message after the tool call.
This added an extra character (for example, "{\ at the beginning of "{\"{\"command\":\"pwd\",\"waitForCompletion\":true") for which parsing the arguments failed.

resolves CON-4997

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

before.mp4
after.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Fixed empty tool arguments on subsequent GPT-5 tool calls by removing duplicate processing of the first message after a tool call. This prevents a stray leading character that broke JSON parsing and ensures tools receive correct args across consecutive calls (CON-4997).

Written for commit de5062f. Summary will update automatically on new commits.

@uinstinct uinstinct requested a review from a team as a code owner December 1, 2025 15:31
@uinstinct uinstinct requested review from tingwai and removed request for a team December 1, 2025 15:31
@continue
Copy link
Contributor

continue bot commented Dec 1, 2025

Keep this PR in a mergeable state →

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 1, 2025
@continue
Copy link
Contributor

continue bot commented Dec 1, 2025

Reviewed this PR for documentation updates.

No documentation changes needed because:

  • This is an internal bug fix in the Redux state management layer
  • No user-facing configuration or API changes
  • No new features or capabilities introduced
  • Users don't need to take any action

The fix is well-documented in the PR description and commit message, which is appropriate for an internal bug fix like this.

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 1 file

@tingwai tingwai requested a review from RomneyDa December 1, 2025 18:29
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.

@uinstinct nice digging to find the root cause here. The handleToolCallsInMessage which is removed here is the only path which is reached if there is no thinking for streamed tool calls. It seems like removing this would break tool calls for many other models/situations (not fully sure). Could we instead update handleToolCallsInMessage so that it doesn't add the extraneous character which is causing the parsing failures?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Dec 1, 2025
@uinstinct
Copy link
Contributor Author

@RomneyDa Actually the reason for removing handleToolCallsInMessage in that if condition was to keep that if condition explicit for creating a new message. It eventually reaches the tool call condition which gets the tool call parsing and args.

I had tested them on other models and all seem to work fine. The only model which replicated the tool call behaviour sometimes (i.e. tool call without any message content) was kimi k2, which was also working fine.

kimi k2 subsequent tool usage image

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.

@uinstinct thanks for the explanation!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 2, 2025
@RomneyDa RomneyDa merged commit 305c55c into continuedev:main Dec 2, 2025
70 of 74 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Dec 2, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2025
@uinstinct uinstinct deleted the gpt-5-second-tool branch December 2, 2025 11:34
@sestinj
Copy link
Contributor

sestinj commented Dec 2, 2025

🎉 This PR is included in version 1.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Dec 2, 2025

🎉 This PR is included in version 1.37.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Dec 2, 2025

🎉 This PR is included in version 1.34.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Dec 4, 2025

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

lgtm This PR has been approved by a maintainer released size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants