Skip to content

Add workspace chat tabs#348

Open
mussonking wants to merge 3 commits into
OpenCoworkAI:mainfrom
mussonking:codex/new-conversation-workspace-clean
Open

Add workspace chat tabs#348
mussonking wants to merge 3 commits into
OpenCoworkAI:mainfrom
mussonking:codex/new-conversation-workspace-clean

Conversation

@mussonking
Copy link
Copy Markdown
Contributor

Summary

  • Add chat tabs for designs that share the same workspace, with a plus action for starting a fresh conversation in that workspace.
  • Create fresh workspace conversations without copying prior snapshots or chat history.
  • Keep workspace/session state consistent when switching, renaming, deleting, and generating across chat tabs.

Test plan

  • Targeted desktop tests for chat tabs, workspace conversation creation, switching, generation, and rename flows.
  • Desktop typecheck.
  • Full pre-push checks: workspace typecheck, lint, and test suite.
  • Windows desktop build via cmd.exe: pnpm --filter @open-codesign/desktop build.
  • Windows dev app launched from the rebased branch for manual testing.

Principles

  • Compatibility
  • Upgradeability
  • No bloat
  • Elegance

@github-actions github-actions Bot added the area:desktop apps/desktop (Electron shell, renderer) label May 19, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: initial

Findings

  • Minor Missing changeset for user-visible feature — the PR adds workspace chat tabs, plus/close buttons, and new i18n strings. Per CLAUDE.md and CONTRIBUTING, user-visible changes require a changeset (pnpm changeset). The diff does not include one.
    Suggested fix: run pnpm changeset with a patch bump and a short description like "feat: add workspace chat tabs with fresh conversation support".

  • Minor chatWorkspaceKey in Sidebar.tsx (apps/desktop/src/renderer/src/components/Sidebar.tsx:70) uses globalThis.navigator?.platform to decide case-sensitivity for path comparison. This is deprecated and unreliable — in some environments (headless, CI, sandboxed) it may be empty or incorrect, leading to inconsistent workspace grouping on Windows. The imported workspacePathComparisonKey from ../lib/workspace-path already handles the platform check.
    Suggested fix: remove the local chatWorkspaceKey wrapper and call workspacePathComparisonKey(workspacePath) directly (the function takes a single argument per workspace-path.ts:36). If the renderer version has a different signature, align it to the main process version or pass the platform from main via preload.

  • Nit ChatSessionTabBar in Sidebar.tsx (~100 lines with tabs, close button, and modal) would be cleaner as its own file, e.g., ChatSessionTabBar.tsx. Not a blocker but helps maintainability as chat-tab features grow.

  • Nit chatWorkspaceKey duplicates the logic of workspacePathComparisonKey — it manually normalizes and case-folds. Remove it and use the shared function directly (see Minor finding above).

Summary

This PR implements workspace-scoped chat tabs: multiple designs (sessions) can share the same workspace directory, a + button creates a fresh conversation without copying history/snapshots, and the hub views collapse designs sharing a workspace into a single card. The main-process IPC is extended with a workspaceReuse flag to bypass the workspace-binding conflict check. The extraction of workspacePathComparisonKey into workspace-path.ts and its use in generation-ipc.ts is a good cross-cutting improvement. UI rendering is refactored to split the file-tab bar from the files-tab bar. No blockers or major issues; the missing changeset should be addressed before merging, and the navigator.platform usage should be hardened.

Testing

  • New Vitest tests cover: bindWorkspace with allowExistingWorkspaceBinding, acquireInFlightWorkspaceGeneration Windows case folding, registerSnapshotsIpc fresh-conversation flow and conflict rejection, collapseWorkspaceDesigns workspace dedup, and store action createNewConversationForCurrentWorkspace with clean UI state.
  • Existing tests pass locally per PR metadata.
  • No E2E (Playwright) tests added for the chat-tab UI interactions (click, switch, close, new conversation). Consider adding a Playwright test for the sidebar tab row if this area becomes more interactive.

Open-CoDesign Bot

@github-actions github-actions Bot added the docs Documentation label May 19, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: follow-up after new commits

Findings

No new issues. All previous findings have been addressed:

  • Changeset added: .changeset/workspace-chat-tabs.md now present (patch bumps for desktop and i18n).
  • ChatSessionTabBar extracted to ChatSessionTabBar.tsx with its own test file, removing inline code from Sidebar.tsx.
  • navigator.platform usage removed: ChatSessionTabBar.tsx imports workspacePathComparisonKey from ../lib/workspace-path without passing a platform argument, relying on the new isWindowsPath() heuristic. The previous chatWorkspaceKey function in Sidebar.tsx is gone. The renderer-side workspace-path.ts now falls back to path-shape detection when platform is undefined, making it robust in headless/CI environments.

Residual observations

  • The collapseWorkspaceDesigns function in RecentTab.tsx duplicates the case-folding and trailing-slash logic that workspacePathComparisonKey already handles. This is intentional — the hub view operates on Design shape without importing the lib function — and the duplication is minimal. Not a blocker.

Summary

The PR is now ready to merge. The workspace chat-tabs feature is well-implemented: IPC supports workspaceReuse: 'fresh-conversation', the renderer state creates clean conversations, the hub views collapse workspace-shared designs, and cross-cutting path normalization is consistent across main and renderer. No blockers or major issues remain.

Testing

  • All new tests pass locally per PR description.
  • Existing tests still pass.
  • No E2E tests for sidebar tab interactions; acceptable for this scope.

Open-CoDesign Bot

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: follow-up after new commits

Findings

No new issues. The incremental changes since the previous review are all clean improvements:

  • fallbackChatAfterClose extracted and tested — the inline fallback logic is now a separate pure function with unit coverage for the active-chat-only fallback semantics.
  • Duplicate normalization removed in workspaceGroupKey — now delegates to workspacePathComparisonKey instead of inline lowercasing, eliminating the residual duplication noted in the previous review.
  • Root-path edge case covered — the new test ensures that C:/ and c:/ root workspaces (which have no meaningful basename) are not incorrectly collapsed.
  • Changeset description updated — reflects the hub card deduplication behavior.

Summary

The PR is ready to merge. All prior findings have been resolved, and the follow-up commits are focused, well-tested, and improve consistency.

Testing

  • New unit tests for fallbackChatAfterClose, root path handling, and updated workspaceGroupKey all pass.
  • No E2E tests added for the tab bar interactions; acceptable for this scope and consistent with project practices.

Open-CoDesign Bot

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

Labels

area:desktop apps/desktop (Electron shell, renderer) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant