Skip to content

[Bug]: npx playwright init-agents --loop=vscode generates invalid YAML in agent files #39147

@lucielavickova-tesena

Description

@lucielavickova-tesena

Description

When running npx playwright init-agents --loop=vscode, the generated .agent.md files contain malformed YAML frontmatter that fails VS Code's agent file validation.

Problem:

The description field is generated as a multi-line string with improper YAML indentation:

This causes VS Code to report the error:

"Attribute 'using Playwright Examples' is not supported in VS Code agent files. Supported: argument-hint, description, handoffs, infer, model, name, target, tools."

Root Cause:

The init-agents command template doesn't validate generated YAML against VS Code's agent file schema. The multi-line description with embedded XML breaks YAML parsing.

Solution:

The description should be a single line.

Version

1.57.0

Steps to reproduce

  1. In the Playwright project directory, run npx playwright init-agents --loop=vscode command in the terminal
  2. Open any generated .agent.md file in VS Code (for example .github\agents\playwright-test-generator.agent.md)
  3. Observe red error underlines on the description field

Expected behavior

  • The generated .md files pass VS Code's agent file schema validation
  • Files open in VS Code without any error underlines or validation warnings
  • All fields in the frontmatter conform to VS Code's supported agent file attributes

Actual behavior

  • The generated .agent.md files contain malformed YAML in the description field
  • The description is split across multiple lines with improper indentation and embedded XML examples
  • VS Code displays red error underlines on the description content
  • VS Code reports: "Attribute 'using Playwright Examples' is not supported in VS Code agent files"
  • The agent files work functionally, but fail schema validation in the editor
Image Image

Additional context

No response

Environment

Operating System: Windows
Node.js version: v24.13.0
npm version: 11.8.0
Playwright version: @playwright/test@^1.57.0
VS Code version: 1.108.2

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