Skip to content

Retry Claude runs after AWF/MCP startup failures - #55864

Open
pelikhan with Copilot wants to merge 12 commits into
mainfrom
copilot/aw-failures-fix-cli-startup-error
Open

Retry Claude runs after AWF/MCP startup failures#55864
pelikhan with Copilot wants to merge 12 commits into
mainfrom
copilot/aw-failures-fix-cli-startup-error

Conversation

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Avenger intermittently fails before Claude emits structured logs when AWF or MCP gateway startup fails. These failures were treated as resumable partial runs, causing invalid --continue retries and opaque exitCode=unknown diagnostics.

  • Fresh startup retries

    • Detect AWF/MCP startup diagnostics before Claude session progress.
    • Consume the bounded Claude startup-retry budget with a fresh invocation rather than --continue.
    if (awfStartupFailure && !sessionHasProgress) {
      useContinueOnRetry = false;
      return { action: "retry", nextDelayMs: initialDelayMs };
    }
  • Actionable failure diagnostics

    • Extract AWF Process exiting with code: N output when the harness did not emit its own completion status.
  • Regression coverage

    • Cover fresh retry behavior for AWF gateway startup failures.
    • Cover propagation of AWF exit codes into no-structured-log failures.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 14.2 AIC · ⌖ 9.14 AIC · ⊞ 8.7K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 20.8 AIC · ⌖ 8.13 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Avenger's Claude Code CLI startup config failure Retry Claude runs after AWF/MCP startup failures Aug 25, 2026
Copilot AI requested a review from pelikhan August 25, 2026 20:31
@pelikhan
pelikhan marked this pull request as ready for review August 25, 2026 22:33
Copilot AI balanced review requested due to automatic review settings August 25, 2026 22:33
@github-actions

github-actions Bot commented Aug 25, 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 Aug 25, 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 commented Aug 25, 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 Aug 25, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #55864

@github-actions

github-actions Bot commented Aug 25, 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 0 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-25T22:36:00Z
review_event: COMMENT
top_themes:
  - no actionable blocking issues found in startup retry/diagnostic changes
files_reviewed:
  - actions/setup/js/claude_harness.cjs
  - actions/setup/js/claude_harness.test.cjs
  - actions/setup/js/log_parser_bootstrap.cjs
  - actions/setup/js/log_parser_bootstrap.test.cjs
comment_count: 0

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
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 · pi · gpt54 · 4.17 AIC · ⌖ 6.85 AIC · ⊞ 7K ·
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.

Verdict

Non-blocking from a code-quality perspective.

Reviewed areas
  • Fresh-run retry path for AWF/MCP startup failures before Claude session progress
  • Exit-code extraction from unstructured AWF startup logs
  • Regression coverage for both behaviors

I did not find a changed-line correctness, reliability, or maintainability issue strong enough to block this PR.

🔎 Code quality review by PR Code Quality Reviewer · pi · gpt54 · 4.17 AIC · ⌖ 6.85 AIC · ⊞ 7K
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.

One small simplification opportunity in the AWF retry path. net: -8 lines possible.

Generated by ✂️ Ponytail Reviewer for #55864 · codex · mai10 · 6.43 AIC · ⌖ 3.3 AIC · ⊞ 16.7K
Comment /ponytail to run again

Comment thread actions/setup/js/claude_harness.cjs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report - APPROVED

Score: 100/100 — Excellent

Analysis Summary:

  • Analyzed: 2 JS tests (both design_test, high_value)
  • Design coverage: 100%
  • Implementation tests: 0% (threshold: 30%)
  • Violations: 0
  • Test inflation: NO (0.78:1 ratio)

Test 1: Fresh retry detection (claude_harness.test.cjs:704)
Verifies AWF startup failures before Claude session progress trigger fresh retry (not --continue). 4 assertions cover exit code, retry count, args, and diagnostics.

Test 2: Exit code extraction (log_parser_bootstrap.test.cjs:82)
Verifies AWF exit codes extracted from logs when no structured logs produced. Covers buildClaudeStartupDiagnostics() exit code regex.

Verdict: ✅ Passed. High-value design contracts with complete edge-case coverage. No violations.

🧪 Test quality analysis by Test Quality Sentinel · copilot · haiku45 · 27.2 AIC · ⌖ 6.01 AIC · ⊞ 8.3K ·
Comment /review to run again

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

Adds recovery and diagnostics for Claude startup failures.

Changes:

  • Detects AWF/MCP startup failures and attempts fresh retries.
  • Extracts AWF exit codes when structured logs are absent.
  • Adds regression tests for both behaviors.
Show a summary per file
File Description
actions/setup/js/claude_harness.cjs Adds startup-failure retry classification.
actions/setup/js/claude_harness.test.cjs Tests fresh startup retries.
actions/setup/js/log_parser_bootstrap.cjs Extracts AWF process exit codes.
actions/setup/js/log_parser_bootstrap.test.cjs Tests exit-code diagnostics.

Review details

Suppressed comments (1)

actions/setup/js/claude_harness.cjs:634

  • When this startup failure repeats after the default one fresh retry, the startup budget condition becomes false and execution falls through to the generic result.hasOutput branch below. shouldRetryWithContinue() then returns true, so the next invocation incorrectly uses --continue even though sessionHasProgress is still false. Handle every matched no-progress startup failure in this branch and stop once its startup budget is exhausted.
      if (awfStartupFailure && !sessionHasProgress && attempt < maxRetries && startupRetriesUsed < startupRetryLimit) {
        startupRetriesUsed++;
        useContinueOnRetry = false;
        log(`attempt ${attempt + 1}: no Claude session progress — retrying startup as fresh run ` + `(startup retry ${startupRetriesUsed}/${startupRetryLimit}, next attempt ${attempt + 2}/${maxRetries + 1})`);
        return { action: "retry", nextDelayMs: initialDelayMs };
      }
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread actions/setup/js/claude_harness.cjs Outdated

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

Review: Retry Claude runs after AWF/MCP startup failures

Overall: The approach is sound — detecting AWF/MCP startup failures early and retrying as a fresh run (not --continue) is the right strategy. Two non-blocking issues worth addressing before merging:

1. AWF_STARTUP_FAILURE_PATTERN is over-broad (line 101, claude_harness.cjs)

The .*? between the prefix (awf, mcp gateway) and the failure keyword allows any intervening text. A post-startup error line that mentions awf as context (e.g. awf session 5: step failed) would match and trigger an unnecessary fresh-run retry. Tightening the pattern (bounding the gap or matching specific known phrases) would reduce false positives.

2. Unguarded case: awfStartupFailure && sessionHasProgress (line ~632, claude_harness.cjs)

When both flags are true the code silently falls into the normal --continue retry path, which the comment says is "not viable" for startup failures. Adding an explicit log entry (or a guard that prevents --continue when awfStartupFailure) for this edge case would make the invariant auditable and prevent silent misbehavior.

Both are COMMENT-level suggestions; no blocking correctness or security issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet46 · 25.5 AIC · ⌖ 9.38 AIC · ⊞ 6.2K

Comment thread actions/setup/js/claude_harness.cjs Outdated
Comment thread actions/setup/js/claude_harness.cjs Outdated

@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 — requesting changes on correctness and test coverage gaps.

📋 Key Themes & Highlights

Key Themes

  • Regex over-breadth (claude_harness.cjs:101): AWF_STARTUP_FAILURE_PATTERN can match mid-run MCP error lines, causing false-positive fresh retries.
  • Pattern as sole gate (claude_harness.cjs:629): If AWF emits output that doesn't match the pattern, the code falls through to --continue — the bug this PR is meant to fix.
  • Missing unit tests for the predicate (claude_harness.test.cjs): isAWFStartupFailure has no isolated true/false unit tests; only the integration stub exercises it.
  • Possible test-discovery gap (log_parser_bootstrap.test.cjs:82): The new test is inserted as a comma expression, which can silently prevent registration in some Vitest setups.

Positive Highlights

  • ✅ Clean separation of isAWFStartupFailure as an exported predicate — matches the project's existing isX function pattern.
  • useContinueOnRetry = false is set before return { action: "retry" } — correct and safe ordering.
  • ✅ Good regression test for the happy path (retry succeeds on second attempt without --continue).
  • ✅ AWF exit code extraction in log_parser_bootstrap.cjs is a nice targeted fix with clear fallback semantics.

@copilot please address the review comments above.

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

Comment thread actions/setup/js/claude_harness.cjs Outdated
Comment thread actions/setup/js/claude_harness.test.cjs
Comment thread actions/setup/js/claude_harness.cjs Outdated
Comment thread actions/setup/js/log_parser_bootstrap.test.cjs
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.

Please do one focused follow-up pass:

  • address the blocking review feedback in the existing review threads, especially the startup-failure retry fallback and regex/test coverage concerns surfaced by the latest reviews
  • reply in-thread with the concrete fix references, push the fixes, and rerun the relevant checks
  • refresh the branch if needed and use the pr-finisher skill before handing back for review

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

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 14.6 AIC · ⌖ 8.22 AIC · ⊞ 6.3K ·
Comment /souschef to run again

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

@gh-aw-bot Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 62fec390-c9d5-481f-ae3c-4609803352d2

Sorry for the inconvenience!

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

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.
...

Fixed in 46c4311. I moved AWF startup retry handling to the generated outer AWF invocation, removed the in-harness AWF startup regex/helper, added outer-wrapper regression coverage, verified the log parser test is discovered, and ran targeted Go/JS validation. make agent-report-progress-no-test reached lint/schema checks successfully but is blocked by existing workflow lock-file drift unrelated to this PR.

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.
...

Completed. The branch is refreshed against main at ac582f3, all review threads are resolved, and the latest Sous Chef run 32949103424 had no failed jobs. I reran make fmt, make lint, make test-unit, make test, make recompile, and make agent-report-progress; validation passed with workflow lock files in sync.

@github-actions

Copy link
Copy Markdown
Contributor

Triage update: Category: bug | Risk: high | Score: 70/100 (impact 38 + urgency 22 + quality 10) | Action: fast_track | Batch: workflow-runtime

Generated by 🔧 PR Triage Agent · copilot · mai10 · 17.1 AIC · ⌖ 2.78 AIC · ⊞ 15.6K ·

@github-actions

Copy link
Copy Markdown
Contributor

Triage update: Category: bug | Risk: high | Score: 70/100 (impact 38 + urgency 22 + quality 10) | Action: fast_track | Batch: workflow-runtime

Generated by 🔧 PR Triage Agent · copilot · mai10 · 17.1 AIC · ⌖ 2.78 AIC · ⊞ 15.6K ·

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Triage update: Category: bug | Risk: high | Score: 70/100 (impact 38 + urgency 22 + quality 10) | Action: fast_track | Batch: workflow-runtime

Generated by 🔧 PR Triage Agent · copilot · mai10 · 17.1 AIC · ⌖ 2.78 AIC · ⊞ 15.6K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

$gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.

Please do one focused follow-up pass:

  • refresh the branch if needed and use the pr-finisher skill before handing back for review

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

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 5.54 AIC · ⌖ 8.13 AIC · ⊞ 6.3K ·
Comment /souschef to run again

…ix-cli-startup-error

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

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

$gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.
...

Completed in 4a982ce. I refreshed the branch against main (f50bb57c44), confirmed all review threads are resolved, and verified the latest Sous Chef run 32972030991 had no failed jobs. Local validation passed with make fmt, make lint, make test-unit, make test, make recompile, and make agent-report-progress; CI on the refreshed agent-pushed head still needs a maintainer re-trigger before merge.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot apply to all agentic engine harnesses

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.

Please do one focused follow-up pass:

  • apply the startup-retry handling consistently across the remaining agentic engine harnesses requested on this PR
  • reply in the existing review threads with the concrete fix references and validation results
  • refresh the branch if needed and use the pr-finisher skill before handing back for review

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

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 23.4 AIC · ⌖ 8.18 AIC · ⊞ 8.7K ·
Comment /souschef to run again

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

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot apply to all agentic engine harnesses

Implemented in 0c032f6. The shared AWF wrapper now applies startup-failure fresh retries to built-in harnessed engines (Claude, Codex, Copilot, Gemini, and Pi) using engine-specific harness markers, with updated regression coverage, docs, wasm goldens, and compiled workflow locks.

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.
...

Completed in 0c032f6. The shared AWF wrapper applies startup-failure fresh retries to the remaining built-in agent harnesses: Claude, Codex, Copilot, Gemini, and Pi. I verified the production harness inventory, confirmed all existing review threads are resolved, checked Sous Chef run 32979958387 (no failed jobs), and reran make fmt && make lint && make test-unit && make test && make recompile successfully.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot refactor the generated code into a shell script

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

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot refactor the generated code into a shell script

Implemented in ceceeba. The generated AWF retry loop now delegates to actions/setup/sh/run_awf_with_startup_retries.sh, with generated workflows passing the engine name, harness marker, log file, and attempt-log token into the helper. Validation passed: helper shell test, shellcheck, focused AWF generator tests, go test ./pkg/workflow, make recompile, make agent-report-progress, secret scan, and automated code review.

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

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.

[aw-failures] Avenger: Claude Code CLI fails to start with ERR_CONFIG (no structured log entries)

4 participants