Skip to content

feat: improve multi-workspace chat setup - #7

Merged
cynfria merged 2 commits into
block:mainfrom
cynfria:workspace-polish-oss
Aug 13, 2026
Merged

feat: improve multi-workspace chat setup#7
cynfria merged 2 commits into
block:mainfrom
cynfria:workspace-polish-oss

Conversation

@cynfria

@cynfria cynfria commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Category: improvement
User Impact: Multi-folder project chats can now configure worktree behavior up front, create and attach worktrees safely, and manage queued messages more clearly from the composer.
Problem: Multi-workspace chats did not explain or reliably coordinate worktree setup, project folder policies, session promotion, and queued-message behavior. This led to hidden worktree actions, stale workspace state, and confusing composer feedback.
Solution: Add explicit per-folder new-chat policies, an immediate composer piggyback for prompted worktree setup, and coordinated workspace/session transitions with rollback, timeout, migration, and queue-order safeguards. The UI now distinguishes Git-connected folders, preserves policy through transient Git failures, and groups queued messages consistently.

File changes

scripts/design-system-audit.mjs
Removes a stale baseline exception after Project dialog buttons moved back onto supported design-system treatments.

src-tauri/crates/berdctl/api-surface.json
src-tauri/crates/berdctl/api-surface-feedback.json
src-tauri/crates/berdctl/cli-surface.json
src-tauri/crates/berdctl/cli-surface-feedback.json
Regenerates berdctl project startup-mode contracts for manual and prompted worktree policies and legacy-mode migration.

src/app/AppShell.tsx
Starts a fresh chat after project creation, preserves full workspace state during draft promotion, and initializes project chats according to the selected workspace policy.

src/app/SessionWindowApp.tsx
Uses the shared worktree-mode interpretation when restoring session-window project context.

src/features/berdctl/commands/impl/getProject.ts
Returns the expanded project workspace startup-mode contract.

src/features/berdctl/commands/impl/setProjectStartupMode.ts
Normalizes legacy modes, applies policy only to Git workspaces, and returns the actual persisted mode.

src/features/berdctl/tests/commands/commands.test.ts
Covers current and migrated startup-mode command behavior.

src/features/chat/hooks/useChatSessionController.ts
Offers pre-send workspace setup immediately, provisions named worktrees safely, and protects async UI state from stale completions.

src/features/chat/hooks/tests/useChatSessionController.test.ts
Covers initial piggyback visibility and startup system-message behavior.

src/features/chat/hooks/useMessageQueue.ts
Prevents dismissing one queued message from sending the next message as a side effect.

src/features/chat/hooks/tests/useMessageQueue.test.ts
Protects explicit queue removal and remaining-message order.

src/features/chat/lib/firstWorkspaceSend.ts
Coordinates workspace planning, session promotion, target switching, timeout, validation, rollback, migration, and deferred-message release.

src/features/chat/lib/firstWorkspaceSend.test.ts
Adds adversarial coverage for promotion waits, rollback, stale state, interrupted setup, and policy behavior.

src/features/chat/lib/sessionTargetCoordinator.ts
Makes draft-to-backend coordinator transfer collision-safe and settles superseded operations.

src/features/chat/lib/sessionTargetCoordinator.test.ts
Covers existing backend actors and in-flight draft operation cleanup.

src/features/chat/ui/ChatInput.tsx
Places the workspace piggyback behind the composer and groups/animates queued messages in one responsive container.

src/features/chat/ui/tests/ChatInput.test.tsx
Covers piggyback ordering, grouped queue geometry, editing, and action ownership.

src/features/chat/ui/ChatView.tsx
Connects immediate and deferred workspace setup states to the composer accessory.

src/features/chat/ui/WorkspaceSetupChoice.tsx
Implements the animated worktree choice, naming, progress, and inline error states with dark-mode and reduced-motion support.

src/features/chat/ui/WorkspaceSetupChoice.test.tsx
Covers setup copy, naming validation, error layout, progress, and visual contracts.

src/features/chat/ui/widgets/WorkspaceIdentity.tsx
Supports explicit Git-folder identity icons and icon-scoped explanatory tooltips.

src/features/design-system/generated/componentManifest.ts
src/features/design-system/ui/DesignSystemView.tsx
Documents the compact 32px text-button size used by composer actions.

src/features/projects/api/projects.ts
Adds current workspace policy modes and migrates legacy branch/worktree settings.

src/features/projects/api/projects.test.ts
Covers policy normalization, migration, and persistence.

src/features/projects/lib/projectChatWorkspaces.ts
Plans project-wide worktrees, formats friendly errors, and provides rollback-safe cleanup.

src/features/projects/lib/projectChatWorkspaces.test.ts
Covers multi-folder planning, validation, rollback, and plain-English failures.

src/features/projects/ui/CreateProjectDialog.tsx
Redesigns Project folders with Git-aware icons, per-folder new-chat policy controls, policy synchronization, and non-Git handling.

src/features/projects/ui/tests/CreateProjectDialog.test.tsx
Covers Git detection, policy synchronization, transient probe failures, migration, and folder management.

src/shared/i18n/locales/en/projects.json
src/shared/i18n/locales/es/projects.json
Adds localized policy labels and concise Git-folder tooltip copy.

src/shared/ui/button.tsx
Adds a shared compact 32px text-button size for composer action groups.

@cynfria
cynfria requested a review from a team August 12, 2026 23:57
@kalvinnchau kalvinnchau changed the title improve multi-workspace chat setup feat: improve multi-workspace chat setup Aug 13, 2026
morgmart
morgmart previously approved these changes Aug 13, 2026
@cynfria
cynfria merged commit 87ed9b0 into block:main Aug 13, 2026
10 checks passed
morgmart added a commit that referenced this pull request Aug 14, 2026
## Summary

- restore the double-enter flow: while an agent is working, a send
shortcut with an empty composer steers the first visible queued message
- keep steering inert for drafts, queued edits, hidden queue heads, idle
sessions, disabled sends, and in-flight attachment admission
- restore the durable chat laws and regression coverage that were missed
during the OSS repository migration

## Context

This completes the behavior from #3, which was merged into the temporary
`kalvin/initial-oss-port` branch instead of `main`. Most supporting
guards later reached `main` through #7; the ordinary `chat.sendMessage`
route, laws, and focused tests did not.

## Testing

- `pnpm vitest run src/features/chat/ui/__tests__/ChatInput.test.tsx
src/features/chat/ui/__tests__/ChatInput.attachments.test.tsx` — 158
passed
- `just check`
- `pnpm typecheck`
- `pnpm test` — 531 files, 6,205 passed, 1 skipped
- pre-push `fmt-check`, `check`, `tauri-check`, and `clippy`
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.

2 participants