Repository navigation
Description
Split off from #1436.
Problem
squad upgrade currently rewrites .github/workflows/* from bundled CLI templates without preserving user edits. Projects that have hand-tuned their CI (added a job, changed a trigger, tightened permissions, pinned an action to a SHA) lose those edits silently on every upgrade. There is no prompt, no diff, no backup.
This is the operative CI surface, so overwriting it silently is a real regression risk (and a permissions / supply-chain risk in repos that pin action SHAs).
Scope
Only the operative workflow files under .github/workflows/ are in scope. The stale template copies under .squad/templates/workflows/ are being addressed separately in #1436.
Options to evaluate
.local-backuppattern. Before overwritingfoo.yml, copy the current file tofoo.yml.local-backup(orfoo.yml.pre-upgrade-<timestamp>.bak) so the user always has the previous version on disk. Pros: zero UX changes, always safe. Cons: leaves clutter, does not stop the overwrite.- Preserve sentinel. Recognize a leading marker in the workflow file (e.g.
# squad-preserve: trueon line 1 or line 2) and skip overwriting any workflow that carries it. Pros: explicit user opt-in per file, no config surface. Cons: relies on users knowing the sentinel exists. - Preserve flag. New
squad upgradeflag (--preserve-workflows, or--preserve <glob>) plus a config entry under.squad/config.json(e.g.upgrade.preserve: [".github/workflows/**"]). Pros: declarative, discoverable, per-repo. Cons: bigger surface to design and document. - Diff + prompt. Detect a hash mismatch between the on-disk file and the last-known-shipped template, and either prompt in interactive mode or emit a
.difffile and skip the write in non-interactive mode. Pros: safest default. Cons: needs a shipped-template manifest and hash tracking.
Options are not mutually exclusive. A reasonable minimum viable fix could be (1)+(2): always drop a .local-backup and honor a sentinel, with (3) as a follow-up if we want declarative config, and (4) as the long-term correct answer.
Acceptance
squad upgradeon a project with a modified.github/workflows/*.ymlfile does not silently discard the modification.- Regression test that starts from a modified workflow file, runs
squad upgrade, and asserts the modification survived (or was preserved to a.local-backupalongside a clear log line). - Docs updated with the chosen mechanism.
Activity
jmservera commentedon Jul 20, 2026
The file most commonly affected is squad-ci.yml, as Squad tends to place all CI-related logic there unless instructed otherwise. Given the way this file is structured (it appears to be little more than a scaffold for a GitHub Action) it is very likely to be customized. However, the
squad upgradeprocess always rewrites it, which can overwrite those modifications.omercangumus commentedon Aug 13, 2026
reproduced this in est/workflows.test.cjs: a modified .github/workflows/squad-ci.yml is overwritten by squad upgrade and no .local-backup is left behind. taking the small backup path here and adding coverage around the pre-upgrade workflow invariant.
bradygaster commentedon Aug 23, 2026
Owner & rationale
Owner: Booster (
squad:booster). This is workflow-generation safety:squad upgradewrites conventional.github/workflows/*.ymlfiles from bundled templates and currently discards local CI hardening. The implementation touches CLI upgrade code, but the acceptance gate is “workflow edits are not silently lost.”This targets the templated workflow surface copied by
squad upgrade, not gh-aw source files inworkflows/*.md.Files in scope
Verified existing paths:
packages/squad-cli/src/cli/core/upgrade.tspackages/squad-cli/src/cli/core/templates.tsindex.cjstest/workflows.test.cjstemplates/workflows/squad-ci.ymlpackages/squad-cli/templates/workflows/squad-ci.ymlpackages/squad-sdk/templates/workflows/squad-ci.yml.github/workflows/squad-workflow-lint.ymlReproduction / measurement
Execution-tested command, using a scratch directory inside the repo workspace and no output suppression:
Observed output:
Verification bar
A fix is acceptable only if the same scenario produces either
custom_survived=Trueorbackup_exists=True, plus a clear upgrade log line telling the user where the original content went. Add/keep a regression test intest/workflows.test.cjsthat fails against currentdevand passes with the preservation mechanism.Traps
.local-backupminimum path and adds test coverage, but it does not update user-facing docs for the chosen mechanism..github/workflows/squad-workflow-lint.ymlalready exists. If workflow-template validation changes while fixing this, extend that workflow rather than adding a parallel lint path.workflows/*.md; gh-aw compilation is not the code path. The overwrite happens inwriteWorkflowFile/template-copy logic.generateProjectWorkflowStubwrites generated content that must get the same preservation behavior as verbatim template copies.Out of scope
.lock.ymlactionlint/schema work from Emitted .lock.yml fails actionlint with 6 errors (copilot-requests scope, concurrency.queue) #1827.Session-stall guard
Before starting: this repo has phantom CRLF diffs (#1793). If
git statusshows files modified that you did not touch, rungit diff --ignore-cr-at-eol. If that output is empty, the diff is line-ending churn, not real edits — rungit add --renormalize .and continue. Do not halt and ask for confirmation; halting on phantom diffs is the documented cause of stuck sessions in this repo.bradygaster commentedon Aug 23, 2026
PR #1709 triage verdict
I inspected PR #1709’s diff and status.
Finding: PR #1709 partially addresses #1493. It implements the minimum
.local-backuppath in bothpackages/squad-cli/src/cli/core/upgrade.tsandindex.cjs, and adds regression coverage intest/workflows.test.cjs. That is the right direction and should stop silent loss of local edits by preserving the pre-upgrade file.CI/mergeability:
gh pr view 1709 --json ...reportsmergeable: MERGEABLE; visible check runs on commit3f6b0d6are successful/skipped, not genuinely failing. The automated nudge says the branch is now behinddev, so this looks like stale green CI that needs a rebase/rerun, not a failing-test investigation.Recommendation: request changes before merge:
.local-backupmechanism, because squad upgrade overwrites local edits to.github/workflows/*#1493 acceptance includes “Docs updated with the chosen mechanism.”devand rerun CI so the green checks are current.I would not close the PR as superseded; it is a valid partial fix once those two items are addressed.
fix(cli): back up workflows during upgrade (github#1709)