Repository navigation
Deduplicate JavaScript harness prompt and permission handling - #75733
Conversation
…ests Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
| log(`attempt ${attempt + 1}: detected numerous permission-denied issues but safe-outputs already contain expected output — suppressing terminal verdict (false-red: core work succeeded)`); | ||
| return { action: "stop", exitCode: 0 }; | ||
| } | ||
| emitMissingToolPermissionIssue({ deniedCommands: deniedCommands ?? extractDeniedCommands(output), permissionOutput: output, logger: log }); |
There was a problem hiding this comment.
Static review completed for the changed harness refactor. I found no actionable correctness, regression, or maintainability issues in the changed lines. The specialist pass was unavailable because its file-read attempt was denied; this verdict is based on the independent diff and targeted source review.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd. The refactor is behaviour-preserving on the paths I checked, so this is a comment-only review with two follow-ups.
📋 Verification and key themes
Verified
- The shared prompt helper (
harness_prompt_input.cjs) keeps strict mode for Claude and legacy tolerance for Codex. I smoke-tested it: empty prompt, missing path, directory path, and repeated--prompt-file(last wins) all match the diff. - The Claude call site still passes
denials.commandsdirectly, as before. - The Codex
hasExpectedSafeOutputssuppression guard survives insidestopForPermissionDenied. - The payload builder does not leak raw output when the structured command list is empty.
Key themes
- Hidden text-parsing fallback: the
??inharness_failure_handling.cjsre-parses tool-result text for Copilot and Codex (inline comment). - Duplicate test coverage: the staged true/false matrix is repeated in three test files (inline comment).
- Dead import:
claude_harness.cjs:40still hasconst fs = require("fs"). Nothing in the file usesfs.after this refactor. The line is outside the diff hunks, so I could not comment on it inline. Please remove it. - Unverified: I did not run the vitest suites. Dependency install failed in this sandbox, so the test results are unconfirmed.
Lock file
enterprise-docs-audit.lock.yml appears in the PR head commit. It is generated output, so confirm it came from make recompile and was not hand-edited.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 5.4K
Comment /matt to run again
| log(`attempt ${attempt + 1}: detected numerous permission-denied issues but safe-outputs already contain expected output — suppressing terminal verdict (false-red: core work succeeded)`); | ||
| return { action: "stop", exitCode: 0 }; | ||
| } | ||
| emitMissingToolPermissionIssue({ deniedCommands: deniedCommands ?? extractDeniedCommands(output), permissionOutput: output, logger: log }); |
There was a problem hiding this comment.
[/codebase-design] The deniedCommands ?? extractDeniedCommands(output) fallback makes this helper parse raw tool-result text whenever a caller omits structured commands. Copilot and Codex still rely on that path. The old code did the same, so this is not a regression, but the trust boundary is now hidden in a shared helper. Make deniedCommands required and have Copilot and Codex call extractDeniedCommands(result.output) at their call sites, so the text parsing is visible where it happens.
💡 Suggested call-site change
return stopForPermissionDenied({ attempt, output: result.output, safeOutputsPath, log, deniedCommands: extractDeniedCommands(result.output) });The helper then always receives a command list, and the text fallback goes away.
@copilot please address this.
There was a problem hiding this comment.
Updated in 3c25702. The shared helper now requires deniedCommands, and Copilot and Codex call extractDeniedCommands(result.output) explicitly at their call sites.
| } | ||
|
|
||
| describe("claude_harness.cjs", () => { | ||
| it.each([false, true])("handles structured permission failures without replaying work (staged output: %s)", staged => { |
There was a problem hiding this comment.
[/tdd] This it.each repeats the staged true/false matrix that harness_failure_handling.test.cjs now covers directly. codex_harness.test.cjs:151 repeats it too. Keep the harness-level assertions that prove work is not replayed, and drop the duplicated staged-output checks.
💡 Why keep one harness test
The shared suite covers the verdict logic. Each harness test only needs to prove the harness calls the shared helper and does not replay work, so the extra copies add maintenance cost without new coverage.
@copilot please address this.
There was a problem hiding this comment.
Updated in 3c25702. The harness-level cases now verify terminal handling without replay; staged-output behavior remains covered directly in harness_failure_handling.test.cjs.
There was a problem hiding this comment.
🟡 Changes recommended
An explicit empty safeOutputsPath still allows the safeoutputs CLI to run via the environment fallback, leaving the completed-output check and diagnostic-emission gate inconsistent.
1 open issue
What changed in this PR
Deduplicates prompt loading and permission-failure handling in gh-aw’s JavaScript harnesses while preserving engine-specific retry, session, and prompt-delivery policies.
Changes:
- Share permission-failure handling across Copilot, Claude, and Codex, plus prompt-file resolution across Claude and Codex.
- Add regression coverage for prompt edge cases, diagnostic failures, and output preservation without retries.
- Point enterprise documentation threat detection at a dedicated input directory.
| File | Description |
|---|---|
actions/setup/js/harness_prompt_input.test.cjs |
Tests shared prompt parsing and engine delivery contracts. |
actions/setup/js/harness_prompt_input.cjs |
Extracts shared prompt-file resolution. |
actions/setup/js/harness_failure_handling.test.cjs |
Tests terminal permission handling and diagnostic emission. |
actions/setup/js/harness_failure_handling.cjs |
Extracts shared permission-failure handling. |
actions/setup/js/copilot_harness.cjs |
Delegates permission failures to the shared helper. |
actions/setup/js/codex_harness.test.cjs |
Adds no-retry and staged-output regression cases. |
actions/setup/js/codex_harness.cjs |
Uses shared helpers while retaining legacy prompt tolerance. |
actions/setup/js/claude_harness.test.cjs |
Adds structured-denial and staged-output regression cases. |
actions/setup/js/claude_harness.cjs |
Uses shared helpers while retaining structured denial commands. |
.github/workflows/enterprise-docs-audit.lock.yml |
Updates the threat-detection input directory. |
Review effort: Max (auto)
| log(`attempt ${attempt + 1}: detected numerous permission-denied issues but safe-outputs already contain expected output — suppressing terminal verdict (false-red: core work succeeded)`); | ||
| return { action: "stop", exitCode: 0 }; | ||
| } | ||
| emitMissingToolPermissionIssue({ deniedCommands: deniedCommands ?? extractDeniedCommands(output), permissionOutput: output, logger: log }); |
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: de9b716
|
Starting the requested work: I’ll update this branch from Sous-chef requested-head: de9b716 |
…icated-logic Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
| log(`attempt ${attempt + 1}: detected numerous permission-denied issues but safe-outputs already contain expected output — suppressing terminal verdict (false-red: core work succeeded)`); | ||
| return { action: "stop", exitCode: 0 }; | ||
| } | ||
| emitMissingToolPermissionIssue({ deniedCommands, permissionOutput: output, logger: log }); |
|
🎉 This pull request is included in a new release. Release: |

Extract equivalent behavior from the engine harnesses without unifying their distinct retry and session policies.