test(opencode/run): skip Windows-only scrollback replay failure#28261
Open
kitlangton wants to merge 1 commit into
Open
test(opencode/run): skip Windows-only scrollback replay failure#28261kitlangton wants to merge 1 commit into
kitlangton wants to merge 1 commit into
Conversation
The "renders replayed user, reasoning, and assistant output after
completion" test reliably fails on Windows CI while passing on Linux
and macOS, blocking unrelated PRs behind branch protection.
The failure is in the streaming CodeRenderable path: a reasoning commit
becomes a `<code filetype="markdown" streaming drawUnstyledText={false}>`
renderable, whose `set content` short-circuits the textBuffer update
during streaming and relies on the next highlight cycle to populate it.
On Windows the first paragraph (`_Thinking:_ **Plan**`) is missing from
the committed rows after `settle()`; on Linux (where `useThread` is
forced off in `@opentui/core/testing`) and macOS the rows commit
correctly.
Skipping the case on `win32` with an inline investigation summary so the
next person can pick this up without redoing the trace. The assertion
still runs on Linux and macOS CI.
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.
Summary
scrollback.surface.test.ts > "renders replayed user, reasoning, and assistant output after completion"fails reliably on Windows CI while passing on Linux and macOS. It blocks every unrelated PR through branch protection (most recently seen on #28253). Skipping the case onwin32unblocks the queue without dropping coverage on the other two platforms.The test assertion
expect(output).toContain("Thinking:")fails on Windows; the received string is"› Hello you\nSay hello.\n\nHello."— only the second paragraph of the reasoning body survives. The first paragraph (_Thinking:_ **Plan**) never makes it into the committed rows.Investigation
The reasoning input flows through:
entry.body.tsreasoningBody()rewrites"Thinking: …"to"_Thinking:_ …"and returns acodebody withfiletype="markdown".RunScrollbackStream.writeStreamingcreates aCodeRenderablewithstreaming: true,drawUnstyledText: false,filetype: "markdown".flushActive(false, false),renderable.content = active.contentis set.CodeRenderable.set contentshort-circuits in this combination — it does not calltextBuffer.setText(value)while streaming, relying on the nextstartHighlight()cycle to populate the buffer.await active.surface.settle()renders the surface, kicks offstartHighlight()viarenderSelf, awaitshighlightingDone, and re-renders. WithMockTreeSitterClientreturning{ highlights: [] }, control reaches theelse this.textBuffer.setText(content)branch instartHighlight()and sets_shouldRenderTextBuffer = true.flushActivethen commits rows[0, surface.height - 1)while streaming.On Windows the row commit emerges without the first paragraph. Linux uniquely forces
useThread = falsein@opentui/core/testing(seetesting.jsline ~540), so it serializes the FFI render thread and never trips this race. macOS happens to be timing-stable despiteuseThread = true. Windows is not. The smoking gun is most likely either Bun's microtask scheduling on Windows or a Zig-side threading interaction during the secondrenderSurface()pass insidesettleSurface. A real fix probably belongs in opentui — either forceuseThread = falsefor testing on Windows, or eagerly calltextBuffer.setTextinCodeRenderable.set contentwhen streaming updates a non-empty body.I spent ~1 hour tracing the streaming path through
CodeRenderableandScrollbackSurface.settle(@opentui/core/index-*.js), with a local repro that produced the expected output on macOS. Going further into the Zig/FFI render path felt out of scope for a CI-unblock change, so this PR applies the fallback discussed in the task brief:test.skipIf(process.platform === "win32")with a detailed inlineTODO(windows)summarising what's been ruled in/out.What changed
packages/opencode/test/cli/run/scrollback.surface.test.ts: wrap the one failing case intest.skipIf(process.platform === "win32")(...)and prepend a detailed investigation comment for the next person.The other 12 cases in this file (which all rely on the same rendering machinery but don't hit this exact streaming-code path) continue to run on every platform.
Test plan
bun run test test/cli/run/scrollback.surface.test.ts— 13 pass / 0 fail on macOS (the skipped case still executes here becauseprocess.platform !== "win32").bun run typecheck— clean.