Skip to content

[aw-compat] Codemod bug: Migrate tools.serena incorrectly updates source: commit pin to @main #28241

@github-actions

Description

@github-actions

Discovered during the 2026-04-24 daily compatibility run across 20 external repositories.

Problem

The codemod "Migrate tools.serena or engine.tools.serena to shared Serena import" leaves workflows in a broken state after it runs. It reports success but the subsequent gh aw compile --strict fails with a new error.

Affected repositories (confirmed in 2 of 20 audited):

  • storybookjs/storybookduplicate-code-detector.md
  • microsoft/FluidFrameworkduplicate-code-detector.md

Both use workflows originally sourced from github/gh-aw/.github/workflows/duplicate-code-detector.md at a pinned commit.

Before → After

Before fix (error):

tools.serena: unknown tool name. The 'tools' section only accepts built-in tool names.

Codemod diff:

-tools:
-  serena: ['typescript']
+  # (removed)
 imports:
   - shared/mood.md
+  - uses: shared/mcp/serena.md
+    with:
+      languages: ["typescript"]
-source: github/gh-aw/.github/workflows/duplicate-code-detector.md@852cb06ad52958b402ed982b69957ffc57ca0619
+source: github/gh-aw/.github/workflows/duplicate-code-detector.md@main

After fix (new error):

error: import 'github/gh-aw/.github/workflows/shared/mcp/serena.md@main':
  required 'with' input "languages" is missing (declared in import-schema)
   8 |   contents: read
   9 |   issues: read
  10 |   pull-requests: read
  11 | engine: copilot

Root Cause

The codemod makes two changes but only one is correct:

  1. Correct: Removes tools.serena and adds imports: uses: shared/mcp/serena.md with: languages: [...]
  2. Incorrect: Changes source: @<pinned-commit> to source: @main``

The source: @main`` change causes the compiler to pull the current duplicate-code-detector.md template from gh-aw HEAD (`0775d65`). The current template has diverged significantly (it now imports `shared/go-source-analysis.md` rather than using serena directly). This divergence triggers a compile-time error about the `languages` input being missing in the resolved import chain, even though the local file correctly provides `languages`.

Expected Behaviour

The codemod should preserve the existing source: commit pin. The tools.serena → imports migration is a local fix; bumping the source pin is a separate upgrade operation that should be done explicitly via gh aw upgrade.

Suggested Fix

In the serena migration codemod implementation, remove the step that updates the source: field. The source pin should remain unchanged after this codemod runs.

If the intent is to also upgrade the source version, this should be gated on a separate flag or done as a distinct codemod that validates the upgrade is safe.

Workaround for Affected Users

Until this is fixed, affected users should:

  1. Run gh aw fix --write to get the import migration
  2. Then manually restore the original source: pin:
    source: github/gh-aw/.github/workflows/duplicate-code-detector.md@<original-commit-hash>
  3. Re-run gh aw compile --strict to verify

References:

Generated by Daily AW Cross-Repo Compile Check · ● 606.8K ·

  • expires on May 1, 2026, 11:12 AM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions