Skip to content

feat(app): sync session groups server-side#2226

Merged
src-opn merged 5 commits into
devfrom
server-side-groups
Jun 13, 2026
Merged

feat(app): sync session groups server-side#2226
src-opn merged 5 commits into
devfrom
server-side-groups

Conversation

@src-opn

@src-opn src-opn commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Store session groups and assignments server-side in the runtime SQLite DB
  • Add session group APIs plus update events so clients can sync group state
  • Add client-side migration from existing local group state and show "Create a Group" next to "Show x more" when no groups exist

Tests

  • pnpm --filter openwork-server test src/session-groups.e2e.test.ts
  • pnpm --filter openwork-server typecheck
  • pnpm --filter @openwork/app typecheck
  • Manual desktop smoke: ran pnpm dev from the worktree with Electron CDP on http://127.0.0.1:9830; verified migration PUT, session-groups/events polling, "Show 2 more ⋅ Create a Group", creating a Test Group, and server persistence/events in the UI

Review in cubic

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jun 13, 2026 12:30pm
openwork-den Ready Ready Preview, Comment Jun 13, 2026 12:30pm
openwork-den-worker-proxy Ready Ready Preview, Comment Jun 13, 2026 12:30pm
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 13, 2026 12:30pm

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

4 issues found across 10 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/app/src/react-app/domains/session/sidebar/session-management-store.ts Outdated
Comment thread apps/server/src/routes/sessions.ts Outdated
Comment thread apps/app/src/react-app/shell/use-session-group-sync.ts
Comment thread apps/server/src/session-groups.ts Outdated
@src-opn

src-opn commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the four issues identified by cubic in b5bc18c:

  • Added per-workspace client sync versions so stale session-group responses cannot overwrite newer optimistic/server state.
  • Made session-group event polling single-flight to avoid overlapping refresh loops.
  • Serialized server read-modify-write session-group updates per workspace to avoid lost concurrent writes.
  • Changed the session-group event buffer to be per-workspace so busy workspaces cannot evict quiet workspace events.

Validation:

  • pnpm --filter openwork-server test src/session-groups.e2e.test.ts
  • pnpm --filter openwork-server typecheck
  • pnpm --filter @openwork/app typecheck

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 5 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/app/src/react-app/domains/session/sidebar/session-management-store.ts Outdated
@src-opn

src-opn commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the new issue identified by cubic in f8c316c:

  • Reworked client mutation response handling so successful older server responses are retained while newer mutations are pending.
  • If a newer mutation fails, the latest successful pending response is applied once all pending mutations settle, preventing UI/server divergence while still avoiding stale overwrites of newer optimistic state.
  • Full background/poll syncs now skip applying while local mutations are pending.

Validation:

  • pnpm --filter @openwork/app typecheck
  • pnpm --filter openwork-server test src/session-groups.e2e.test.ts
  • pnpm --filter openwork-server typecheck

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/app/src/react-app/shell/use-session-group-sync.ts Outdated
Comment thread apps/app/src/react-app/domains/session/sidebar/session-management-store.ts Outdated
@src-opn

src-opn commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the latest two issues identified by cubic in 0538d5f:

  • Added a separate server-sync freshness version so out-of-order getSessionGroups responses cannot apply stale data.
  • Buffered the latest server sync result while local mutations are pending, then apply it if all pending mutations settle without a newer successful mutation response.
  • Successful mutation responses still take precedence over deferred server sync data.

Validation:

  • pnpm --filter @openwork/app typecheck
  • pnpm --filter openwork-server test src/session-groups.e2e.test.ts
  • pnpm --filter openwork-server typecheck

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/app/src/react-app/domains/session/sidebar/session-management-store.ts Outdated
@src-opn

src-opn commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the latest issue identified by cubic in 89d5ccf:

  • Deferred server sync state is now applied after pending mutations finish even if a newer sync has since started but not applied yet.
  • The freshness guard still prevents stale sync responses from becoming deferred in the first place; this only prevents dropping the last valid deferred state during mutation settlement.

Validation:

  • pnpm --filter @openwork/app typecheck
  • pnpm --filter openwork-server test src/session-groups.e2e.test.ts
  • pnpm --filter openwork-server typecheck

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.

1 participant