Repository navigation
fix: add onboarding roster guard and skill overwrite warning - #867
Conversation
🟡 Impact Analysis — PR #867Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-cli (2 files)
tests (2 files)
|
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ❌ | Branch up to date | dev is 3 commit(s) ahead — rebase recommended |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ❌ | Copilot threads resolved | 1 unresolved Copilot thread(s) — fix and resolve before merging |
| ❌ | CI passing | 14 check(s) still running |
Files Changed (5 files, +215 −0)
| File | +/− |
|---|---|
.changeset/audit-onboarding-skill-guards.md |
+5 −0 |
packages/squad-cli/src/cli/core/upgrade.ts |
+18 −0 |
packages/squad-cli/src/cli/shell/index.ts |
+20 −0 |
test/cli/upgrade.test.ts |
+99 −0 |
test/init-autocast.test.ts |
+73 −0 |
Total: +215 −0
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🏗️ Architectural Review
Automated architectural review — informational only. |
There was a problem hiding this comment.
Pull request overview
This PR adds two defensive safeguards to the Squad CLI: (1) a production guard in the interactive shell onboarding flow to prevent dispatching to the coordinator when the roster wasn’t actually populated, and (2) a warning during squad upgrade when customized built-in skills are about to be overwritten.
Changes:
- Add a post-
createTeam()roster validation infinalizeCast()that aborts dispatch, cleans up.init-prompt, and resets UI state when the roster is empty. - Warn during both upgrade code paths when an on-disk skill differs from the built-in template (with CRLF normalization to reduce false positives).
- Add a changeset for the CLI patch release.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/squad-cli/src/cli/shell/index.ts | Adds a guard to prevent coordinator dispatch when team creation yields an empty roster and cleans up .init-prompt to avoid retry loops. |
| packages/squad-cli/src/cli/core/upgrade.ts | Adds skill-overwrite customization warnings in both manifest upgrade and “already current” ensure-sync paths. |
| .changeset/audit-onboarding-skill-guards.md | Declares a patch changeset describing the two additive audit fixes. |
| /** | ||
| * Warn when a built-in skill has been customized and is about to be overwritten. | ||
| * Normalizes line endings before comparison to avoid false positives from CRLF differences. | ||
| */ | ||
| function warnIfSkillCustomized(srcPath: string, destPath: string, sourceName: string): void { | ||
| if (!storage.existsSync(destPath)) return; | ||
| const existing = (storage.readSync(destPath) ?? '').replace(/\r\n/g, '\n'); | ||
| const template = (storage.readSync(srcPath) ?? '').replace(/\r\n/g, '\n'); | ||
| if (existing && existing !== template) { | ||
| const skillName = sourceName.split('/')[1] ?? sourceName; | ||
| warn(`Skill '${skillName}' has been customized — overwriting with built-in version`); | ||
| } | ||
| } |
There was a problem hiding this comment.
warnIfSkillCustomized() and its new call sites add a behavioral guarantee (warn only when overwriting a customized built-in skill, with CRLF normalization), but existing upgrade tests don’t assert the warning is emitted (or not emitted) in the key cases. Please add tests that (1) modified skill content triggers warn, (2) CRLF-only differences do not, and (3) identical content does not.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Tests already present in commit ea53d68. Four cases covered in test/cli/upgrade.test.ts: (1) modified skill content triggers warning, (2) CRLF-only differences do NOT trigger warning, (3) identical content does NOT trigger warning, (4) full version upgrade path with customized skill triggers warning. All 28 tests pass.
…#867 review feedback) Agent-Logs-Url: https://github.com/bradygaster/squad/sessions/90986e85-287f-47c5-a192-0ada9af52763 Co-authored-by: diberry <41597107+diberry@users.noreply.github.com>
8cd5ab9 to
ea53d68
Compare
Item 1: After team creation in finalizeCast(), verify roster is actually populated before re-dispatching to coordinator. Cleans up .init-prompt on failure to prevent auto-retry loops. Item 2: During squad upgrade, warn when a customized built-in skill is about to be overwritten. Warning appears in both the manifest upgrade path and the syncAllSkills ensure-check path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ea53d68 to
9380ec9
Compare
tamirdresher
left a comment
There was a problem hiding this comment.
Approved by @tamirdresher — reviewed diff, CI green, changes are clean and well-tested. cc @diberry
Item 1: After team creation in finalizeCast(), verify roster is actually populated before re-dispatching to coordinator. Cleans up .init-prompt on failure to prevent auto-retry loops. Item 2: During squad upgrade, warn when a customized built-in skill is about to be overwritten. Warning appears in both the manifest upgrade path and the syncAllSkills ensure-check path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Closed by #theSquadsquad triage — verified fixed in v0.9.4. |
Architecture Audit — 2 Medium-Priority Fixes
Item 1: Onboarding flow production guard
After
createTeam()infinalizeCast(), verify the roster is populated before re-dispatching to the coordinator. If empty:.init-prompt(prevents auto-retry loops)File:
packages/squad-cli/src/cli/shell/index.tsItem 2: Skill upgrade overwrite warning
During
squad upgrade, warn when a customized built-in skill is about to be overwritten. Fires in both code paths:syncAllSkills()(already-current ensure checks)Normalizes line endings before comparison to avoid false positives on Windows.
File:
packages/squad-cli/src/cli/core/upgrade.tsItem 3: Regression tests for finalizeCast roster guard
Added 7 regression tests in
test/init-autocast.test.tsunder a newfinalizeCast roster guard — empty roster prevents dispatchdescribe block, covering:createTeam()→.init-promptdeleted (prevents auto-retry loop)createTeam()→ dispatch aborted (early return).init-promptpreserved, dispatch proceeds normally.init-prompt, completely emptyteam.mdFile:
test/init-autocast.test.tsNotes
start.tsis unrelatedRequested by: Dina Berry