Repository navigation
Commit dc671a7
fix(gh-aw): relay normalized squad commands through dispatch (#2136)
* fix(gh-aw): relay normalized squad commands through dispatch
Fixes three command-routing defects reported against source SHA
261d140
(octodemo/zava-social-backend-20261001184422#1):
1. The lifecycle-repair fallback in the shared squad.md coordinator only
recognized exact, /squad-prefixed issue-comment bodies. A command
normalized and relayed by squad-command-router.md via workflow_dispatch
(e.g. the bare "activate" dispatch input for a /squad activate comment)
skipped repair entirely. Repair gating and the effective command are now
derived identically for both the issue_comment and workflow_dispatch
event paths (CANONICAL_BY_BARE_COMMAND normalization).
2. squad-command-router.md omitted `roles: all`, so gh-aw's default
write-role activation gate blocked the router from running at all for
non-write actors -- including modes the router intentionally allows
anyone to invoke. Added `roles: all`; the router's own in-script,
per-command authorization for mutating modes is unchanged.
3. The router's relayed dispatch dropped originating comment provenance, so
an embedded /squad approve-improvement could never supply a real
approval_comment_id and was rejected outright. The router now forwards
an aw_context pointer (item type/number + originating comment id)
through the dispatch, and squad-improvement-gate.mjs's
validateApprovalDispatchRelay re-fetches and validates that live comment,
binding permission to its own author -- never the dispatch actor -- so
approval binding is not weakened.
Package/lock/manifest regenerated via the standard
`node workflows/shared/squad-install-verifier.mjs --write-source` pipeline;
strict `gh aw compile --strict` passes with only the two documented
warnings. Added test/gh-aw-command-router-relay.test.ts (true end-to-end
router -> repair-job relay via real extracted step scripts, plus a
normalization mutation-kill test), and extended
test/gh-aw-command-parse.test.ts / test/gh-aw-improvement-worker.test.ts
with regression coverage for all three findings.
Local npm install is broken in this environment (missing transitive deps
such as fdir), so vitest/eslint cannot run locally; every new/changed
assertion was independently verified by direct Node/vm execution of the
real production modules and scripts, and by compiled-lock diffing. Hosted
CI at the PR head is the authoritative suite result.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix(gh-aw): update compiled-digest golden hashes for relay fix
The roles: all / aw_context changes to squad.md and
squad-command-router.md legitimately alter the compiled squad.lock.yml
content. Update the three hardcoded golden SHA-256 digests in
test/gh-aw-quality.test.ts's canonical package integrity contract
suite to match, following the same pattern as commit b545508.
Independently recomputed via direct execution of the real
compileWithPinnedActions/normalizeCompiledLock helpers (node
--experimental-strip-types, bypassing the broken local vitest
install) and confirmed to match hosted CI's reported values exactly.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix(gh-aw): forward real item identity across the squad.md -> squad-improvement-worker relay hop
Fixes a downstream defect in the command-routing relay chain (flagged by
copilot-pull-request-reviewer[bot] against PR #2136, which fixed the three
originally-scoped findings from source SHA
261d140,
octodemo/zava-social-backend-20261001184422#1).
Root cause: gh-aw's own dispatch_workflow safe-output engine
unconditionally overwrites any agent-supplied aw_context input with its
own buildAwContext() whenever a dispatch's target workflow declares an
aw_context workflow_dispatch input. buildAwContext() derives
item_type/item_number/comment_id solely from the CURRENT run's own event
payload -- never inherited across a hop. When a relayed (workflow_dispatch
-triggered) squad.md run dispatches to squad-improvement-worker via the
squad-approve-improvement skill, that dispatch goes through gh-aw's real
dispatch_workflow handler, so the engine always overwrites squad.md's
aw_context with its own context -- which, because squad.md's own run is a
workflow_dispatch event with no issue/comment payload, always carries empty
item_type/item_number/comment_id. collectImprovementContext's existing
strict exact-match check (correct for the native direct-comment path, where
the engine's own context genuinely is accurate) therefore always rejected
every relayed /squad approve-improvement, independent of any event_type
widening.
Fix (no gh-aw change; pure squad.md-side plumbing):
- squad-improvement-worker.md: declare a new, non-colliding
squad_approval_relay workflow_dispatch input (distinct name from
aw_context, so gh-aw's engine never auto-overwrites it) and wire a
parallel SQUAD_IMPROVE_RELAY_CONTEXT env var at both existing call sites.
- squad.md: the squad-approve-improvement skill now always forwards
squad_approval_relay: {event_type, item_type, item_number, comment_id}
alongside the existing issue_number/approval_comment_id inputs, reusing
the same already-resolved values.
- squad-improvement-gate.mjs: collectImprovementContext keeps the
unconditional repo/workflow_id provenance check against the engine's own
(always-accurate) context, then branches: native path (event_type ===
issue_comment) validates item identity against the engine context
unchanged; relayed path (any other event_type) validates with identical
exact-match strictness against the new SQUAD_IMPROVE_RELAY_CONTEXT
instead. No approval-binding check is weakened on either path; all
unconditional live re-verification (comment/permission/revocation/
revision/linked-PR checks) is untouched.
Regenerated workflows/package/*.md and workflows/squad-workflows.manifest.json
via `node workflows/shared/squad-install-verifier.mjs --write-source`.
Tests (test/gh-aw-improvement-worker.test.ts):
- Extends the skill-JSON-shape assertion for the new relay field.
- New describe block covering: relayed-path authorization success, repo/
workflow_id forgery still rejected, mutation-kill coverage (tampered
comment_id/item_number/item_type/event_type each independently rejected),
malformed/missing relay context rejected (no silent fallback to the
engine's empty item fields), native-path non-regression, source wiring
assertions, and a compiled-artifact assertion (gh aw compile --strict)
proving both the worker's lock.yml declares/wires the new input and
squad.lock.yml's compiled dispatch step actually emits
squad_approval_relay.
Verified locally: standalone Node execution of collectImprovementContext's
new branch logic (native path, relayed success, 4 mutation-kill cases, 3
malformed/missing-context cases, repo/workflow_id forgery); gh aw compile
--strict across all 8 installed workflows produces exactly the two
documented warnings (Compiled 8 workflows: 8 succeeded, 2 warnings);
per-workflow strict compiles of squad and squad-improvement-worker confirm
the new input/env/dispatch-field wiring in the generated lock.yml files.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* test(gh-aw): update stale compiled-lock golden digests after relay-context fix
Updating workflows/squad.md's squad-approve-improvement dispatch payload
(and squad-improvement-worker.md's new input/env wiring) changes the
compiled squad.lock.yml / squad-improvement-worker.lock.yml content, which
shifts the normalized SHA-256 digests asserted by the canonical package
integrity contract tests in test/gh-aw-quality.test.ts (tamper-mutation
fixtures recomputed over the new baseline compiled output).
Re-derived both digest pairs from the actual compiled output (workflow and
package source bindings) and updated the three assertions that pinned the
stale values. No test logic changed; this is a golden-value refresh
consistent with the same pattern applied for the three originally-scoped
fixes earlier in this PR.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 3ee53b2 commit dc671a7
17 files changed
Lines changed: 916 additions & 162 deletions
File tree
- .changeset
- test
- workflows
- package
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
206 | 216 | | |
207 | 217 | | |
208 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
0 commit comments