Skip to content

ci: retry windows-advisory unit step once on transient failure - #1047

Merged
Astro-Han merged 3 commits into
devfrom
claude/windows-advisory-retry
Jun 1, 2026
Merged

ci: retry windows-advisory unit step once on transient failure#1047
Astro-Han merged 3 commits into
devfrom
claude/windows-advisory-retry

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

Wrap each matrix shard's unit step in .github/workflows/windows-advisory.yml in a process-level retry (max_attempts=2). A first-attempt failure now writes a step-summary header (Windows unit attempt 1 failed (retrying) / Windows unit recovered on retry) and the job only turns red if both attempts fail. Each attempt runs in a subshell so cd packages/opencode && ... in some matrix commands does not leak working directory across attempts.

Why

The windows-advisory workflow has been ~40% red over the last ten runs on dev due to transient flake that does not come from the merged PRs:

  • PR fix: detach submitted homepage drafts #1043 (010c6d6) failed only on SessionRunState > defers disposeAll across all loaded directories when any directory has an active run in packages/opencode/test/session/run-state.test.ts, which uses Effect.sleep("10/20 millis") timing assertions on Windows's coarser wall clock. Same-SHA rerun passed. PR diff was 5 files all under packages/app/.
  • PR ci: run Windows advisory on pull requests #1028 (05d8ba1) failed with a Bun 1.3.14 native segfault on windows-latest (Ywatcher.node stack frames), unrelated to PR content.

Linux ci is the load-bearing required gate; windows-advisory is advisory and non-blocking. A single transient failure should not turn the advisory red, but persistent regressions still must be visible — hence retry with first-attempt failure surfaced in the step summary rather than silently swallowed.

Related Issue

No issue; surfaced from CI history triage on 2026-06-01 after two recent dev merges (#1043, #1037) showed windows-advisory failure.

Human Review Status

Pending

Review Focus

  • The retry loop preserves the four substrings the ci-workflow.test.ts self-test asserts: ${{ matrix.command }}, echo "exit_code=$status", ### Windows unit diagnostic, failed advisory signal. Confirm none of these are accidentally broken.
  • Subshell ( ${{ matrix.command }} ) per attempt — verify this is the right scoping for matrix shards that contain cd packages/... (opencode-session, opencode-config-project, opencode-server-tools).
  • Bash for loop instead of nick-fields/retry@v3 — this matches the repo's SHA-pinned-actions discipline; if you prefer the third-party action anyway, say so.
  • Retry applied uniformly across all 5 matrix shards (app / opencode-session / opencode-config-project / opencode-server-tools / desktop) rather than only opencode-session, because the Bun-segfault failure class is process-level and shard-agnostic.

Risk Notes

  • Retry hides the first-attempt failure signal at the check-result level. Mitigation: the step summary still records attempt 1 exit code whenever retry recovers, so persistent flake remains visible to humans reviewing the workflow run. The required Linux ci gate is untouched, so genuine product regressions are still blocked from merging.
  • The Upload unit artifacts step uploads the JUnit XML from whichever attempt wrote it last; on retry recovery the artifact reflects attempt 2. Acceptable for an advisory signal.
  • No test-layer changes. Rewriting Effect.sleep-based timing in run-state.test.ts to deterministic primitives is a larger Effect-TS surgery; deferred until after the 2026-06-15 windows-latestwindows-2025-vs2026 runner migration, since flake patterns will shift.

How To Verify

actionlint .github/workflows/windows-advisory.yml: ok
bun test test/github/ci-workflow.test.ts test/github/bun-version-workflow.test.ts (in packages/opencode): 19 pass, 0 fail, 304 expect() calls
Self-test substrings preserved: '${{ matrix.command }}', 'echo "exit_code=$status"', '### Windows unit diagnostic', 'failed advisory signal' — all still present
CI on this PR: windows-advisory run #26758835117 currently in_progress; will exercise the new retry path

Screenshots or Recordings

N/A — CI workflow change, no UI surface.

Checklist

  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

The windows-advisory workflow has shown ~40% red over the last ten runs
on dev, driven by two transient failure modes that are not regressions
from the merged PR:

- Effect-TS sleep-based timing assertions in opencode session tests
  (e.g. SessionRunState defers disposeAll) that flake on the Windows
  runner's coarser wall clock.
- Native Bun crashes on windows-latest (segfault in watcher.node frames
  in #1028's run), independent of test content.

Linux ci is the load-bearing required gate; this workflow is advisory
and non-blocking. Wrap each matrix shard's unit step in a process-level
retry (max_attempts=2) so a single transient failure does not turn the
advisory red. Keep the first-attempt failure visible in the step summary
("Windows unit attempt 1 failed (retrying)" / "Windows unit recovered on
retry") so persistent regressions are not hidden by the retry.

Each attempt runs in a subshell so cd packages/... in matrix.command does
not leak across attempts. No third-party retry action — the repo pins
all action uses by SHA and a small bash loop avoids an extra dependency.
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Astro-Han, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 21 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e3aecbb3-e59f-40f2-ba89-2f92a1b54d93

📥 Commits

Reviewing files that changed from the base of the PR and between 973943b and f9a2c65.

📒 Files selected for processing (2)
  • .github/workflows/windows-advisory.yml
  • packages/opencode/test/github/ci-workflow.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/windows-advisory-retry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the ci Continuous integration / GitHub Actions label Jun 1, 2026
@Astro-Han Astro-Han added enhancement New feature or request ci Continuous integration / GitHub Actions windows Windows-specific P3 Low priority labels Jun 1, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested priority: P3 (only low-risk paths changed (.github/workflows/windows-advisory.yml)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

Address review feedback: the new retry semantics on the windows-advisory
unit step had no self-test fixation, so future changes to the retry
count, exported first-attempt exit code, or recovery-summary headers
could silently regress without breaking ci-workflow.test.ts.

Add a focused "retries the Windows unit step once on transient failure"
test that pins:

- attempts=2 (single retry budget)
- ( ${{ matrix.command }} ) subshell so cd does not leak between attempts
- first_exit_code GITHUB_OUTPUT export
- First-attempt failure summary header and recovery summary header
- Final exit uses the last attempt's status, not the first
@github-actions github-actions Bot added the harness Model harness, prompts, tool descriptions, and session mechanics label Jun 1, 2026
Address review feedback: recovery from a retry currently only writes a
step-summary header, so the first-attempt failure is easy to miss when
scanning the PR checks list or the run's annotations panel — making the
advisory's true flake rate hard to track.

Emit a GitHub Actions workflow command on the two terminal outcomes of
the retry loop:

- `::notice title=Windows unit recovered on retry::...` when attempt 1
  failed but attempt 2 succeeded. Surfaces in the run-level annotations
  panel and per-check annotation list — observable without expanding the
  step summary.
- `::warning title=Windows unit failed advisory signal after retry::...`
  when both attempts failed. The advisory still goes red on this path,
  but the warning annotation makes the post-retry failure scannable
  alongside the run-level red icon.

Update ci-workflow.test.ts to pin both annotation strings, so future
edits to the retry contract cannot silently drop them.
@Astro-Han
Astro-Han merged commit 0b87381 into dev Jun 1, 2026
33 checks passed
@Astro-Han
Astro-Han deleted the claude/windows-advisory-retry branch June 1, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration / GitHub Actions enhancement New feature or request harness Model harness, prompts, tool descriptions, and session mechanics P3 Low priority windows Windows-specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant