fix(gh-aw): scan the first non-empty line in PC-0, not record 1 (#1835) - #1841
Conversation
Closes #1835 PC-0 normalized the dispatched command with an awk program gated on NR==1, so a value whose first character is a newline put an EMPTY string on the scanned record: PC0($'\nimplement') returned EMPTY_DISPATCH. That routes to the activation guard, which halts with a ::warning:: and no comment by design (PR #1777, junk issues #12/#14) -- so a structurally valid implement dispatch would halt silently instead of running. Silent loss of a valid command is the same defect class #1824 and #1832 exist to close. Scan the first non-empty line instead: skip blank records, take the first one carrying content, and fall through to EMPTY_DISPATCH via END only when every record was empty or whitespace-only. Genuinely empty input still reaches the silent activation-guard halt, so #1777 stays closed. The one-liner is written without inter-statement spaces deliberately. workflows/squad.md sits ~37 bytes above the 5 KB floor of the 100 KB prompt budget asserted by gh-aw-quality's "reports combined bytes and headroom", so the readable spacing and an explanatory paragraph both overran the gate. The behavior is documented in the tests instead. That headroom is now ~65 bytes and is a blocker for the next change to this file; it needs its own issue. Tests: 27 -> 36 in gh-aw-command-parse. Reverting the awk to NR==1 turns four of the new cases red, and each failure message names the offending input, so a truncating parser cannot pass them. The whitespace-only cases ('', ' ', '\n', '\n\n', ' \n \t \n ') pin EMPTY_DISPATCH so the fix cannot overshoot, and the load-bearing PC-1 cases are untouched -- a bare token still fails on the comment path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🛫 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 | No Copilot review threads |
| ✅ | CI passing | All checks passing |
Files Changed (2 files, +45 −2)
| File | +/− |
|---|---|
test/gh-aw-command-parse.test.ts |
+43 −0 |
workflows/squad.md |
+2 −2 |
Total: +45 −2
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟡 Impact Analysis — PR #1841Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to PC-0 normalization, matches the stated acceptance criteria, and is backed by targeted behavioral tests covering both the regression and non-regression cases.
Pull request overview
This PR fixes a parsing edge case in the gh-aw workflow command normalization step (PC-0) where a dispatched command value beginning with a newline was incorrectly treated as empty, causing a silent EMPTY_DISPATCH halt instead of running a valid command.
Changes:
- Update PC-0’s
awknormalization to scan the first non-empty trimmed line (rather thanNR==1). - Add behavioral tests to ensure leading blank lines are skipped while whitespace-only inputs still yield
EMPTY_DISPATCH.
File summaries
| File | Description |
|---|---|
| workflows/squad.md | Adjusts PC-0 normalization logic to skip leading blank/whitespace-only records and only emit EMPTY_DISPATCH when all records are empty. |
| test/gh-aw-command-parse.test.ts | Adds coverage for leading-newline dispatch inputs and guards against overshooting (whitespace-only inputs remain EMPTY_DISPATCH). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Closes #1835
What
PC-0 normalized the dispatched command with an
awkprogram gated onNR==1. A value whose first character is a newline puts an empty string on that record, so:EMPTY_DISPATCHroutes to the activation guard, which halts with a::warning::and no comment by design (PR #1777, junk issues #12/#14). A structurally validimplementdispatch therefore halted silently instead of running — the same silent-loss-of-a-valid-command class that #1824 and #1832 exist to close.Fix
Scan the first non-empty line rather than record 1: skip blank records, take the first one carrying content, and fall through to
EMPTY_DISPATCHviaENDonly when every record was empty or whitespace-only. Genuinely empty input still reaches the silent activation-guard halt, so #1777 stays closed.PC-1 is untouched. The asymmetry is deliberate — on the comment path a missing
/squadtoken is the error condition, and loosening it would reopen #1824.Acceptance (from the issue)
PC0($'\nimplement')yields/squad implementPC0('')andPC0(' ')still yieldEMPTY_DISPATCHMutation proof
Reverting the
awktoNR==1turns four new cases red, each naming the offending input:A status-only assertion would pass a truncating parser; these name the input, per the standing bar. Whitespace-only cases (
'',' ','\n','\n\n',' \n \t \n ') pinEMPTY_DISPATCHso the fix cannot overshoot.Tests: 27 → 36 in
gh-aw-command-parse.gh-aw-qualitystays green.The
awkone-liner is written without inter-statement spaces deliberately, and the explanatory paragraph I first wrote was removed. Both overrangh-aw-quality'sreports combined bytes and headroomgate.workflows/squad.mdondevsits ~37 bytes above the 5 KB floor of the 100 KB prompt ceiling. This PR leaves ~65 bytes. Readable spacing in that one line cost ~18 bytes; a five-line prose note cost ~430.The next change to
workflows/squad.mdwill fail CI on byte count regardless of its merit. That needs its own issue — I did not file one as part of this PR.Scope
workflows/squad.md+test/gh-aw-command-parse.test.ts. Nopackages/*/src/changes, so no changeset required.