Fix wrapped gallery classification responses - #94
Jay Gordon (jaydestro) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
JSON extraction mishandles wrappers containing braces, and the new failure behavior lacks a behavioral test.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Improves gallery audit reliability when Copilot returns wrapped classification JSON.
Changes:
- Extracts JSON from wrapped responses.
- Fails audits after repeated classification failures.
- Adds regression and workflow checks.
| File | Description |
|---|---|
scripts/gallery-audit/copilot.mjs |
Adds wrapped-object extraction. |
scripts/gallery-audit/index.mjs |
Fails incomplete classifications explicitly. |
scripts/gallery-audit/test/audit.test.mjs |
Tests wrapped responses. |
scripts/gallery-audit/test/configuration.test.mjs |
Checks failure-path configuration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const start = stripped.indexOf('{'); | ||
| const end = stripped.lastIndexOf('}'); | ||
| if (start === -1 || end < start) return stripped; | ||
| return stripped.slice(start, end + 1); |
| assert.match(audit, /r\.additions\?\.length[\s\S]*r\.updates\?\.length[\s\S]*r\.retirements\?\.length/); | ||
| assert.match(audit, /steps\.actionable\.outputs\.available == 'true'/); | ||
| assert.doesNotMatch(audit, /contents: write|issues: write|git push|gh issue create/); | ||
| assert.match(read('scripts/gallery-audit/index.mjs'), /Copilot classification incomplete after/); |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Live failed-run replay completedBefore requesting review, I replayed the exact artifacts from failed audit run Results:
The replay also changed Copilot prompt delivery from a command-line argument to documented piped stdin, avoiding Windows command-line limits while retaining the same agent and restrictions on Linux Actions. |
Full end-to-end staging test passedTested the complete operator flow in
The publisher's first staging attempt failed only because Issues were disabled on the fork. After enabling the repository feature, rerunning the unchanged publisher succeeded. Issues are already enabled in |

Summary
Root cause
Run 36613869585 discovered 31 candidates, but Copilot classification failed twice with
Unexpected character "'" at position 1. That setrun-metadata.completetofalseand omittedpromotion-result.json. The actionable gate therefore uploaded no proposal artifact, causing downstream run 36614297302 to skipPublish proposal issue.Validation
npm run test:gallery-audit(67 tests passed)npm run buildgit diff --check