Skip to content

create_new_file writes a JSON file on one line when the model sends its contents as a JSON value #13363

Open

Description

@YauhenBichel

Relevant environment info

  • OS: macOS
  • Continue version: 2.0.0 (also checked on main at 5522c6f)
  • IDE version: VS Code 1.141.0
  • Model: Qwen3.6-Coder 35B, served locally through an OpenAI-compatible API (provider openai)

Description

When a model sends the contents of a new .json file as a JSON value instead of a string, create_new_file writes the file on a single line, for example:

{"name":"app","version":"1.0.0","scripts":{"build":"tsc"},"devDependencies":{"typescript":"^5.6.0"}}

A package.json or tsconfig.json written like this is valid, but nobody would write it that way, and every later edit produces a large diff.

Cause: createNewFileImpl reads the contents with getStringArg, which turns an object back into text with JSON.stringify(value). That compact form is right for other string arguments (and is what the existing tests expect), but for the contents of a file, indented JSON (JSON.stringify(value, null, 2)) is what the model meant.

To reproduce

Call createNewFileImpl({ filepath: "app/package.json", contents: { name: "app", private: true } }, extras): the file is written as {"name":"app","private":true}.

Log output

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions