Repository navigation
fix: eliminate flaky CI races - #43522
Merged
Merged
Conversation
kitlangton
enabled auto-merge (squash)
August 19, 2026 22:06
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Eliminate the reproducible CI races found across the last two days of V2 test runs and a full local stress pass.
Fixes #37321.
Before / After
Before: Local plugin reload hashed a file and imported it in two separate reads. An in-place save could expose transient bytes to the hash and completed bytes to the import, assigning one module several generations and repeatedly cycling setup/cleanup. Other tests treated path existence as readiness, inherited ambient V2 state, relied on fixed wall-clock sleeps, force-killed subprocesses before deleting their directories, or put real Git/process integration work under Bun's five-second default.
After: Plugin setup runs only when the generation still matches after import. Subprocesses own isolated state and shut down normally before cleanup. Readiness waits for actual content, and only the integration cases proven too expensive on loaded Windows runners receive explicit 15-second budgets. Tests that only exercised timers, fixtures, test literals, or duplicate protocol paths are removed.
How
packages/tui/src/plugin/context.tsxverifies the content generation after dynamic import and re-resolves when an in-place write crossed the hash/import boundary.packages/tui/test/plugin-hot-reload.test.tsxdeterministically pauses an import, rewrites the entrypoint, and proves only the final generation activates.packages/cli/src/services/service-registration.tsextracts the unchanged managed-service lease so stale registration replacement can be tested without booting a full CLI process.Scope
SIGSEGVexits are not hidden with suite retries. They had no stable assertion-level reproduction or repository seam in the audited runs.Testing
bun run testinpackages/tui: 728 pass, 5 skipbun run testinpackages/core: 1881 pass, 16 skipbun run testinpackages/cli: 205 passbun typecheckinpackages/tui,packages/core, andpackages/cliFlow
flowchart LR A[Watcher observes local plugin] --> B[Hash source generation] B --> C[Import generation URL] C --> D{Source generation unchanged?} D -- no --> B D -- yes --> E[Validate plugin] E --> F[Activate exactly once]