Skip to content

Rescue completed watchdog-fired Copilot runs from false authentication_failed classification - #49792

Merged
pelikhan merged 6 commits into
mainfrom
copilot/fix-authentication-failed-classification
Aug 2, 2026
Merged

Rescue completed watchdog-fired Copilot runs from false authentication_failed classification#49792
pelikhan merged 6 commits into
mainfrom
copilot/fix-authentication-failed-classification

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

copilot_harness.cjs could classify a completed run as authentication_failed when agent-emitted tool output contained benign auth text such as gh auth login. Because the post-result watchdog rescue did not cover that class, completed daily-experiment-report runs were discarded after the agent had already produced terminal safe-output.

  • Harness rescue path

    • Extend the existing post-result watchdog suppression in actions/setup/js/copilot_harness.cjs to also rescue authentication_failed when:
      • result.watchdogFired === true, and
      • terminal safe-output already exists.
    • This keeps genuine auth failures unchanged when they happen before any terminal safe-output is produced.
  • Regression coverage

    • Add a focused test in actions/setup/js/copilot_harness.test.cjs for the observed failure shape:
      • terminal safe-output is written,
      • output includes benign "not logged in" text from a tool payload,
      • the idle watchdog fires,
      • the harness exits successfully instead of retrying/failing.
  • Behavioral example

    if (
      (failureClass === "partial_execution" ||
        failureClass === "long_run_exit" ||
        (failureClass === "no_output" && result.watchdogFired) ||
        (failureClass === "authentication_failed" && result.watchdogFired)) &&
      safeOutputsPath &&
      hasTerminalSafeOutput(safeOutputsPath)
    ) {
      lastExitCode = 0;
    }

Run: https://github.com/github/gh-aw/actions/runs/30752949969

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.69 AIC · ⌖ 6.11 AIC · ⊞ 8.3K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.5 AIC · ⌖ 8.95 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix false authentication_failed classification in daily experiment report Rescue completed watchdog-fired Copilot runs from false authentication_failed classification Aug 2, 2026
Copilot AI requested a review from pelikhan August 2, 2026 13:59
@pelikhan
pelikhan marked this pull request as ready for review August 2, 2026 14:01
Copilot AI review requested due to automatic review settings August 2, 2026 14:01
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ PR Code Quality Reviewer failed during code quality review.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

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.

Pull request overview

Extends Copilot harness recovery to preserve completed runs falsely classified as authentication failures.

Changes:

  • Rescues watchdog-fired authentication_failed runs with terminal safe-output.
  • Adds end-to-end regression coverage for benign gh auth login output.
Show a summary per file
File Description
actions/setup/js/copilot_harness.cjs Expands post-result watchdog suppression.
actions/setup/js/copilot_harness.test.cjs Tests the false-authentication failure scenario.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@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.

The fix is minimal, correct, and well-tested.

  • The authentication_failed rescue is properly gated by both result.watchdogFired === true and hasTerminalSafeOutput(safeOutputsPath), so genuine auth failures that occur before any terminal safe-output is produced remain classified as failures — no regression risk.
  • The regression test faithfully reproduces the observed failure shape (benign auth text in tool output, watchdog fires, callCount === 1 verifies no retry, exit 0).

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 16.6 AIC · ⌖ 10.3 AIC · ⊞ 5.4K

@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 and /tdd — two minor suggestions, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Readability: The rescue if condition is now long enough to deserve a named intermediate variable (isExpectedLateExit) — easier to audit and extend safely.
  • Test coverage gap: The new test proves the rescue works, but there's no negative case confirming that a genuine auth failure (no terminal safe-output) still propagates correctly.

Positive Highlights

  • ✅ Minimal, targeted fix — exactly one new clause added to the existing rescue logic
  • ✅ Rescue is correctly gated on both watchdogFired AND hasTerminalSafeOutput, so real auth failures are unaffected
  • ✅ Regression test faithfully reproduces the observed failure shape (benign auth text in tool payload + watchdog + terminal safe-output)
  • ✅ PR description includes a clear behavioral example

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 31.6 AIC · ⌖ 8.03 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread actions/setup/js/copilot_harness.cjs Outdated
// output before the watchdog terminated the idle process.
if ((failureClass === "partial_execution" || failureClass === "long_run_exit" || (failureClass === "no_output" && result.watchdogFired)) && safeOutputsPath && hasTerminalSafeOutput(safeOutputsPath)) {
if (
(failureClass === "partial_execution" || failureClass === "long_run_exit" || (failureClass === "no_output" && result.watchdogFired) || (failureClass === "authentication_failed" && result.watchdogFired)) &&

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.

[/diagnosing-bugs] The rescue condition is growing long; extracting each clause to a named boolean would make the intent self-documenting and guard against future mis-reads.

💡 Suggested refactor
const isExpectedLateExit =
  failureClass === "partial_execution" ||
  failureClass === "long_run_exit" ||
  (failureClass === "no_output" && result.watchdogFired) ||
  (failureClass === "authentication_failed" && result.watchdogFired);

if (isExpectedLateExit && safeOutputsPath && hasTerminalSafeOutput(safeOutputsPath)) {

This keeps the rescue logic readable and makes it easy to add new cases without scanning one very long line.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Extracted the condition into isExpectedLateExit as suggested. The four-clause guard is now a named boolean, making it easy to read and extend.

GH_AW_HARNESS_WATCHDOG_TIMEOUT_MS: "100",
},
encoding: "utf8",
timeout: 15000,

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.

[/tdd] The test verifies the happy path well, but does not assert the negative case: that a genuine authentication_failed (no terminal safe-output yet) is not rescued. Without that guard, a future regression could silently swallow real auth failures.

💡 Suggested companion test

Add a sibling test where safeOutputsPath points to an empty file (no terminal safe-output entry), the watchdog fires, and the harness exits non-zero (or retries). The structure mirrors this test but omits the add_comment write to the safe-outputs file before the watchdog fires.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the negative test: "does not rescue authentication_failed when no terminal safe-output was produced before the watchdog fires". The stub emits "Error: No authentication information found." and exits 1 without writing any safe-output entry; the harness exits non-zero and the late-activity exit suppressed log line is absent.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 90/100 — Excellent

Analyzed 1 test(s): 1 design, 0 implementation, 0 violation(s).

📊 Metrics (1 test)
Metric Value
Analyzed 1 (Go: 0, JS: 1)
✅ Design 1 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (100%)
Duplicate clusters 0
Inflation Yes (8.4:1, acceptable for integration test)
🚨 Violations 0
Test File Classification Issues
exits 0 without retrying when watchdog fires after terminal safe-output was produced and output contains benign "not logged in" tool text actions/setup/js/copilot_harness.test.cjs:2624 Design test, high value None

Analysis

Test Summary:
This integration test validates that the harness correctly suppresses false authentication_failed classification when a watchdog fires after terminal safe-output was already produced. The test follows the established pattern from the preceding no_output test case, but adds coverage for the specific edge case where the agent's stdout contains auth-related tool output (e.g., "You are not logged into any GitHub hosts").

Why it matters:
The fix allows the harness to rescue watchdog-fired runs from being incorrectly classified as auth failures. By testing the exact scenario—safe-output written, then watchdog fires while agent outputs benign auth-like text—the test ensures that the new failureClass === "authentication_failed" && result.watchdogFired condition correctly handles this case.

Assertion quality: 4 distinct checks cover the essential guarantees: single attempt (no retries), correct exit code (0), and proper logging. All are direct behavioral assertions (exit code, process count, stderr messages).

Verdict

passed. 0% implementation tests (threshold: 30%). Design-first test with comprehensive edge-case coverage.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 18.1 AIC · ⌖ 4.82 AIC · ⊞ 8.5K ·
Comment /review 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.

✅ Test Quality Sentinel: 90/100. 0% implementation tests (threshold: 30%). Design-first test with comprehensive edge-case coverage.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the remaining PR follow-up and then run the pr-finisher skill.

Current signals to close:

  • Failed check from compact triage: agent.
  • Reviewer feedback is light and mostly non-blocking, but please confirm whether that failed agent run reflects any remaining actionable issue on the current head or if the PR is otherwise ready for maintainer investigation.
  • A branch refresh was requested for this PR; after any needed fixes or confirmations, proceed with the pr-finisher skill.

Please summarize whether any concrete code/test change is still needed versus this being ready for human review once checks settle.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.69 AIC · ⌖ 6.11 AIC · ⊞ 8.3K ·
Comment /souschef to run again

…h test, fix stale contract test

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot August 2, 2026 15:21
@pelikhan

pelikhan commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please continue triage on this PR, then run the pr-finisher skill.

Current signals:

  • maintainer asked you to fix the failing JS check: https://github.com/github/gh-aw/actions/runs/30754151275/job/91513576040?pr=49792
  • prior reviewer feedback looks non-blocking overall, with one suggested negative test still worth verifying
  • please confirm whether the current head still needs any concrete code/test change for that failing run, or whether this is otherwise ready for maintainer investigation after a branch refresh
  • branch refresh was requested for this PR

If the code is already correct on the current head, say that clearly in a short handoff and note any exact follow-up still needed.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.5 AIC · ⌖ 8.95 AIC · ⊞ 8.3K ·
Comment /souschef to run again

github-actions Bot and others added 2 commits August 2, 2026 15:50
…event test timeouts

Adds the same AWF_REFLECT_ENABLED guard used in copilot_harness.cjs around
both fetchAWFReflect calls in codex_harness.cjs. Without this guard, the
codex harness unconditionally makes a network request to api-proxy with a
60-second timeout. In CI environments where api-proxy is accessible but slow,
spawnSync tests with 10-second timeouts would be killed (returning null status)
rather than completing cleanly.

Also removes the unused AWF_REFLECT_TIMEOUT_MS dead import."

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/30754151275/job/91513576040?pr=49792

Fixed in the latest commit. The root cause was that codex_harness.cjs called fetchAWFReflect unconditionally with a 60-second default timeout. In CI environments where api-proxy is accessible but slow, spawnSync subprocess tests with 10-second timeouts were being killed before the harness could complete, returning null status instead of 1.

The fix adds the same AWF_REFLECT_ENABLED === "1" guard that copilot_harness.cjs already uses around both fetchAWFReflect calls (pre-flight and post-flight). The test now completes in ~74ms instead of potentially exceeding 10s. Also removed the unused AWF_REFLECT_TIMEOUT_MS dead import.

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please continue triage on this PR, then run the pr-finisher skill.

Current signals:...

The PR is ready for maintainer review. Here's the current state:

Failing JS check (run 30754151275) — fixed. Root cause: codex_harness.cjs called fetchAWFReflect unconditionally; in test environments the 60-second default timeout caused spawnSync with a 10s limit to kill the process, returning status: null instead of 1. Fix: gate both fetchAWFReflect calls on AWF_REFLECT_ENABLED === "1" (same guard copilot_harness.cjs already used). All 102 codex_harness.test.cjs tests now pass locally.

Review threads — both substantively answered by Copilot:

  • Thread on copilot_harness.cjs (outdated): isExpectedLateExit extracted at line 1275 as suggested.
  • Thread on copilot_harness.test.cjs: Negative test added at line 2666 — genuine auth failure with no terminal safe-output exits non-zero.

Branch is merged from main (no conflicts, mergeable_state: unstable reflects stale CI).

Hand-off: A maintainer needs to re-trigger CI (close/reopen or push) to get a fresh green run before merge. No further code changes are needed.

@pelikhan
pelikhan merged commit fe1ccb6 into main Aug 2, 2026
38 checks passed
@pelikhan
pelikhan deleted the copilot/fix-authentication-failed-classification branch August 2, 2026 16:30
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants