Skip to content

Conversation

@silencezhoudev
Copy link
Contributor

@silencezhoudev silencezhoudev commented Jan 21, 2026

Description

In certain cases, the toolCall.function.arguments returned by the LLM or intermediate processing layer can be an object rather than a JSON string, which may result in filepath being empty or incorrectly parsed when handling the create_new_file tool call.

This PR adds proper validation and normalization for filepath to ensure file creation works reliably across platforms (including macOS and Windows).

Fixes #9045
Fixes #8764

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

N/A (logic fix in agent tool layer)

Tests

  • Reproduced the issue on macOS (file creation failed due to empty or invalid filepath)
  • Patched the VSCode extension production bundle (out/extension.js) locally to validate the fix in a real plugin environment
  • Verified that new files are created correctly after applying filepath validation and path normalization
  • Issue is also consistent with the original Windows report in Code writing to file failed #9045

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


Continue Tasks: ▶️ 2 queued — View all


Summary by cubic

Support object-type tool call arguments to prevent parameter loss and ensure create_new_file gets a valid filepath. Fixes #9045 across macOS and Windows.

  • Bug Fixes
    • If toolCall.function.arguments is a non-empty plain object, return it; otherwise parse the JSON string.

Written for commit 82f6f69. Summary will update on new commits.

@silencezhoudev silencezhoudev requested a review from a team as a code owner January 21, 2026 09:35
@silencezhoudev silencezhoudev requested review from RomneyDa and removed request for a team January 21, 2026 09:35
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 21, 2026
@github-actions
Copy link

github-actions bot commented Jan 21, 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 1 file

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 21, 2026
Add type check in safeParseToolCallArgs to handle cases where
toolCall.function.arguments is already an object instead of a JSON string.
This prevents parameter loss and 'argument is required' errors in tool calls.
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.

Makes args parsing a bit more robust 👍

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jan 23, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 23, 2026
@RomneyDa RomneyDa merged commit 363c3c7 into continuedev:main Jan 23, 2026
56 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jan 23, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2026
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 size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Code writing to file failed Can't create files. Please stop feature development and fix the base...

2 participants