Skip to content

[codex] Fix workspace synchronization#1544

Merged
oscharko merged 1 commit into
devfrom
codex/fix-workspace-sync
Jun 26, 2026
Merged

[codex] Fix workspace synchronization#1544
oscharko merged 1 commit into
devfrom
codex/fix-workspace-sync

Conversation

@oscharko

Copy link
Copy Markdown
Contributor

Summary

Fixes #1540 by synchronizing the desktop workspace state across open Keiko clients.

Root Cause

The workspace hook hydrated and persisted windows/connections through browser-local localStorage, but it did not subscribe to changes written by another tab. Because localStorage is browser-local, a second browser also had no shared source of truth and could show the empty workspace while another browser had active windows.

Changes

  • Added a bounded local BFF workspace-state snapshot endpoint at GET/PUT /api/workspace/state.
  • Updated useWorkspace to:
    • adopt storage events from other tabs in the same browser profile,
    • publish sanitized workspace snapshots to the local BFF,
    • poll and adopt newer BFF snapshots from other browsers,
    • avoid echoing remote snapshots back as new local writes.
  • Added regression coverage for cross-tab adoption and the server snapshot endpoint.

Validation

  • npm run build:packages
  • npm test --workspace @oscharko-dev/keiko-ui -- useWorkspace.keyboard.test.tsx workspace-persistence.test.ts
  • npm run typecheck --workspace @oscharko-dev/keiko-ui
  • npx vitest run packages/keiko-server/src/routes.test.ts packages/keiko-server/src/server.test.ts
  • npx prettier --check packages/keiko-ui/src/app/components/desktop/hooks/useWorkspace.ts packages/keiko-ui/src/app/components/desktop/hooks/useWorkspace.keyboard.test.tsx packages/keiko-server/src/routes.ts packages/keiko-server/src/server.test.ts packages/keiko-server/src/workspace-state-handlers.ts

@oscharko oscharko force-pushed the codex/fix-workspace-sync branch 2 times, most recently from 20a6c50 to dc23534 Compare June 26, 2026 09:05
@oscharko oscharko enabled auto-merge (squash) June 26, 2026 09:06
@oscharko oscharko force-pushed the codex/fix-workspace-sync branch from dc23534 to 45238d7 Compare June 26, 2026 09:15
@oscharko oscharko merged commit 1224b40 into dev Jun 26, 2026
13 checks passed
@oscharko oscharko deleted the codex/fix-workspace-sync branch June 26, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[User Finding]: Workspace unsynchronized

1 participant