Skip to content

AOT/runtime: verify the three Worker entrypoints of OpenCode v1.18.30 end-to-end (TUI server worker, OpenTUI parser worker, thread-stream) #10103

Description

@proggeramlug

Parent: #10107. Closes the unticked acceptance boxes of #8509 ("OpenCode's TUI worker starts, serves requests, reloads, and terminates cleanly"; "parser/diff worker smoke tests").

Facts

  1. TUI server workerpackages/opencode/src/cli/cmd/tui.ts:210-214: new Worker(file, { env: Object.fromEntries(...) }) where file = await target() (tui.ts:52-56: define OPENCODE_WORKER_PATH else new URL("../tui/worker.ts", import.meta.url)). Entry packages/opencode/src/cli/tui/worker.ts. Parent talks over Rpc.client<typeof rpc>(worker) (structured-clone messages), client.call("reload") on SIGUSR2 (tui.ts:216-220), client.call("shutdown") + worker.terminate() on stop (tui.ts:224-230). The worker hosts the whole server/session runtime (Effect, sqlite, providers) — i.e. most of the graph executes on the worker thread.
  2. OpenTUI tree-sitter worker@opentui/core/chunk-bun-t2myhmwd.js:8398 new Worker(workerPath) with workerPath from define OTUI_TREE_SITTER_WORKER_PATH else import.meta.resolve("@opentui/core/parser.worker") (:8464). Entry @opentui/core/parser.worker.js (Emscripten loader + grammars, runtime/AOT (refines #8508): Emscripten main+side-module loading (web-tree-sitter + grammars) and wasm-bindgen (photon) for OpenCode v1.18.30 #10102). Inside the worker the code uses node parentPort from node:worker_threads (parser.worker.js:3621, chunk:8203) while the parent uses the Web Worker API: both shapes must interoperate.
  3. thread-stream (thread-stream/index.js:72, pino transport) — only on the GitLab login path via fastify; low priority.
    Also: write-file-atomic only reads worker_threads.isMainThread; source-map-support checks isMainThread (Code Mode path).

Scope

Acceptance

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvementparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions