You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 Fix init events race condition by awaiting hook start
Root cause: workspace.create returned before init hook started, causing
race between event emission and frontend subscription. Early events were
lost (emitted before IPC listener registered).
Solution: Refactor runWorkspaceInitHook → startWorkspaceInitHook (async)
and await it in workspace.create. Now:
1. Create workspace metadata
2. Call startInit() to create in-memory state
3. Return from workspace.create (frontend can now subscribe)
4. Init hook process runs async (emits events to subscribed frontend)
This guarantees:
- In-memory state exists before workspace.create returns
- replayInit() always finds state (no empty replay)
- All init events have active subscription (none lost)
- Fast: only waits for hook to START (~instant), not complete
Live streaming and replay now produce identical UI states.
Net change: ~10 LoC (refactor fire-and-forget to async/await)
0 commit comments