Registry Mirror
Skip to content

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Why

Agents investigating workflow failures currently have to scan individual runs and reconstruct recurring symptoms themselves. Add precomputed failure groups and a small investigation plan so they can select useful runs without reading the entire logs report.

Approach

  • Cluster failures using already available failed jobs/steps, MCP failures, missing tools/data, and blocked domains. Persist extracted signals in the JSONL cache and regenerate query-scoped memberships with stable cluster IDs.
  • Rank specific failure boundaries ahead of generic failure-handler aftermath. Keep conclusions, failure kinds, intentional failures, and metadata-only unknowns distinct.
  • Generate a deduplicated initial audit plan of up to five runs. Prefer new cluster coverage and representatives spanning workflow/engine/model contexts, with cached evidence paths and audit selectors.
  • Surface recommendations in compact, verbose, console, TSV, JSON, and cross-run reports. Retain full membership in JSON and detailed output rather than repeating every audit command by default.
  • Update schemas, troubleshooting docs, MCP tool guidance, and shared logs prompts to teach targeted projections, cached evidence reuse, overlap handling, and complete continuation cursors.

Clusters describe shared symptoms, not proven common causes. Counts overlap and must not be summed as unique failures. Intentional failures are excluded from recommendations; the five-run plan is an initial subset, not an exhaustive investigation. Clustering itself adds no downloads or model calls.

Validation

  • make agent-report-progress-no-test: build, change-scoped standard/custom lint, schema checks, and workflow lock drift checks passed.
  • make recompile: all 344 workflows compiled successfully; regenerated lock metadata is included.
  • Focused logs, cache, rendering, MCP, and cross-run regression tests passed.
  • TestFailureClustersReplay passed against collected repository reports, including reversed-input replay with identical clusters and investigation plans.

Evaluation

Reran the actual CLI for a refreshed 12-hour evidence window, 2026-10-14 16:21:24 through 2026-10-15 04:21:24 UTC: 448 available reports from 450 requested runs, with 182 failures and 72 clusters.

With the same five-run investigation budget, the new plan spans 10 observed symptom clusters versus 5 using the previous count-ranked defaults. Representative-diversity gaps fall from one to zero; structural and membership checks report no violations. The bounded plan is about 2.8 KB versus 4.6 MB for the full JSON report. All 10 explicit agent-guidance checks pass.

These are deterministic consistency, coverage, and guidance evaluations, not labeled root-cause accuracy or live LLM-agent outcome measurements. Of the analyzed failures, 62 remain metadata-only unknowns.

pelikhan and others added 2 commits October 14, 2026 20:46
Group failed runs by observed metadata signals, persist evidence in cached run records, and annotate report formats with stable cluster IDs and representative audit targets.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Rank specific boundaries before generic aftermath, diversify representatives, and generate a bounded deduplicated audit plan. Present compact cluster summaries and teach logs consumers to project investigation targets and reuse cached evidence.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 15, 2026 04:54
Copilot AI max review requested due to automatic review settings October 15, 2026 04:54
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

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

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

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Commit pushed: f8d2b2e

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

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.

Generated from Ponytail Reviewer · gpt56 · 10.2 AIC · ⌖ 5.28 AIC · ⊞ 14.2K · ◷

Generated by Ponytail Reviewer for #68954

@github-actions

github-actions Bot commented Oct 15, 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.

Generated from Test Quality Sentinel · sonnet50 · 14 AIC · ⌖ 14.7 AIC · ◇ 6.61 AIC · ⊞ 12.0K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (1,242 new lines across pkg/cli/, above the 100-line threshold) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/68954-precomputed-failure-clusters-and-investigation-plan-in-logs.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

🔍 Decision inferred from the diff
  • Decision: compute failure clusters and a bounded (≤5 run) investigation plan deterministically inside the gh aw logs pipeline, from already-cached run evidence (pkg/cli/logs_failure_signals.go, logs_failure_clusters.go, logs_failure_investigation.go).
  • Driver: full reports (~4.6 MB in the cited evaluation) do not fit an agent context budget, and count-ranked selection oversamples generic failure-handler aftermath.
  • Alternatives drafted: leave clustering to the consuming agent; rank purely by cluster size; model/embedding-based semantic clustering.
  • Consequences drafted: doubled symptom coverage within the same audit budget and no new downloads or model calls, versus overlapping non-summable counts, ~900 new lines plus ~600 lines of schema to maintain, hand-tuned ranking constants, and a new cache-compatibility surface for persisted signals.

One item is marked [TODO: verify] in the draft (whether semantic grouping of metadata-only unknowns is wanted as a future opt-in step).

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-68954: Precompute failure clusters and a bounded investigation plan inside gh aw logs

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus50 · 51.8 AIC · ⌖ 52.6 AIC · ⊞ 1.9K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-15T04:56:41Z
review_event: REQUEST_CHANGES
top_themes:
  - tsv output contract regression
  - pretty output stream split
  - mcp logs tool contract ambiguity
files_reviewed:
  - pkg/cli/logs_failure_clusters.go
  - pkg/cli/logs_failure_investigation.go
  - pkg/cli/logs_report.go
  - pkg/cli/mcp_tools_privileged.go
  - pkg/cli/audit_cross_run.go
  - pkg/cli/audit_cross_run_render.go
  - pkg/cli/logs_orchestrator_render.go
comment_count: 3

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 96.8 AIC · ⌖ 5.93 AIC · ⊞ 21.4K · ◷
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.

Request changes

This adds useful failure clustering, but the current patch regresses a few output contracts badly enough that I would not ship it as-is.

Blocking themes
  • --format tsv no longer keeps stdout purely tabular; the new failure-report trailer appends non-TSV rows that will break existing parsers.
  • --cross-run --format pretty now splits one human-readable report across stdout and stderr, so redirects and pipelines capture only fragments.
  • The MCP logs tool guidance still returns a file_path envelope, but the rewritten description no longer clearly tells callers to read that file before querying report fields, which is likely to mislead agent consumers.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 96.8 AIC · ⌖ 5.93 AIC · ⊞ 21.4K
Comment /review to run again

Comment thread pkg/cli/logs_orchestrator_render.go Resolved
Comment thread pkg/cli/audit_cross_run_render.go Resolved
Comment thread pkg/cli/mcp_tools_privileged.go Resolved

@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 /grill-with-docs (per pr-triage) to the new failure clustering/investigation plan feature.

One actionable finding posted inline: a fragile string-literal coupling between the aftermath classifier in pkg/cli/logs_failure_signals.go and the compiler-side "Handle agent failure" step name in pkg/workflow/notify_comment_conclusion_helpers.go, with no shared constant or cross-package test to catch a future rename.

📋 Key Themes & Highlights

Key Themes

  • Coupling risk: failureSignalRole's "conclusion"/"Handle agent failure" match (see inline comment) is the only place outside pkg/workflow that depends on that exact step name, and nothing enforces the link.

Positive Highlights

  • Deterministic, idempotent cluster IDs verified by TestFailureClustersReplay (reversed-input replay, cached round-trip) and TestAnnotateFailureClusters (order/subset independence).
  • Good test coverage of boundary conditions: intentional-failure exclusion, duplicate run dedup, metadata-only fallback, representative diversity, and budget-bounded greedy selection with tie-break determinism (slices.Reverse check in TestFailureInvestigationBudgetCoverageAndDeterminism).
  • Schema (schemas/logs.schema.json, schemas/logs-jsonl.schema.json) and docs (debugging.md, MCP tool description) updated consistently with the new fields.
  • Clear domain vocabulary in doc comments (symptoms not causes, bounded not exhaustive) that should help agents avoid over-interpreting cluster counts.

No blocking issues found beyond the coupling note; approving with that single suggestion for follow-up.

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

Comment thread pkg/cli/logs_failure_signals.go Resolved
pelikhan and others added 2 commits October 14, 2026 22:08
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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

Cross-host identity collisions can omit failures from investigation plans, and pretty reports split their sections across output streams.

2 open findings
What changed in this PR

Adds symptom-based failure clustering to gh aw logs, helping agents choose useful runs for targeted investigation without extra downloads or model calls.

Changes:

  • Extracts failure signals, builds stable clusters, and selects a bounded audit plan.
  • Integrates recommendations across report formats, schemas, and cache data.
  • Adds regression tests and updates troubleshooting and agent guidance.
File Description
schemas/​logs.schema.json Defines cluster and investigation report fields.
schemas/​logs-jsonl.schema.json Defines cached failure-signal fields.
pkg/​cli/​mcp_tools_privileged.go Updates logs-tool investigation guidance.
pkg/​cli/​logs_report.go Builds clusters and investigation plans.
pkg/​cli/​logs_orchestrator_render.go Connects TSV and cross-run output.
pkg/​cli/​logs_format_compact.go Adds compact and verbose failure sections.
pkg/​cli/​logs_failure_signals.go Enriches signals and selects diverse representatives.
pkg/​cli/​logs_failure_investigation.go Selects bounded investigation targets.
pkg/​cli/​logs_failure_investigation_test.go Tests ranking, coverage, and determinism.
pkg/​cli/​logs_failure_investigation_render.go Renders investigation recommendations.
pkg/​cli/​logs_failure_clusters.go Extracts and groups failure symptoms.
pkg/​cli/​logs_failure_clusters_test.go Tests clustering, caching, and output.
pkg/​cli/​logs_failure_clusters_replay_test.go Adds saved-report replay validation.
pkg/​cli/​logs_failure_clusters_render.go Renders clusters and membership.
pkg/​cli/​audit_cross_run.go Adds failure data to cross-run reports.
pkg/​cli/​audit_cross_run_render.go Adds Markdown and pretty failure sections.
docs/​src/​content/​docs/​troubleshooting/​debugging.md Explains targeted failure investigation.
.github/​workflows/​workflow-normalizer.lock.yml Refreshes generated prompt metadata.
.github/​workflows/​shared/​aw-logs-24h-fetch.md Adds targeted triage guidance.
.github/​workflows/​shared/​aw-logs-24h-fetch-prompt.md Adds prompt-only triage guidance.
.github/​workflows/​safe-output-health.lock.yml Refreshes generated prompt metadata.
.github/​workflows/​daily-storify.lock.yml Refreshes generated prompt metadata.
.github/​workflows/​daily-firewall-report.lock.yml Refreshes generated prompt metadata.
.github/​workflows/​agent-job-health.lock.yml Refreshes generated prompt metadata.
.github/​aw/​cli-commands.md Documents investigation-plan usage.

🧠 Review effort: Max


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

Comment thread pkg/cli/audit_cross_run_render.go Resolved
Comment thread pkg/cli/logs_failure_investigation.go Resolved
pelikhan and others added 2 commits October 14, 2026 22:18
Update the embedded dispatcher template and offline file list to match the run-analysis guidance added by this PR. Cover generated routing and offline discoverability with regression assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove duplicate prose and overlay placeholders while preserving scope routing, clustering semantics, evidence safeguards, and reporting requirements.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/cli/logs_orchestrator_render.go:150): Appending the new [failure_*] trailer lines to TSV mode breaks the TSV contract, so downstream parsers will start ingesting non-tabular rows as data. - Add automatic failure clustering and investigation plans to logs #68954 (comment)
  3. Review (pkg/cli/audit_cross_run_render.go:271): This pretty renderer sends the new failure-cluster block to stdout while every surrounding section goes to stderr, so redirecting pretty output will split one report across two streams. - Add automatic failure clustering and investigation plans to logs #68954 (comment)
  4. Review (pkg/cli/mcp_tools_privileged.go:224): The new MCP contract text no longer tells callers to open file_path before looking for summary, failure_investigation, or runs, so an agent that follows this literally will query fields that are not present in the tool response envelope. - Add automatic failure clustering and investigation plans to logs #68954 (comment)
  5. Review (pkg/cli/logs_failure_signals.go:33): [/codebase-design] Fragile cross-package coupling: failureSignalRole matches the literal "Handle agent failure" step name to detect generic failure-handler aftermath, but the only producer of that string is pkg/workflow/notify_comment_conclusion_helpers.go:521 (StepName: "Handle agent failure"), with no shared constant linking them. - Add automatic failure clustering and investigation plans to logs #68954 (comment)
  6. Review (pkg/cli/audit_cross_run_render.go:271): Every other section of renderCrossRunReportPretty writes to stderr, but this call sends the investigation plan and clusters to stdout. As a result, gh aw logs --format pretty 2>report.txt omits these sections from the saved report and leaves them on stdout. Pass os.Stderr here so the complete pretty report stays on one stream. - Add automatic failure clustering and investigation plans to logs #68954 (comment)
  7. Review (pkg/cli/logs_failure_investigation.go:80): Multi-host logs queries can contain distinct runs with the same numeric ID. This map keeps only one: two failures with ID 42 report unique_failed_runs=1 and can leave a cluster unselectable despite spare audit budget. The numeric-only reached sets also undercount coverage. - Add automatic failure clustering and investigation plans to logs #68954 (comment)
  8. Fix failing check build (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467595/job/116265502057.
  9. Fix failing check Build & Test on macos-latest (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467633/job/116266352743.
  10. Fix failing check Build Windows CLI (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467646/job/116265625331.
  11. Fix failing check build-wasm (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467633/job/116265672277.
  12. Fix failing check lint-go-format (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467633/job/116265672561.
  13. Fix failing check mcp-server-compile-test (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467633/job/116265672588.
  14. Fix failing check verify-integration-build (FAILURE): https://github.com/github/gh-aw/actions/runs/38687467633/job/116265672211.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: 91c77d3
Sous-chef work: 042501c72bb538ebb0915a24c19724d63b4857bd35e3f3314b086d9f238f28ce 6890db2d1f5ad1e52f17f44fea3b0f5de9e2441b83440ac6d6a8b68ece43deff 6af22e757e9aa9460a2997238d41aeb4721e327a111b008b7ca93befe48c6622 8a2efb299e1843bc5de8cf642a72b7a06a9156b6f39ef278bb20251f0ebf0358 8acb61a077717e3a460018aacdfde96fd489f77606cd36169e2328d9079b75bb a33b6358f709de885b483c878c715680fa905ff2aae806d0caf2118f8b06ae72 aae237d5601b23982f66dedbaa031ceada2f602028736e47934fe734b25af255 b4eb1c4fec71e90b6397b3e6749178ab335916e88edeb3a74c4c6a01a73675e4 c20a8a8e9563d8665bdbe13a98b527a5b0cfa0ec0008b1220f096ff70aa6541e cabafb2817b103330ac0d1e2e098f214c40c4ca2be128895a8b14391f7e3306f e5f172eb3cce90a8cabd6d5c5598d744caf424c1d11136364f273f9a0bf15190 f608a3b4d2ea8983984f0ad739cad7561bee404a606e877bbdf42d2f19569a73 f7883e8c8105930e955354caa741d783bcca067e66097fe9612fb72b90823998
Sous-chef state: 0fad8aea96b16ac5f9a0ac319bb12730e4d286eddfa3cde63c25b61901999c46

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 7.06 AIC · ⌖ 10.1 AIC · ⊞ 1.1K · ◷
Comment /souschef to run again

Copilot AI and others added 5 commits October 15, 2026 05:59
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Sample current AW revisions independently within bounded lookback and API budgets. Use gh-aw-metadata hashes to report recovery, unexecuted changes, and insufficient evidence; reuse current failure clusters without artifact downloads. Add failed-sample Wilson statistics and cache symptom-profile gains with marginal coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve the concurrent branch history and regenerate the agentic-workflows file index required by the skill synchronization contract.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…' into pelikhan-logs-failure-clustering

# Conflicts:
#	pkg/cli/logs_failure_clusters.go
#	pkg/cli/logs_failure_investigation.go
#	pkg/cli/logs_failure_signals.go

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 15, 2026 06:47
@pelikhan
pelikhan merged commit bc034dd into main Oct 15, 2026
2 checks passed
@pelikhan
pelikhan deleted the pelikhan-logs-failure-clustering branch October 15, 2026 13:15
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.92.1

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