Skip to content

Instrument Copilot execution step to persist stderr and exit code on failure - #42876

Closed
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/deep-report-instrument-copilot-cli
Closed

Instrument Copilot execution step to persist stderr and exit code on failure#42876
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/deep-report-instrument-copilot-cli

Conversation

CopilotAI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Deep-report analysis found the dominant Copilot failure mode was 0-turn/0-token exits from Execute GitHub Copilot CLI with no stderr captured in artifacts, making failures non-diagnosable. This change instruments the generated Copilot execution step to always emit failure diagnostics into the existing log artifact path.

  • Failure diagnostics in generated Copilot run step

    • Wraps the existing Copilot command in a failure-aware shell envelope.
    • Captures stderr to /tmp/gh-aw/sandbox/agent/logs/copilot-cli-exec.stderr.log while preserving stderr in live job logs.
    • Captures non-zero exit status to /tmp/gh-aw/sandbox/agent/logs/copilot-cli-exec.exitcode.
    • Re-exits with the original Copilot exit code to preserve current failure semantics.
    • Cleans stale diagnostic files at start; removes stderr artifact on success to keep artifacts failure-focused.
  • Execution-step contract updates

    • Updates Copilot execution-step tests to assert presence of stderr/exit-code capture behavior.
    • Refreshes impacted Copilot workflow golden outputs to reflect generated YAML changes.
mkdir -p /tmp/gh-aw/sandbox/agent/logs/
rm -f /tmp/gh-aw/sandbox/agent/logs/copilot-cli-exec.stderr.log /tmp/gh-aw/sandbox/agent/logs/copilot-cli-exec.exitcode
set +e
(
# existing Copilot command
) 2>>(tee -a /tmp/gh-aw/sandbox/agent/logs/copilot-cli-exec.stderr.log >&2)
GH_AW_COPILOT_EXEC_EXIT_CODE=$?set -e
if [ "$GH_AW_COPILOT_EXEC_EXIT_CODE"-ne 0 ];thenprintf'%s\n'"$GH_AW_COPILOT_EXEC_EXIT_CODE"> /tmp/gh-aw/sandbox/agent/logs/copilot-cli-exec.exitcode
fiexit"$GH_AW_COPILOT_EXEC_EXIT_CODE"

CopilotAIand others added 2 commits July 2, 2026 02:49
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Instrument copilot CLI exec step to emit stderr and exit codeInstrument Copilot execution step to persist stderr and exit code on failureJul 2, 2026
CopilotAI requested a review from pelikhanJuly 2, 2026 02:53
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — Run §28572743533

FieldValue
Categoryfeature
Risk🟡 Medium
Score64 / 100
BreakdownImpact: 30 · Urgency: 20 · Quality: 14
Actionfast_track

Adds stderr/exit-code persistence on Copilot execution failure — high-value debugging capability across 7 files. Recommend expedited human review once undrafted.

Generated by 🔧 PR Triage Agent · 64.3 AIC · ⌖ 9.84 AIC · ⊞ 1.6K ·

@pelikhanpelikhan closed this Jul 2, 2026
@github-actions
github-actionsBot deleted the copilot/deep-report-instrument-copilot-cli branch July 9, 2026 03:00
Sign up for freeto 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.

[deep-report] Instrument copilot CLI exec step to emit stderr + exit code into run artifacts

2 participants

@pelikhan