fix(#730): prevent squad.agent.md silent deletion — 3 code path fixes#731
Closed
fix(#730): prevent squad.agent.md silent deletion — 3 code path fixes#731
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Vitest suite that reproduces issue #730 by exercising init, upgrade, and doctor behaviors around .github/agents/squad.agent.md when the template source is missing or the agent file is empty/nearly-empty.
Changes:
- Add new integration-style tests covering upgrade “already current” refresh behavior when
squad.agent.md.templateis missing. - Add SDK
initSquadtest to demonstrate missing-template behavior for agent file creation. - Add doctor check expectation for empty
squad.agent.mdseverity.
This was referenced Apr 1, 2026
diberry
added a commit
that referenced
this pull request
Apr 1, 2026
- Remove stale "EXPECTED: FAIL" comments (tests now pass) - Add existsSync guard to hideTemplate() with clear error message - Replace magic number assertions with structural content checks - Fix misleading test name for empty-file upgrade path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0f8a879 to
fa4cbba
Compare
Collaborator
Author
|
👋 @bradygaster — This PR is ready for your review and merge when you're ready. Single squashed commit, changelog entry included, CI should be green. |
fa4cbba to
e78d781
Compare
Closes #730 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e78d781 to
f0731d4
Compare
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents
squad.agent.mdfrom silently disappearing after upgrade/init when the template source is missing or the file becomes empty. Fixes 3 code paths where the agent discovery file could vanish without warning, breaking Copilot's ability to find the Squad agent.Closes #730
Root Causes Fixed
upgrade.ts:497-530init.ts:1031-1059doctor.ts:382-412warnfail, updated message to mention Copilot discoveryTest Coverage
6 tests in
test/cli/agent-file-resilience.test.ts:All 6 new tests pass. All 55 existing tests pass.
Files Changed
test/cli/agent-file-resilience.test.ts— new: 6 resilience testspackages/squad-cli/src/cli/core/upgrade.ts— fix: fallback generation + empty file detectionpackages/squad-sdk/src/config/init.ts— fix: fallback generation when template missingpackages/squad-cli/src/cli/commands/doctor.ts— fix: empty file severity warn→failtest/cli/doctor.test.ts— updated: expectfailinstead ofwarnCHANGELOG.md— added entry under[Unreleased] ### FixedCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com