Skip to content

test(cli): gate worker restart RPC assertions on worker readiness (#873) - #874

Merged
agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
fix/worker-readiness-873
Nov 27, 2026
Merged

agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
fix/worker-readiness-873

Conversation

@agenteinstinct1-max

Copy link
Copy Markdown
Collaborator

Issue for this PR

Fixes #873

Type of change

  • Bug fix (test hardening)

What does this PR do?

Readiness hardening for the worker crash/restart RPC test — not a proven Windows fix (see verification honesty note below).

test/cli/worker-process.integration.test.ts — the test "rejects a stranded RPC across a crash and serves new calls after restart" issued its post-restart callWorkSoon against the respawned worker before that worker announced application-level readiness. The host's own contract (waitForRestart in worker-process.ts) documents that restart completion is not readiness. On a loaded runner the replacement worker's boot can consume the 5s callWorkSoon retry budget before it is serving, failing the assertion at line 169 — the failure observed on Windows CI in #871's earlier head.

The change chains the worker's onmessage handler (the RPC client remains the handler owner; the worker's "ready" announcement is a non-JSON string the RPC handler ignores, so the chain only observes) and gates both phases on the announcement: waitForCount(ready, 1) before the first callWorkSoon, and waitForCount(ready, readyBefore + 1) after the bounded restart — mirroring the sibling "communicates over real Bun IPC" test, which already uses this exact pattern.

Only the test file changes (+16/-0). No source, no workflow, no timeout or budget changes: the bounded 15s, waitForCount 5s and the 5s RPC retry budgets are all preserved, and the crash / stranded-RPC / restart assertions are untouched. The failure stays bounded and loud: waitForCount throws with a clear message at its deadline.

How did you verify your code works?

  • Independent review of the exact patch (sha256 87a0d5a38c76213b89a24b66bb2407638b30a6b26ac22334ee4580f7a69bf06b, post-image blob c94b59b3f3ef7057259e231f9373f3697f2665a0): handler chaining, RPC ownership, and the host's documented readiness contract verified against source; test contract preserved, not loosened.
  • Local, Bun 1.3.14 (same as CI): 9/9 tests in the file pass per run; 6/6 patched runs green (3 normal + 3 under CPU starvation from 6 CPU hogs on a 2-core box); plus 2/2 green runs on the rebased branch before opening this PR.
  • Honesty note: the original failure could not be reproduced locally — on Linux the replacement worker boots well under 5s even under CPU starvation, and the unpatched test also passed 3/3 under the same load. The patch makes the test strictly more deterministic (gating on readiness instead of racing the boot), but causal effectiveness on Windows CI remains a hypothesis until this PR's Windows run: the 5s window is plausibly exceeded only under Windows CI conditions (bun spawn + Defender scanning + shared runner). This is consistent with fix(provider): parse Pollinations reasoning and tool calls #867 (six worker/subprocess-family failures on Windows) and feat(tui): sort pinned models by health status #869 (same code fully green) being load-dependent.

Screenshots / recordings

N/A — test-only change.

Checklist

  • I have tested my changes locally

The stranded-RPC crash/restart test issued callWorkSoon against the
respawned worker before it announced application-level readiness,
letting slow worker boot consume the 5s retry budget on loaded
runners (observed on Windows CI). Chain the message handler so the
test can observe the worker's "ready" announcement and gate both
phases on it, mirroring the sibling IPC test. Assertions and all
budgets unchanged.

Refs #873
@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot

kilo-code-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/opencode/test/cli/worker-process.integration.test.ts

Reviewed by free · Input: 41.4K · Output: 5K · Cached: 159.7K

@agenteinstinct1-max
agenteinstinct1-max merged commit 3da60f5 into dev-vibecoded Nov 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant