chore(opencode): retry a failed test twice so CI stops failing on runner speed
Makes the fork's tests retry a failure twice before failing, so a PR stops going red on tests that only lost a race with the clock.
Symptom
The test job in fork-ci fails on unchanged code. On 2026-11-13, dev at 235aa91 passed once and failed once, and #74 at one commit failed three times and then passed. Earlier examples: dev on Sep 27 and Oct 15, cutoff-step-retry on Oct 14.
Four different tests account for those failures, and none of them failed on a wrong result:
opencode run (non-interactive subprocess): a spawned CLI did not finish inside its 30-second budget (expected exit 0, got -1 after 30280ms, stderrError: Timed out). The tests in that file run concurrently, so several CLI processes boot at once.configured chunkTimeout raises a retryable response stream error when SSE body stalls: a 50 ms timeout has to fire before a 250 ms response body, and did not.session.processor effect tests mark pending tools as aborted on cleanup: interrupted after 21 seconds.
Cause
These tests depend on wall-clock time, and GitHub-hosted runners vary. The Test packages/opencode step takes 354ā545 seconds on passing runs and 493ā758 seconds on failing ones, with each test file starting about 1.5Ć later from the first minute of a slow run.
Fix
packages/opencode/bunfig.toml sets retry = 2 for bun test. Bun retries a failing test up to twice; a test that fails three times in a row still fails.
It is set in the package's config file, so it applies to bun test on a laptop as well as in CI. A CI-only version would be a --retry=2 flag in fork-ci.yml; that needs a GitHub token with the workflow scope to push, which the one used here does not have.
Not done here: widening each test's time budget, or running the subprocess tests one at a time. Those remove the cause for the tests we know about, but there are at least four of them across three files, and the next one would fail the same way.
Trade-off
A test that genuinely fails one time in three now passes, locally and in CI. That is the cost of not having every PR depend on runner speed.
Tests
Checked in packages/opencode with bun 1.3.14 through bun run test: a test written to fail on its first run and pass on its second now passes, and a test that always fails still fails after its third attempt. This PR's own fork-ci run is the check on the hosted runners.
š¤ Generated with Claude Code
Summary by cubic
Fixes flaky CI failures in packages/opencode tests that race wall-clock time on slow GitHub-hosted runners.
Sets retry = 2 in packages/opencode/bunfig.toml so bun test retries a failing test twice before giving up. Several tests depend on timing (a 30-second budget for a spawned CLI, a 50ms stream timeout) and lose the race on loaded runners, failing unchanged code. A test that fails three times in a row still fails.