Skip to content

Prevent Claude tool results from triggering failure classifiers - #60349

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-authentication-failure-classifiers
Sep 12, 2026
Merged

Prevent Claude tool results from triggering failure classifiers#60349
pelikhan merged 3 commits into
mainfrom
copilot/fix-authentication-failure-classifiers

Conversation

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Claude stream-JSON includes tool results as user events, allowing benign repository content such as “not logged in” or EACCES to suppress retries or misreport failures.

  • Scope failure classification

    • Exclude stream-JSON user events from auth, rate-limit, overload, permission-denied, and harness-guard classifiers.
    • Preserve result, system, assistant, malformed JSON, and plain-text output.
    • Continue using full output for session-progress and denied-command extraction.
  • Prioritize process termination

    • Handle signal exits before authentication and permission-denied terminal rules.
    • Retry signal-terminated attempts as fresh runs with --continue disabled.
  • Cover regressions

    • Verify tool-result text is excluded while result/plain-text errors remain classifiable.
    • Verify repeated permission errors in tool results are ignored.
    • Verify exit 143 retries even when classifiable authentication text is present.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix classifiers for authentication failure in Claude harness Prevent Claude tool results from triggering failure classifiers Sep 11, 2026
Copilot AI requested a review from pelikhan September 11, 2026 23:53
@pelikhan
pelikhan marked this pull request as ready for review September 12, 2026 00:22
Copilot AI balanced review requested due to automatic review settings September 12, 2026 00:22

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.

🟢 Approval recommended

The implementation matches the stated classifier scope and retry behavior with focused regression coverage.

Pull request overview

Scopes Claude failure classification to trusted output while ensuring signal exits retry as fresh runs.

Changes:

  • Excludes stream-JSON user events from failure classifiers.
  • Prioritizes signal-termination retries over authentication and permission rules.
  • Adds regression coverage for tool results and exit code 143.
File summaries
File Description
actions/setup/js/claude_harness.cjs Filters classifier input and reorders signal handling.
actions/setup/js/claude_harness.test.cjs Tests filtering and fresh signal retries.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Design Decision Gate 🏗️. Review the logs for details.

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

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by Ponytail Reviewer for #60349

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

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

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

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

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@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 /tdd and /diagnosing-bugs — this is a well-scoped fix (excluding stream-JSON user/tool-result events from failure classifiers, and prioritizing signal/crash-exit handling) with solid targeted regression tests. Two observations below, neither blocking.

📋 Key Themes & Highlights

Key Themes

  • Reordering coverage gap: moving the signal/crash-exit check ahead of auth, invalid-model, and permission-denied terminal checks is tested for the auth interaction only; the invalid-model and permission-denied interactions aren't pinned down by a test.
  • Intentional asymmetry: extractDeniedCommands deliberately still reads raw result.output per the PR description, while the triggering hasNumerousPermissionDenied check now uses classifiableOutput. This is a reasonable, documented choice, but worth a quick look since the extracted commands feed a missing_tool issue payload.

Positive Highlights

  • classifiableOutput is small, well-commented, and defensively handles malformed JSON lines.
  • ✅ Good regression tests added for the exact bug scenario (tool-result text like "not logged in"/EACCES leaking into classifiers).
  • ✅ Clear PR description mapping scope, prioritization, and coverage — easy to review.

@copilot please address the review comments above.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 135.4 AIC · ⌖ 15 AIC · ⊞ 10.4K
Comment /matt to run again

Comments that could not be inline-anchored

actions/setup/js/claude_harness.cjs:585

[/tdd] The signal/crash-exit short-circuit was moved ahead of the auth, invalid-model, and permission-denied terminal checks, but only the auth-failure interaction is regression-tested (uses a fresh retry after signal-style termination even when output is classified as an auth failure). The reordering changes real control flow for other classifiers too.

<details>
<summary>💡 Suggested regression tests</summary>

Add cases mirroring the existing auth test but for:

  • `isInvalidModel === tr…
actions/setup/js/claude_harness.cjs:610

[/diagnosing-bugs] extractDeniedCommands still scans raw result.output (including untrusted tool-result content) even though the trigger condition hasNumerousPermissionDenied now uses classifiableOutput. The PR description calls this out as intentional ("continue using full output for...denied-command extraction"), and it's control-flow-safe since the retry/stop decision itself is driven by the filtered count. But the extracted denied_commands list feeds directly into the `missing…

@pelikhan
pelikhan merged commit 1893fe9 into main Sep 12, 2026
10 checks passed
@pelikhan
pelikhan deleted the copilot/fix-authentication-failure-classifiers branch September 12, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude harness: failure classifiers match text inside tool results, so a run that read a document saying "not logged in" is never retried

3 participants