feat: improve multi-workspace chat setup - #7
Merged
Conversation
morgmart
previously approved these changes
Aug 13, 2026
morgmart
approved these changes
Aug 13, 2026
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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.