Skip to content

Add existence check to create-agent-session codemod#12316

Merged
pelikhan merged 2 commits intomainfrom
copilot/rename-create-agent-task-to-session
Jan 28, 2026
Merged

Add existence check to create-agent-session codemod#12316
pelikhan merged 2 commits intomainfrom
copilot/rename-create-agent-task-to-session

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

The agent-task-to-agent-session-migration codemod migrates safe-outputs.create-agent-task to safe-outputs.create-agent-session but lacked a safety check for the target field's existence, risking data loss in workflows containing both fields.

Changes

  • Safety check: Skip migration if create-agent-session already exists in frontmatter
  • Logging: Log skip reason when target field exists
  • Test coverage: Verify migration is skipped when both fields present

Behavior

Before:

safe-outputs:
  create-agent-task:
    title: Old Task
  create-agent-session:
    title: New Session  # Would be overwritten

After:

safe-outputs:
  create-agent-task:
    title: Old Task
  create-agent-session:
    title: New Session  # Preserved, migration skipped

The codemod now correctly implements the "if it does not exist yet" requirement by checking target field existence before transformation.

Original prompt

Create a codemox that renames "safe-outputs.create-agent-task" to "safe-outputs.create-agent-session" (if it does not exist yet)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Rename safe-outputs.create-agent-task to safe-outputs.create-agent-session Add existence check to create-agent-session codemod Jan 28, 2026
Copilot AI requested a review from pelikhan January 28, 2026 17:42
@pelikhan pelikhan marked this pull request as ready for review January 28, 2026 17:43
@pelikhan pelikhan merged commit c850ed8 into main Jan 28, 2026
@pelikhan pelikhan deleted the copilot/rename-create-agent-task-to-session branch January 28, 2026 17:43
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.

2 participants