Skip to content

fix: resolve assign-to-agent key mismatch (name vs default-agent)#17396

Merged
pelikhan merged 6 commits intomainfrom
copilot/fix-assign-to-agent-key-mismatch
Feb 21, 2026
Merged

fix: resolve assign-to-agent key mismatch (name vs default-agent)#17396
pelikhan merged 6 commits intomainfrom
copilot/fix-assign-to-agent-key-mismatch

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

  • Fix actions/setup/js/types/safe-outputs-config.d.ts: replace "default-agent" with name and add missing fields
  • Fix pkg/workflow/assign_to_agent.go: removed deprecated default-agent alias support (field removed from schema)
  • Remove pkg/parser/schemas/main_workflow_schema.json: removed default-agent deprecated property
  • Update pkg/workflow/assign_to_agent_test.go: removed deprecated alias tests, kept canonical name test
  • Add pkg/cli/codemod_assign_to_agent.go: codemod to rename default-agentname via gh aw fix
  • Add pkg/cli/codemod_assign_to_agent_test.go: codemod tests
  • Register codemod in pkg/cli/fix_codemods.go
  • Fix pkg/cli/fix_codemods_test.go: update expected codemod count (21→22) and add new codemod to order list
Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Resolve assign-to-agent key mismatch (name vs default-agent)</issue_title>
<issue_description>## Context

From the safe outputs audit in #17317, the assign-to-agent safe output has an inconsistency: docs and the Go parser use name, but the TypeScript type declaration uses default-agent.

Problem

  • Docs (docs/src/content/docs/reference/safe-outputs.md:1097-1103): uses name
  • Go parser (pkg/workflow/assign_to_agent.go:13-16): expects name
  • TypeScript types (actions/setup/js/types/safe-outputs-config.d.ts:220-223): advertises default-agent

This means tooling relying on .d.ts may configure the wrong key.

Approach

  1. Update actions/setup/js/types/safe-outputs-config.d.ts to use name instead of default-agent
  2. If default-agent is currently accepted anywhere at runtime, add it as a deprecated alias and emit a warning
  3. Add/update tests covering config parsing and type surface consistency
  4. Update docs examples to show canonical name only

Files to Modify

  • actions/setup/js/types/safe-outputs-config.d.ts
  • pkg/workflow/assign_to_agent.go (only if alias support is needed)
  • docs/src/content/docs/reference/safe-outputs.md
  • Tests in pkg/workflow/ related to assign_to_agent

Acceptance Criteria

  • name is the canonical key in docs, types, and parser
  • Existing workflows using default-agent continue to work with a deprecation warning (or fail with a clear migration error)
  • Tests pass covering both the canonical key and alias behavior
    Related to Safe outputs audit (consistency, overlap, gaps) #17317

Generated by Plan Command for issue #17317

  • expires on Feb 23, 2026, 4:54 AM UTC

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix assign-to-agent key mismatch in TypeScript types fix: resolve assign-to-agent key mismatch (name vs default-agent) Feb 21, 2026
@pelikhan
Copy link
Contributor

@copilot add codemod to change syntax

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot add codemod to change syntax

Added in commit 771505a. Running gh aw fix will now automatically rename default-agent to name inside any safe-outputs.assign-to-agent config block, preserving indentation and inline comments. It skips the migration if name is already present.

"$ref": "#/$defs/github_token",
"description": "GitHub token to use for this specific output type. Overrides global github-token if specified."
},
"default-agent": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in f462d4f.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
return &AssignToAgentConfig{}
}

// Handle deprecated 'default-agent' key: if 'name' was not set but 'default-agent' is present in the raw map, use its value and emit a deprecation warning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot no support for deprecated field, it is removed from schema

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 8f7b65e. The deprecated alias handling code and its tests are gone — only the canonical name key is now supported at runtime.

…nt.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review February 21, 2026 11:32
Copilot AI review requested due to automatic review settings February 21, 2026 11:32
@pelikhan
Copy link
Contributor

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns assign-to-agent configuration across TypeScript types, JSON schema, and Go parsing by standardizing on the canonical name key (removing the previously-advertised default-agent key), and adds an automatic codemod to migrate existing workflows.

Changes:

  • Updated the TypeScript .d.ts surface for AssignToAgentConfig to use name and include previously missing fields.
  • Updated validation/parsing to drop support for default-agent and rely on name only.
  • Added and registered a gh aw fix codemod (with tests) to migrate default-agentname in workflow frontmatter.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
actions/setup/js/types/safe-outputs-config.d.ts Makes TS config type match canonical name key and completes the assign-to-agent config surface.
pkg/parser/schemas/main_workflow_schema.json Removes default-agent from schema and ensures assign-to-agent validates against name.
pkg/workflow/assign_to_agent.go Enforces canonical name parsing at runtime (no alias).
pkg/workflow/assign_to_agent_test.go Adds a parsing test asserting name works for assign-to-agent.
pkg/cli/codemod_assign_to_agent.go Implements a codemod to migrate default-agentname within safe-outputs.assign-to-agent.
pkg/cli/codemod_assign_to_agent_test.go Adds coverage for migration, preservation behavior, and no-op/skip scenarios.
pkg/cli/fix_codemods.go Registers the new codemod in the global codemod list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ent codemod

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

Fix tests https://github.com/github/gh-aw/actions/runs/22253456359/job/64387078232 @copilot

Fixed in aafba21. Updated fix_codemods_test.go to expect 22 codemods (up from 21) and added assign-to-agent-default-agent-to-name to the expected order list.

@pelikhan pelikhan merged commit 565f815 into main Feb 21, 2026
@pelikhan pelikhan deleted the copilot/fix-assign-to-agent-key-mismatch branch February 21, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Resolve assign-to-agent key mismatch (name vs default-agent)

3 participants