Repository navigation
fix(gh-aw): align squad-cast history.json playbook with validator and add skill-discovery fallback - #2474
Conversation
… add skill-discovery fallback The squad-cast playbook told the agent to initialize .squad/casting/history.json with assigned_at/agent_count and empty assignment_cast_snapshots, which squad-cast-validator.mjs rejects (used_at, a cast-revision-1 snapshot stamped with registry.generated_at, and no transaction_id/registry_revision are required). Every first /squad cast therefore failed with "universe usage history is malformed" and cascaded into specialists=0 false positives. - Replace the Step 3 history.json example with a validator-passing fresh-Cast example and spell out the schema rules. - Add an Execute Mode fallback: when the skill tool reports "Skill not found" (headless SDK sessions), read .github/skills/<name>/SKILL.md from disk. - Add a drift test that extracts the playbook example, pairs it with a matching revision-1 registry, and runs it through the validators; also asserts the package copy carries the identical example. - Regenerate workflows/package/squad.md and manifest digests. Fixes #2473 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🟡 Impact Analysis — PR #2474Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (3 files)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | No source files changed — changeset not required |
| ✅ | 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 | All checks passing |
Files Changed (4 files, +94 −9)
| File | +/− |
|---|---|
test/gh-aw-cast-validator.test.ts |
+47 −0 |
workflows/package/squad.md |
+21 −2 |
workflows/squad-workflows.manifest.json |
+5 −5 |
workflows/squad.md |
+21 −2 |
Total: +94 −9
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
There was a problem hiding this comment.
🟡 Changes recommended
The revision-1-to-2 transition retains an unversioned snapshot key that both validators reject, requiring a key rename, matching usage update, regression coverage, and regenerated artifacts.
1 open issue
What changed in this PR
This PR addresses first-run /squad cast failures from #2473 by aligning the workflow playbook with the casting validator and providing a fallback for headless SDK skill discovery.
Changes:
- Corrects the fresh-Cast history schema and adds a concrete example.
- Adds direct reading of installed skill files when skill discovery fails.
- Adds validator coverage for the example and refreshes the packaged workflow and integrity digests.
| File | Description |
|---|---|
workflows/squad.md |
Updates skill-loading fallback and casting-history instructions. |
workflows/squad-workflows.manifest.json |
Refreshes workflow integrity digests. |
workflows/package/squad.md |
Mirrors the updated instructions in the installable workflow. |
test/gh-aw-cast-validator.test.ts |
Checks example parity and acceptance by both validators. |
Review effort: Balanced (auto)
| } | ||
| ``` | ||
| <!-- SQUAD:CAST-HISTORY-EXAMPLE:END --> | ||
| For a re-Cast at revision N, append one `cast-revision-N` snapshot and one usage record (both stamped with the new `generated_at`) to the committed history instead of rewriting it. |

What
Aligns the
squad-castplaybook's.squad/casting/history.jsoninstructions with whatsquad-cast-validator.mjsactually accepts, adds an Execute Mode fallback so the agent reads.github/skills/<name>/SKILL.mdfrom disk when the headless SDK session has not registered the skill tool, and adds a drift test that keeps the playbook example and the validator in lockstep. The package copy (workflows/package/squad.md) andworkflows/squad-workflows.manifest.jsondigests are regenerated.Why
Closes #2473
Every first
/squad caston a fresh gh-aw install failed. Step 3 item 5 of the Cast playbook told the agent to writehistory.jsonwithassigned_atandagent_countand an emptyassignment_cast_snapshots. The deterministic validator rejects that shape: it requiresused_at, a non-empty snapshot map with acast-revision-1entry stamped withregistry.generated_at, and notransaction_id/registry_revisionleftovers. The validator then reporteduniverse usage history is malformed, treated the specialist set as empty, and cascaded into 20+ false-positivespecialists=0errors. Separately, undercopilot-sdk: truetheskill("squad-cast")call returnedSkill not foundand the agent halted withreport_incompleteinstead of reading the installed SKILL.md.How
workflows/squad.md(## skill: squad-cast, Step 3 item 5): replaced the broken one-liner with the schema rules and a concrete fresh-Cast example wrapped inSQUAD:CAST-HISTORY-EXAMPLEmarkers, plus a one-line note for re-Casts (appendcast-revision-N).workflows/squad.md(## Execute Mode): added a short skill-discovery fallback (read.github/skills/<name>/SKILL.mdwith bash; do notreport_incompletejust because the skill tool is unregistered).test/gh-aw-cast-validator.test.ts: new test extracts the literal example from the playbook, asserts the package copy carries the identical example, pairs it with a matching revision-1 registry, and runs it throughvalidateCastingPairFilesand the fullsquad-cast-validator.mjstree validator, expecting zero errors.npm run gh-aw:integrity:writeregeneratedworkflows/package/squad.mdand the manifest digests (this runsgh aw compile --strictinternally).createSessionlives in the gh-aw SDK driver, not in this repo, soskillDirectoriescannot be wired here; the prompt-level fallback is the in-repo fix.packages/*/src,packages/*/templates,.squad-templates/, ortemplates/paths changedPR Readiness Checklist
Branch & Commit
dev(notmain)dev(git fetch upstream && git rebase upstream/dev)git diff --cached --stat)Build & Test
npm run gh-aw:integrity:check— passed ("Squad gh-aw package manifest and digests are current")npx vitest run test/gh-aw-cast-validator.test.ts --testTimeout=60000 -t "fresh-Cast history.json example|canonical legacy genesis"— 20 passed (the default 5s timeout is too tight for the spawn-heavy validator tests on this Windows box; the same existing tests also exceed it unchanged)npx vitest run test/gh-aw-quality.test.ts --testTimeout=120000— 376 passed, 7 failed. All 7 failures are tests that shell out togh awdirectly; the test profile guard redirectsLOCALAPPDATA, which hides the gh extension on Windows, so they cannot compile locally. They are unrelated to this change (strict compile of all 8 workflows passed via the integrity write). Relying on CI for those.npm run build— not run (local CFS/npm proxy lackshono@4.13.17; dependencies were borrowed from a sibling worktree). No TypeScript source changed.npm test(full) — not run locally for the same reason; relying on CI.npm run lint/npm run lint:eslint— not run locally; only a test file was added, following existing patterns in the same file.Changeset
skip-changeloglabel applied (if no user-facing changes) — N/A: no gated paths changed, gate reports "Not applicable"Docs
workflows/squad.mdis the user-facing instruction and is updated hereExports
Breaking Changes
None.
Waivers
None.