Skip to content

Anchor Failure Investigator log capture to error markers - #52620

Merged
pelikhan merged 2 commits into
mainfrom
copilot/aw-failures-fix-log-capture
Aug 14, 2026
Merged

Anchor Failure Investigator log capture to error markers#52620
pelikhan merged 2 commits into
mainfrom
copilot/aw-failures-fix-log-capture

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Failure Investigator captured the absolute job-log tail, allowing post-failure cleanup to displace the actionable error. This updates excerpts to target the nearest diagnostic marker and identifies fallback captures that may be cleanup-only.

  • Marker-anchored excerpts

    • Retrieve full failed-job logs.
    • Capture up to 50 lines centered on the nearest ##[error], error, panic, or exception marker.
    • Retain the final-50-lines behavior only when no marker exists.
    marker_index = next(
        (i for i in range(len(lines) - 1, -1, -1) if ERROR_MARKER.search(lines[i])),
        None,
    )
  • Capture-confidence signal

    • Add capture_likely_missed_fault to each prefetched log entry when the fallback tail contains no diagnostic marker.
    • Prevent classifiers from treating flagged cleanup output as a failure signature.
  • Evidence escalation

    • Require audit-based evidence extraction when a cluster includes a flagged capture, even if its excerpt is otherwise long enough.
  • Regression coverage

    • Assert the workflow retains marker-window capture and does not revert to --log-failed absolute-tail behavior.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix log-capture to anchor to failing step instead of job tail Anchor Failure Investigator log capture to error markers Aug 14, 2026
Copilot AI requested a review from pelikhan August 14, 2026 04:11
@pelikhan
pelikhan marked this pull request as ready for review August 14, 2026 05:53
Copilot AI balanced review requested due to automatic review settings August 14, 2026 05:53
@pelikhan
pelikhan merged commit 69df0ed into main Aug 14, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/aw-failures-fix-log-capture branch August 14, 2026 05:54

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

Anchors Failure Investigator excerpts to diagnostic markers and flags unreliable fallback captures.

Changes:

  • Captures 50-line marker-centered log windows.
  • Escalates flagged captures to audit evidence.
  • Adds workflow contract checks and recompiles the lock file.
Show a summary per file
File Description
.github/workflows/aw-failure-investigator.md Implements marker-based capture and evidence handling.
.github/workflows/aw-failure-investigator.lock.yml Regenerates the compiled workflow.
pkg/cli/aw_failure_investigator_workflow_test.go Adds regression contract assertions.

Review details

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

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

Given failure clusters with their `truncated_error_logs` from the prefetch payload:
1. If a cluster has ≥10 lines of pre-fetched error logs, extract evidence directly from those logs — do **not** call `audit`.
2. Only call `agentic-workflows` MCP `audit` when pre-fetched logs are missing or fewer than 5 lines. Cap total `audit` calls at **2** across all clusters.
1. If a cluster has ≥10 lines of pre-fetched error logs and none has `capture_likely_missed_fault: true`, extract evidence directly from those logs — do **not** call `audit`.
1. If a cluster has ≥10 lines of pre-fetched error logs, extract evidence directly from those logs — do **not** call `audit`.
2. Only call `agentic-workflows` MCP `audit` when pre-fetched logs are missing or fewer than 5 lines. Cap total `audit` calls at **2** across all clusters.
1. If a cluster has ≥10 lines of pre-fetched error logs and none has `capture_likely_missed_fault: true`, extract evidence directly from those logs — do **not** call `audit`.
2. Only call `agentic-workflows` MCP `audit` when pre-fetched logs are missing, fewer than 5 lines, or `capture_likely_missed_fault: true`. Cap total `audit` calls at **2** across all clusters.
`FAILURE_CONCLUSIONS = {"failure", "timed_out", "startup_failure"}`,
`MAX_DISCOVERY_PAGES = 20`,
`ERROR_MARKER = re.compile(r"##\[error\]|\b(?:error|panic|exception)\b", re.IGNORECASE)`,
`def capture_error_window(log_text):`,
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.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

Development

Successfully merging this pull request may close these issues.

[aw-failures] [P0] Failure-Investigator log capture grabs post-job cleanup tail, not the actual error

3 participants