Skip to content

fix(test): make unit (windows) green — routing case-sensitivity, path variants, timeouts (LAC-2693) - #35

Merged
lacymorrow merged 6 commits into
LAC-2385/blacksmith-to-github-runnersfrom
LAC-2693/fix-windows-ripgrep-test-timeouts
Jul 10, 2026
Merged

fix(test): make unit (windows) green — routing case-sensitivity, path variants, timeouts (LAC-2693)#35
lacymorrow merged 6 commits into
LAC-2385/blacksmith-to-github-runnersfrom
LAC-2693/fix-windows-ripgrep-test-timeouts

Conversation

@lacymorrow

@lacymorrow lacymorrow commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes LAC-2693 — the unit (windows) job failures surfaced by the GitHub-hosted runner switch (PR #28). Sibling of PR #33 (linux).

The original 112 failures reduced to 11 after PR #33's fixture fix + the ripgrep timeout fix here. This PR clears the rest:

Product fixes

  • shell-mode cwd sentinel guard (plugin/shell-mode/cwd.ts): a shell that doesn't understand the sentinel wrapper (e.g. cmd.exe echoing $(pwd -P ...) literally) poisoned the process-wide cwd singleton, cascading into dozens of tool.shell failures. Sentinel payloads are now parsed/validated in parseCwdSentinelPayload() — non-absolute paths are rejected. Regression tests added.
  • auto-routing case sensitivity (plugin/shell-mode/command-check.ts): Windows PATH lookup is case-insensitive, so "Help me fix this bug" matched System32\help.exe and routed to shell instead of the agent. commandExists now requires the typed name to match the executable's on-disk casing on win32, restoring the POSIX capitalization signal.

Test fixes

  • cwd.test.ts: platform-aware path expectations (/workspace/subdir vs D:\workspace\subdir).
  • external-directory.test.ts / read.test.ts: keep the drive letter when building the "alt" path variant — a drive-less absolute path resolves against the current drive, which differs from TEMP's drive on GitHub-hosted runners (repo on D:, TEMP on C:).
  • httpapi-file / httpapi-sdk: extend the 5s search-index poll to 30s (index build regularly exceeds 5s on windows runners).
  • prompt.test.ts loop/shell tests: raise 10s per-test timeouts to 30s (git-fixture boot + shell spawn exceed 10s on windows).
  • ripgrep tests: 120s timeout for tests that download the rg binary.

CI fix

  • test.yml: unit-test step timeout-minutes 20 → 35. opencode#test alone takes ~20 min on GitHub-hosted windows runners; the step timed out before turbo flushed results (which is why the last run looked like a silent hang).

Testing

  • Locally (macOS): typecheck green; affected suites pass (98 + 57 + 9 tests).
  • Windows verification is via the unit (windows) check on this PR.

Acceptance criteria

  • unit (windows) job reaches success — verified by this PR's checks
  • No skipped-en-masse tests — all real fixes; per-test timeout raises are documented inline with LAC-2693 references

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request increases the test timeout to 120 seconds for Ripgrep-related tests in both search.test.ts and ripgrep.test.ts. This adjustment prevents test failures on Windows CI runners where downloading and extracting the rg binary can exceed the default 5-second timeout. No review comments were provided, so there is no additional feedback to address.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@lacymorrow lacymorrow changed the title fix(test): extend timeout for ripgrep tests that download the rg binary (LAC-2693) fix(test): make unit (windows) green — routing case-sensitivity, path variants, timeouts (LAC-2693) Jul 10, 2026
lacymorrow and others added 6 commits July 10, 2026 02:52
…ry (LAC-2693)

On Windows CI runners the first Ripgrep.Service use downloads the rg
release zip and extracts it via PowerShell Expand-Archive, which exceeds
bun's default 5s per-test timeout. The test SIGTERMs the extraction
mid-flight, nothing is cached, and all four ripgrep tests repeat the
slow path and fail. Give those tests a 120s timeout so the one-time
download completes; later tests find the cached binary and stay fast.
…templates (LAC-2693)

On Windows, a shell that does not understand the sentinel wrapper echoes
it literally (e.g. cmd.exe printing "$(pwd -P ..."). That text reached
setCwd() unvalidated, poisoning the process-wide cwd singleton so every
subsequent spawn failed its cwd access check — the shared root cause
behind the ~60 tool.shell failures in the unit (windows) job.

- Extract sentinel parsing into parseCwdSentinelPayload() in the
  shell-mode plugin (lash-owned, keeps the prompt.ts patch surface small)
  and reject any cwd that is not an absolute posix or win32 path.
- Treat a non-numeric exit-code prefix as part of the cwd so bare
  "D:\foo" drive paths parse correctly.
- Make cwd.test.ts expectations platform-aware: on win32,
  path.resolve("/workspace", "subdir") yields "D:\workspace\subdir",
  so the hardcoded posix strings failed regardless of fixtures.
- Add LAC-2693 regression tests for the parser.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
…LAC-2693)

Fixes the 7 failures left after the cwd-sentinel fix, plus the job-level
timeout that masked them:

- shell-mode routing: Windows PATH lookup is case-insensitive, so
  "Help me fix this bug" matched System32 help.exe and routed to shell.
  commandExists now requires the typed name to match the executable's
  on-disk casing on win32, restoring the POSIX capitalization signal
  (fixes shouldRouteToShell / determineRouting / prompt-submit-routing).
- external-directory + read path-variant tests: stop stripping the drive
  letter when building the "alt" variant — a drive-less absolute path
  resolves against the current drive, which differs from TEMP's drive on
  GitHub-hosted runners (repo on D:, TEMP on C:).
- httpapi file/sdk search polls: extend the 5s index-ready poll to 30s;
  index build regularly exceeds 5s on windows runners.
- prompt loop/shell tests: raise 10s per-test timeouts to 30s; git-fixture
  boot + shell spawn exceed 10s on windows.
- test.yml: raise unit-test step timeout-minutes 20 -> 35; opencode#test
  alone takes ~20 minutes on GitHub-hosted windows runners, so the step
  timed out before results could flush.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
…p exit tests (LAC-2693)

- httpapi-file 'serves search endpoints': the suite-wide --timeout 30000
  fired before the 30s index-ready poll could complete; give the test a
  90s per-test timeout and a 60s poll window
- acp lifecycle 'stdin EOF exits cleanly': 5s exit window is tighter than
  the CLI's bun startup on windows CI; raise to 30s (test allows 60s)
…693)

Run 29066011464 surfaced a new flake cluster after the previous two fixes
held: all three trace to network/subprocess work on a cold, loaded runner.

- test.yml: cache ~/.cache/opencode/bin so the rg binary downloads once
  per version instead of on every run (the 120s ripgrep test timeout was
  blown by download + Expand-Archive alone)
- ripgrep.test.ts: raise download budget to 240s for cache-miss runs
- project.test.ts: 30s timeout on all ProjectV2.resolve tests; each
  spawns several git subprocesses and two blew the 5s default
- instance-bootstrap.test.ts: 120s timeout; bootstrapFixture's plugin
  triggers a real background npm install of @opencode-ai/plugin that
  Config.waitForDependencies joins
…oads (LAC-2693)

Run 29067707495 failed a single test: 'file HttpApi > serves search
endpoints' — the find() index stayed empty through the full 60s poll even
though a foreground rg grep in the same test completed in ~1s. Windows
uses the ripgrepLayer (fff is disabled on win32 by default), whose index
is filled by a background rg --files fiber forked with a bare orDie: any
transient spawn failure or hang on a loaded runner kills it silently and
leaves find() permanently empty.

- search.ts: bound each scan attempt to 120s, retry twice, and log a scan
  that never completes instead of dying silently; dedupe entries so a
  retried scan cannot double-add what an interrupted attempt indexed
- test/preload.ts: seed the per-PID temp cache with the rg binary from
  the user's real cache (which CI now restores via actions/cache) so
  opencode tests stop re-downloading rg mid-suite on every run
@lacymorrow
lacymorrow force-pushed the LAC-2693/fix-windows-ripgrep-test-timeouts branch from 9906eab to cf47752 Compare July 10, 2026 06:54
@lacymorrow
lacymorrow merged commit 1ad5eed into LAC-2385/blacksmith-to-github-runners Jul 10, 2026
6 checks passed
@lacymorrow
lacymorrow deleted the LAC-2693/fix-windows-ripgrep-test-timeouts branch July 10, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant