Commit Graph

255 Commits

Author SHA1 Message Date
Kit Langton cb588ab4b9 fix(bus): acquire PubSub subscription eagerly to close /event race
`bus.subscribe(def)` and `bus.subscribeAll()` previously returned a
`Stream` whose underlying `PubSub.subscribe` ran lazily on first pull
(via `Stream.unwrap`). When a Stream was built in one place and consumed
in another — e.g. the `/event` SSE handler, which returns the stream
inside `HttpServerResponse.stream` for the body-pump fiber to consume
later — any publish in the hand-off window was lost.

The `/event` handler's `Stream.concat(server.connected, events)` shape
made this concrete: the events stream's PubSub.subscribe was only run
*after* `server.connected` was emitted and flushed to the socket, so
publishes that landed between the client receiving `server.connected`
and the body-pump fiber pulling from `events` were silently dropped.
SDK consumers (`client.event.subscribe()`, the Slack bot,
`opencode run --attach`) hit this routinely because they typically
subscribe and then trigger something that publishes (e.g.
`sdk.part.update`).

Change the bus interface so subscribe / subscribeAll return
`Effect<Stream, never, Scope>`. The subscription is now acquired
eagerly when the caller yields the effect, lives in the caller's
scope, and is released by the scope's finalizer. Any publish after
`yield*` is buffered into the subscription queue regardless of when
the consumer activates.

Migrated callers:
- /event handler (handlers/event.ts)
- plugin/index.ts
- project/project.ts
- project/vcs.ts
- share/share-next.ts

Regression tests added:
- test/bus/bus-effect.test.ts — 3 unit tests for eager subscribe,
  including the /event-shape Stream.concat pattern.
- test/server/httpapi-event-diagnostics.test.ts — 7 diagnostic
  tests (D1-D7) isolating each variable in the publisher chain. D7
  (no-op AppRuntime warmup) is the smallest regression trigger.
- test/server/httpapi-sdk.test.ts — end-to-end SDK subscription
  through /event during a sync.run-driven publish.
2026-05-16 22:32:55 -04:00
Kit Langton 5911bd532d fix(tui): show config error details on startup (#27803) 2026-05-15 20:42:56 -04:00
Shoubhit Dash 0c9cfe923f refactor(instance): remove legacy runtime fallback (#27757) 2026-05-15 23:05:44 +05:30
Dax e11e089e42 Add Effect-native core event system (#27415) 2026-05-15 00:50:23 +00:00
Kit Langton 195f592640 refactor(server): simplify listener lifecycle (#27413) 2026-05-15 00:00:52 +00:00
Shoubhit Dash d35e09f1fc test(workspace): use runtime flags in workspace tests (#27612) 2026-05-15 04:19:39 +05:30
Shoubhit Dash 43310f4d8c refactor(flags): move embedded web ui flag to runtime flags (#27613) 2026-05-15 03:51:29 +05:30
Kit Langton d353a6bc24 fix(worktree): accept missing create payload (#27582) 2026-05-14 14:25:22 -04:00
Shoubhit Dash 22de34c4de feat: add experimental background subagents (#27084) 2026-05-14 22:10:15 +05:30
Shoubhit Dash 27ac53aaac fix(server): stop exposing named defects (#27471) 2026-05-14 12:51:05 +05:30
Aiden Cline c50d2b3656 Refactor event HTTP API route modules (#27441) 2026-05-13 22:41:17 -05:00
Kit Langton cda8cc7285 test(httpapi): simplify event stream regression coverage (#27427) 2026-05-14 02:18:40 +00:00
Kit Langton b928a1fff9 fix(httpapi): preserve event stream context (#27425)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Co-authored-by: James Long <longster@gmail.com>
2026-05-13 22:02:30 -04:00
Kit Langton e5319846ad test(server): migrate pty websocket input test (#27348) 2026-05-13 15:43:09 +00:00
Shoubhit Dash eed0eddc63 refactor(flags): route session workspaces through runtime flags (#27335) 2026-05-13 20:14:40 +05:30
Dax 8345152319 core: expose v2 model listing API (#25821) 2026-05-13 14:43:08 +00:00
Shoubhit Dash 5b2b300602 fix(session): tighten http error contracts (#27308) 2026-05-13 16:48:18 +05:30
Shoubhit Dash 809af5c590 fix(provider): type auth errors (#27301) 2026-05-13 15:47:13 +05:30
Shoubhit Dash 2e7cf92c8b fix(worktree): type expected errors (#27296) 2026-05-13 15:05:30 +05:30
Shoubhit Dash 4b041716fc fix(server): remove storage not found defect fallback (#27287) 2026-05-13 14:15:53 +05:30
Shoubhit Dash f01c6b3e37 fix(session): type message list not found errors (#27275) 2026-05-13 13:22:12 +05:30
Shoubhit Dash 90c13d93f3 fix(server): hide unknown 500 details (#27251) 2026-05-13 10:15:28 +05:30
opencode-agent[bot] 784796e27a chore: generate 2026-05-13 03:14:19 +00:00
Kit Langton 913ea36ae6 test(server): scope MCP HttpApi handler (#27226) 2026-05-13 03:13:05 +00:00
Kit Langton 6d3b2fe08b test(server): stabilize SDK project skill prompt test (#27239) 2026-05-13 03:01:29 +00:00
Kit Langton 8370d0cef4 test(server): migrate httpapi ui tests to effect runner (#27236) 2026-05-13 02:55:36 +00:00
Kit Langton 0b67e1a046 test(server): migrate session messages to Effect runner (#27234) 2026-05-13 02:55:33 +00:00
Kit Langton 485ecbde18 test(server): migrate global session list to effect runner (#27233) 2026-05-13 02:52:59 +00:00
Kit Langton 588b5240d0 test(server): migrate worktree endpoint repro to effect runner (#27220) 2026-05-13 02:43:41 +00:00
Kit Langton 91a9514ed0 test(server): use AppFileSystem in provider tests (#27227) 2026-05-13 02:32:30 +00:00
Kit Langton 0879f5e22d test(server): migrate project init git test to Effect runner (#27218) 2026-05-13 02:08:55 +00:00
Kit Langton a26a2a95bd test(server): migrate provider httpapi test to effect runner (#27216) 2026-05-13 02:05:52 +00:00
Kit Langton 7f9268f147 test(server): migrate global bus helper to Effect (#27214) 2026-05-13 02:04:46 +00:00
Kit Langton 5c7af682b9 test(server): migrate MCP HTTP API test to Effect runner (#27213) 2026-05-13 02:03:52 +00:00
opencode-agent[bot] c9df833d2c chore: generate 2026-05-13 01:45:20 +00:00
Kit Langton d1356f509e test(server): migrate HTTP API SDK test to Effect runner (#27208) 2026-05-13 01:43:35 +00:00
Kit Langton 4d9c675b00 test(server): migrate httpapi session test to effect runner (#27207) 2026-05-13 01:40:25 +00:00
Kit Langton 604de70689 test(server): migrate experimental HttpApi test to Effect (#27204) 2026-05-13 01:40:07 +00:00
opencode-agent[bot] 673226d214 chore: generate 2026-05-13 01:39:46 +00:00
Kit Langton 2447f42294 test(server): migrate session select to effect runner (#27203) 2026-05-13 01:38:38 +00:00
Kit Langton 8310e7df70 test(server): migrate missing patch diff test (#27202) 2026-05-13 01:37:34 +00:00
opencode-agent[bot] 937a3c10b3 chore: generate 2026-05-12 23:49:28 +00:00
Kit Langton 9c54255aeb fix: migrate sync http api test to effect runner (#27175) 2026-05-12 23:47:14 +00:00
Kit Langton b0674b473f test: migrate session action route to effect runner (#27174) 2026-05-12 23:46:51 +00:00
Kit Langton 2c334d9242 Migrate schema error body tests to Effect runner (#27172) 2026-05-12 23:46:19 +00:00
Kit Langton 2017dc165c test: migrate negative tokens regression to Effect runner (#27141) 2026-05-12 20:32:23 +00:00
opencode-agent[bot] 0ce614a280 chore: generate 2026-05-12 16:46:35 +00:00
Kit Langton e8125e9b42 test(server): migrate session list tests to Effect runner (#27101) 2026-05-12 16:45:05 +00:00
Kit Langton cc95197d72 Drop prompt input Zod statics (#26923) 2026-05-11 16:49:08 -04:00
Kit Langton c7e084c32c Simplify single-backend HttpApi exerciser (#26906) 2026-05-11 13:22:31 -04:00