Repository navigation
Conversation
|
Thanks for getting started on this! 👋 This PR is tackling a critical issue — the recurring prompt file ENOENT crash that has been affecting scheduled runs across multiple workflows. The focus is laser-sharp, and the approach is sound. Since this is marked [WIP], here is what would help get it across the finish line:
The diff is currently empty, so no other blockers yet. Keep us posted as the implementation progresses! 🚀
|
Co-authored-by: pelikhan <[email protected]>
There was a problem hiding this comment.
Pull request overview
Prevents nested setup runs from deleting an active workflow prompt.
Changes:
- Adds reset guards for active prompts and explicit opt-out.
- Adds regression coverage and protects the existing setup test.
Show a summary per file
| File | Description |
|---|---|
actions/setup/setup.sh |
Conditionally skips /tmp/gh-aw cleanup. |
pkg/cli/setup_action_test.go |
Adds prompt-preservation safeguards and coverage. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
| elif [ -f /tmp/gh-aw/aw-prompts/prompt.txt ]; then | ||
| SKIP_TMP_RESET="an activation prompt is already present" |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (40 additions detected, threshold is 100). |
|
✅ Test Quality Sentinel completed test quality analysis. |
|
|
There was a problem hiding this comment.
Review
The fix correctly addresses the root cause: setup.sh now skips the /tmp/gh-aw reset when an activation prompt is already present, and the test suite sets GH_AW_SKIP_TMP_RESET=1 to prevent clobbering live runtime state during testing.
The regression test TestSetupActionPreservesExistingActivationPrompt is well-structured: it exercises the file-based guard (not the env-var path) by deliberately omitting GH_AW_SKIP_TMP_RESET, correctly skips when a real prompt already exists, and cleans up after itself.
One existing concern (flagged in a prior review comment at setup.sh:110): a stale prompt.txt left by an interrupted run on a persistent runner would suppress cleanup for the next job. This is worth tracking as a follow-up even if not blocking this fix.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 18.7 AIC · ⌖ 12.3 AIC · ⊞ 5.4K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd — requesting changes on two targeted issues.
📋 Key Themes & Highlights
Key Themes
- Stale-prompt false positive (
setup.shline 110): the file-existence guard protects the current run's prompt but also accidentally preserves a staleprompt.txtleft by a prior interrupted run on a persistent/self-hosted runner, potentially blocking the cleanup of a broken tree. - Weak regression-test assertion (
setup_action_test.go): the new test checks thatprompt.txtsurvives but does not verify the skip control-flow path fired, so a future silent removal of the guard would still pass the test.
Positive Highlights
- ✅ Root cause diagnosis is thorough — the step-sequence table in the PR body is exactly the right evidence.
- ✅ Two-layer guard (prompt-file check + explicit env var) is a well-designed defence-in-depth pattern.
- ✅ Protecting the existing test with
GH_AW_SKIP_TMP_RESET=1is a clean, low-risk change. - ✅ Test skip logic for a live prompt is considerate of the test running inside a live workflow.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 31 AIC · ⌖ 13.8 AIC · ⊞ 7.1K
Comment /matt to run again
| if [ "${GH_AW_SKIP_TMP_RESET:-0}" = "1" ]; then | ||
| SKIP_TMP_RESET="GH_AW_SKIP_TMP_RESET=1" | ||
| elif [ -f /tmp/gh-aw/aw-prompts/prompt.txt ]; then | ||
| SKIP_TMP_RESET="an activation prompt is already present" |
There was a problem hiding this comment.
[/diagnosing-bugs] Stale-prompt false positive: prompt.txt left by a previous interrupted run on a persistent/self-hosted runner will also trigger the skip, silently preserving a stale tree instead of cleaning up — the exact concern raised in the existing review comment.
💡 Suggested mitigation
Write the current GITHUB_RUN_ID into a sentinel file during the artifact-download step, then cross-check it in the guard:
# During the activation-artifact download step:
echo "${GITHUB_RUN_ID}" > /tmp/gh-aw/aw-prompts/.run-id
# setup.sh guard (replace the current elif):
elif [ -f /tmp/gh-aw/aw-prompts/prompt.txt ] && [ "$(cat /tmp/gh-aw/aw-prompts/.run-id 2>/dev/null)" = "${GITHUB_RUN_ID:-}" ]; then
SKIP_TMP_RESET="activation prompt for run ${GITHUB_RUN_ID} already present"This ensures only the current run's prompt is preserved, not a stale leftover.
@copilot please address this.
| } | ||
| require.NoError(t, os.MkdirAll(promptDir, 0o755), "Failed to create prompt directory") | ||
| t.Cleanup(func() { _ = os.RemoveAll(promptDir) }) | ||
| require.NoError(t, os.WriteFile(promptFile, []byte("test prompt\n"), 0o644), "Failed to write prompt file") |
There was a problem hiding this comment.
[/tdd] The regression test creates the prompt file itself but does not assert that setup.sh logged the skip reason — a future change that removes the guard silently and still exits 0 would pass this test.
💡 Strengthen the assertion
Capture setup.sh's combined output and assert the skip message appears:
output, err := cmd.CombinedOutput()
require.NoError(t, err, "setup.sh should succeed: %s", output)
assert.FileExists(t, promptFile, "setup.sh must not delete an existing activation prompt")
assert.Contains(t, string(output), "Skipping /tmp/gh-aw reset",
"setup.sh should log that it skipped the reset when a prompt is present")This turns the test into a specification: it verifies both the observable side-effect (file preserved) and the control-flow path that produced it (debug log emitted).
@copilot please address this.
🧪 Test Quality Sentinel Report
Metrics: 50% design tests | 100% edge/error coverage | 0 violations New Test: TestSetupActionPreservesExistingActivationPrompt
Modified: TestSetupActionCopiesAntigravityLogParser
Test Inflation (2.35:1): Marginally exceeds 2:1 threshold but justified by integration-style setup requirements. Verdict✅ Passed — Design-oriented test validates behavioral contract. No guideline violations. Error paths fully covered.
|
Copilot-engine runs across several workflows were crashing before the first turn with
[copilot-sdk-driver] error: failed to read prompt file /tmp/gh-aw/aw-prompts/prompt.txt: ENOENT. The prompt file is deleted between the activation-artifact download and the agent execution step — not a sub-agent hang (#49022).Root cause
actions/setup/setup.shunconditionally runsrm -rf /tmp/gh-awto guarantee a clean runtime tree, andpkg/cli/setup_action_test.goshells out to that script duringgo test. Any workflow that runs this repository's test suite after the activation artifact is downloaded therefore wipes its own prompt.CI Optimization Coach run 30915139809 shows the sequence exactly:
/tmp/gh-awgo test ./...)The same shape applies to the other affected workflows, which also run tests in a pre-agent step.
Changes
actions/setup/setup.sh— skip the/tmp/gh-awreset when/tmp/gh-aw/aw-prompts/prompt.txtis already present, or whenGH_AW_SKIP_TMP_RESET=1. Behaviour at genuine job start (no prompt yet) is unchanged, including the existing root-owned / sudo reclaim paths.pkg/cli/setup_action_test.go— setsGH_AW_SKIP_TMP_RESET=1so the test can never clobber a live runtime tree, and addsTestSetupActionPreservesExistingActivationPromptas a regression guard.The prompt-file check is the load-bearing guard (it covers any current or future caller); the env var is the explicit escape hatch for callers that know they are nested.