Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/opencode/test/cli/worker-bootstrap-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ worker.addEventListener("error", (event) => {
let requestId = 0
const deadline = Date.now() + windowMs
while (Date.now() < deadline && !sawSnapshot && !error) {
worker.postMessage(JSON.stringify({ type: "rpc.request", id: ++requestId, method: "snapshot", input: undefined }))
try {
worker.postMessage(JSON.stringify({ type: "rpc.request", id: ++requestId, method: "snapshot", input: undefined }))
} catch {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Empty catch swallows every exception thrown by postMessage, not just the expected InvalidStateError from a self-exited worker. An unrelated failure (e.g. serialization error) would be misreported as RESULT:none. Consider checking the error type or rethrowing unexpected errors.

// A worker that exited on its own (no launch marker) rejects postMessage:
// that is the "never booted" outcome this probe reports as RESULT:none.
break
}
// Wait for the thread to handle the request and write the snapshot file.
for (let i = 0; i < 20; i++) {
await new Promise((resolve) => setTimeout(resolve, 100))
Expand Down
Loading