Skip to content

Unify engine harness policies and isolate per-attempt safe outputs - #79546

Merged
pelikhan merged 3 commits into
mainfrom
copilot/actionssetupjs-harness
Nov 20, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/actionssetupjs-harness

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Claude, Codex, and Copilot duplicated operational policies around their shared retry loop. This refactor consolidates those policies and prevents stale Copilot output from arming a watchdog or masking a later failure.

Shared operational logic

  • Centralize safe-output observation, Retry-After limits, and fresh invocation-budget evidence.
  • Normalize runtime-guard exits before the retry loop accepts success.

Attempt isolation

  • Capture a byte offset before each invocation; watchdogs and late-exit checks inspect only newly appended terminal output.
  • Reject invalid offsets rather than falling back to a whole-file scan.
const offset = getSafeOutputsByteOffset(safeOutputsPath);
// Run the engine attempt.
hasAttemptTerminalSafeOutput(safeOutputsPath, offset);

Preserved engine boundaries

  • Keep native error classification, authentication vetoes, and resume/restart decisions engine-specific.
  • Retain whole-run output checks for budget enforcement and replay protection.

@pelikhan pelikhan changed the title Share engine harness operational policies and scope late-exit output to attempts Unify engine harness policies and isolate per-attempt safe outputs Nov 20, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 20, 2026 15:57
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 15:57
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #79546 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Matt Pocock Skills Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #79546 · codex · routed: gpt61 medium · ~7 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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 analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this change does: It shares retry and safe-output policies across the engine harnesses and scopes terminal output to each attempt.

Should fix

  1. Inline the late-exit decision in each engine; the shared observation helper already covers the common work.

Verdict: fix 1 first.
Lean: -25 lines possible.

Generated by ✂️ Ponytail Reviewer for #79546 · codex · routed: gpt61 medium · ~7 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changed harness retry, safe-output scoping, and associated tests. I found no actionable correctness or regression issues in the changed lines. Review was static; tests were not run per review constraints.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-dd67c161-1875-47c9-989a-9bbfa6d226dd","parents":[],"payload":{"id":"ldg-e91bd12f-22f6-4adc-a0df-6166afa989ee","operation":"append","value":{"finding_count":0,"head_sha":"9449414f442c6877e05c792f791e85510341cf76","outcome":"no_findings"}},"sha":"sha256:2bd370442774042b7bcf92a738d95d2e7f020b45bdd2c34ce18ea228b4ef954d","timestamp":"2026-11-20T16:06:20.737Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-eed97b9a-8bf7-4275-86e5-6aeed85b5d3c","parents":[],"payload":{"id":"ldg-87dbf092-d584-482b-acc1-04eccda58b47","operation":"append","value":{"finding_count":0,"head_sha":"9449414f442c6877e05c792f791e85510341cf76","outcome":"aligned"}},"sha":"sha256:a7abe51f4c0cdd94046200bbbaef64551236c80f970b3eddcca36996304e54eb","timestamp":"2026-11-20T16:07:04.039Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review

Applied /diagnosing-bugs, /tdd and /codebase-design to the attempt-isolation and retry refactor. No blocking issues. Four targeted follow-ups are posted inline.

Key themes and highlights

Key themes

  • Retry-After on the last attempt: resolveRetryAfterDecision still logs a retry and sets rate_limit_error in the Copilot exhausted-retry branch, where no retry happens.
  • Silent offset behavior change: the Codex safeOutputsByteOffset guard was dropped without a test.
  • Hygiene: a lazy inline require in Codex, and a test temp directory created under process.cwd().

Positive highlights

  • Attempt-scoped safe-output observation is centralised in harness_safe_outputs.cjs and shared across Claude, Codex and Copilot.
  • Runtime-guard exit normalisation moved into the shared runner, so every engine sees it.
  • Strict offset handling for Claude is preserved and covered by a new test.

Open question (not inline)

The Copilot and Codex whole-run hasTerminalSafeOutput checks (copilot_harness.cjs around L2427 and L2440, codex_harness.cjs around L1335) are unchanged context. They still scan the whole file, so an earlier attempt output can suppress a verdict. If that is intended for budget and replay protection, a one-line comment would help future readers.

@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 · ⊞ 6.6K
Comment /matt to run again

Comment thread actions/setup/js/copilot_harness.cjs Resolved
Comment thread actions/setup/js/codex_harness.cjs Resolved
Comment thread actions/setup/js/codex_harness.cjs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Inspection-error handling can mistake stale terminal output for new activity, while retry logic can replay completed work after output has already been staged.

2 open issues
What changed in this PR

This refactor consolidates shared retry policies across the Claude, Codex, and Copilot harnesses while preserving engine-specific failure handling. It also isolates terminal safe-output observation by attempt so earlier output does not mask later failures.

Changes:

  • Share safe-output helpers, invocation-budget evidence, and Retry-After enforcement.
  • Scope Copilot watchdog and late-exit checks to each attempt; centralize runtime-guard exit normalization.
  • Add regression coverage and document shared harness responsibilities.
File Description
actions/​setup/​README.md Documents shared policies and attempt isolation.
actions/​setup/​js/​harness_safe_outputs.test.cjs Tests offsets, stale output, and inspection errors.
actions/​setup/​js/​harness_safe_outputs.cjs Adds shared attempt-scoped output helpers.
actions/​setup/​js/​harness_retry_runner.test.cjs Tests guard-exit normalization and cancellation precedence.
actions/​setup/​js/​harness_retry_runner.cjs Centralizes guard normalization and Retry-After decisions.
actions/​setup/​js/​harness_retry_guard.test.cjs Tests fresh budget evidence and wait limits.
actions/​setup/​js/​harness_retry_guard.cjs Adds shared budget-observation and wait-policy helpers.
actions/​setup/​js/​copilot_harness.test.cjs Covers per-attempt watchdog and late-exit behavior in both modes.
actions/​setup/​js/​copilot_harness.cjs Captures attempt offsets and adopts shared policies.
actions/​setup/​js/​codex_harness.cjs Uses shared helpers for output observation and budget checks.
actions/​setup/​js/​claude_runtime.cjs Delegates strict offset inspection to the shared helper.
actions/​setup/​js/​claude_harness.cjs Adopts shared output and budget helpers.

Review effort: Max (adaptive)

Comment thread actions/setup/js/copilot_harness.cjs Resolved
@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot run pr-finisher skill

Copilot AI commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@copilot run pr-finisher skill

PR finisher checked the PR: it is open and mergeable, but seven review threads remain unresolved. The later CJS run passed all eight test shards at the current HEAD; I made no changes because the supplied instructions restrict action on earlier comments. Local validation was not run.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/harness_safe_outputs.cjs:44): address unresolved feedback - Review comment
  3. Review (actions/setup/js/copilot_harness.cjs:2570): address unresolved feedback - Review comment
  4. Review (actions/setup/js/codex_harness.cjs:909): address unresolved feedback - Review comment
  5. Review (actions/setup/js/codex_harness.cjs:266): address unresolved feedback - Review comment
  6. Review (actions/setup/js/harness_safe_outputs.test.cjs:18): address unresolved feedback - Review comment
  7. Review (actions/setup/js/copilot_harness.cjs:2387): address unresolved feedback - Review comment
  8. Review (actions/setup/js/harness_safe_outputs.cjs:20): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "9449414f442c6877e05c792f791e85510341cf76",
  "kind": "requested",
  "schema_version": "1",
  "state": "eafcafb52a25089324eaa8f9487afcdd914c7367ea026c49f8ee366753cd93bc",
  "work": [
    "0ed19534253f409160dae3b51bb1163ac89b3d30e7da8895373fe7c7228e930a",
    "121f2c7a925fc9b5e8c981afeccde9568d837fda42b5aeee64b94799e19ff137",
    "2a041bd068f96224d209666fbba57cb5649f3563372e7b7285286027cc5b52b8",
    "55c494f7d699642446d046d36867ec738e292db53b295589c39e05c0fcf53007",
    "6242b081708c4e35933107722704030be38dca7f40dedc5436227a0bfd0a71ff",
    "6bdcf9c1b061541cf9bf74c12d57fe512b5d6c48f0ff2d3df26b8de303c05f35",
    "b22c5607b88912405ae23a020496e6894e4599e4a8c0d01571306cab7d187fe7"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

Copilot AI commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged main in 32e173d and addressed the seven linked reviews in 0bc0f42. Targeted suites and the final validation gate passed; CodeQL timed out. The full workflow recompile was interrupted after stalling during registry validation; no generated workflow changes were retained. No CI was triggered.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-js-tests (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "0bc0f422fb0b4fbab75c0e156e6c20b93d6052f2",
  "kind": "requested",
  "schema_version": "1",
  "state": "76ef8913c42e3687ff33beb0bca6e13732f43ca651a53367bc942083a23f7793",
  "work": [
    "7fdcb480e7a98cc7e0f466a49ad1c7f7e8c5cfc22f8fbcc711724ed335220761"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 high · ~1 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

@pelikhan
pelikhan merged commit 21049e5 into main Nov 20, 2026
100 of 102 checks passed
@pelikhan
pelikhan deleted the copilot/actionssetupjs-harness branch November 20, 2026 17:34
Copilot stopped work on behalf of gh-aw-bot due to an error November 20, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants