Skip to content

create_new_file fails on pure JSON contents #8972

@mcowger

Description

@mcowger

Before submitting your bug report

Relevant environment info

- OS: MacOS
- Continue version: 	1.3.24
- IDE version: 1.107
- Model: M2

Description

When the model calls create_new_file, and the contents argument is, itself, valid JSON, the contents argument is an object, not a string, because this snippet in core/context/retrieval/pipelines/BaseRetrievalPipeline.ts:

      const parsed = JSON.parse(responseContent);
      toolCalls = parsed.tools || [];

Will have deeply parsed the response. This causes getStringArg() to throw an error. Instead, if the type of args[argName] is 'object', it should be coerced back to a string with JSON.stringify()

I'll submit a PR shortly for this

To reproduce

  1. Enable tool calls
  2. Ask a model in agent mode: "Create a new file called sample.json"

Log output

Metadata

Metadata

Labels

area:toolsRelates to tool usagekind:bugIndicates an unexpected problem or unintended behavioros:macHappening specifically on Mac

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions