Skip to content

bug: squad upgrade version stamp overwritten by template manifest loop #195

Closed

Description

@dnoriegagoodwin

squad upgrade reports success but the version stamp never persists. Running upgrade repeatedly always shows 0.0.0-source → 0.8.18 — it never reaches "Already up to date."

Repro

squad upgrade    # says "0.0.0-source → 0.8.18"
squad upgrade    # says "0.0.0-source → 0.8.18" again (should say "Already up to date")
grep "version:" .github/agents/squad.agent.md   # still shows 0.0.0-source

Root Cause

In upgrade.js, stampVersion() correctly writes the version into squad.agent.md (line ~342), but the TEMPLATE_MANIFEST loop (line ~347) includes squad.agent.md with overwriteOnUpgrade: true, which copies the unstamped template back over the stamped file.

In templates.js:

export const TEMPLATE_MANIFEST = [
    {
        source: 'squad.agent.md',
        destination: '../.github/agents/squad.agent.md',
        overwriteOnUpgrade: true,  // <-- this causes the overwrite
    },
    // ...
];

In upgrade.js:

// Step 1: Copy + stamp (works correctly)
fs.copyFileSync(agentSrc, agentDest);
stampVersion(agentDest, cliVersion);

// Step 2: Template manifest loop (overwrites the stamp)
const filesToUpgrade = TEMPLATE_MANIFEST.filter(f => f.overwriteOnUpgrade);
for (const file of filesToUpgrade) {
    fs.copyFileSync(srcPath, destPath);  // squad.agent.md gets overwritten here
}

Impact

Fix (verified locally)

Exclude squad.agent.md from the manifest loop — it is already handled explicitly with stampVersion():

const filesToUpgrade = TEMPLATE_MANIFEST.filter(f => f.overwriteOnUpgrade && f.source !== 'squad.agent.md');

After this one-line change, squad upgrade correctly stamps 0.8.18 and subsequent runs report "Already up to date (v0.8.18)."

Environment

  • squad --version: 0.8.18
  • Node.js: v25.7.0
  • npm: 11.10.1
  • OS: Linux
  • Install method: npm install -g @bradygaster/squad-cli@0.8.18

Activity

  1. dnoriegagoodwin commented on Mar 5, 2026

    @dnoriegagoodwin
    Author

    Really only relevant for folks migrating an old .squad folder built in like v0.3.0 heh

  2. github-actions commented on Mar 5, 2026

    @github-actions
    Contributor

    🏗️ Squad Triage — Keaton (Lead)

    Issue: #195 — bug: squad upgrade version stamp overwritten by template manifest loop
    Assigned to: Hockney (Tester)
    Reason: Issue relates to testing/quality work

    @copilot evaluation: 🔴 Not suitable — issue involves work outside the coding agent's capability profile.

    Team roster:

    • Keaton (Lead) → label: squad:keaton
    • Verbal (Prompt Engineer) → label: squad:verbal
    • Fenster (Core Dev) → label: squad:fenster
    • Hockney (Tester) → label: squad:hockney
    • McManus (DevRel) → label: squad:mcmanus
    • Kujan (SDK Expert) → label: squad:kujan
    • Edie (TypeScript Engineer) → label: squad:edie
    • Kobayashi (Git & Release) → label: squad:kobayashi
    • Fortier (Node.js Runtime) → label: squad:fortier
    • Rabin (Distribution) → label: squad:rabin
    • Baer (Security) → label: squad:baer
    • Redfoot (Graphic Designer) → label: squad:redfoot
    • Strausz (VS Code Extension) → label: squad:strausz
    • Saul (Aspire & Observability) → label: squad:saul
    • Kovash (REPL & Interactive Shell) → label: squad:kovash
    • Marquez (CLI UX Designer) → label: squad:marquez
    • Cheritto (TUI Engineer) → label: squad:cheritto
    • Breedan (E2E Test Engineer) → label: squad:breedan
    • Nate (Accessibility Reviewer) → label: squad:nate
    • Waingro (Product Dogfooder) → label: squad:waingro
    • Ralph (Work Monitor) → label: squad:ralph
    • @copilot (Coding Agent) → label: squad:copilot

    To reassign, remove the current squad:* label and add the correct one.

  3. github-actions commented on Mar 5, 2026

    @github-actions
    Contributor

    📋 Assigned to Fenster (Core Dev)

    Issue: #195 — bug: squad upgrade version stamp overwritten by template manifest loop

    Fenster will pick this up in the next Copilot session.

    For Copilot coding agent: If enabled, this issue will be worked automatically.
    Otherwise, start a Copilot session and say:
    Fenster, work on issue #195

  4. added 2 commits that reference this issue on Mar 7, 2026
  5. bradygaster commented on Mar 7, 2026

    @bradygaster
    Collaborator

    ✅ Fixed by PR #221 (merged commit 0315468) — test suite regressions resolved.

    Closed as part of v0.8.21 release wave cleanup.

  6. bradygaster commented on Mar 7, 2026

    @bradygaster
    Collaborator

    Brilliant catch, @dnoriegagoodwin! The version stamping race condition—where the template loop overwrites the stamped version—is exactly the kind of subtle bug that's hard to spot. Your one-line fix is perfect. Thanks for the investigation and verification! 🔧

    — McManus 📝, on behalf of the Squad

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

    go:needs-researchNeeds investigationrelease:nextTargeted for next releasesquadSquad triage inbox — Lead will assign to a member

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions