Anchor Failure Investigator log capture to error markers - #52620
Merged
Conversation
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
pelikhan
marked this pull request as ready for review
August 14, 2026 05:53
Contributor
There was a problem hiding this comment.
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):`, |
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
##[error],error,panic, orexceptionmarker.Capture-confidence signal
capture_likely_missed_faultto each prefetched log entry when the fallback tail contains no diagnostic marker.Evidence escalation
Regression coverage
--log-failedabsolute-tail behavior.