Skip to content

desktop: make chat work in SKIP_ENV_VALIDATION mode#2967

Merged
Kitenite merged 2 commits into
mainfrom
external-contributor-chat-testing
Mar 28, 2026
Merged

desktop: make chat work in SKIP_ENV_VALIDATION mode#2967
Kitenite merged 2 commits into
mainfrom
external-contributor-chat-testing

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Mar 28, 2026

Summary

  • make desktop chat work when
  • provide local-only fallback model options and attachment handling in desktop dev mode
  • skip remote chat session persistence calls in desktop dev mode

Testing

  • bun test apps/desktop/src/renderer/lib/dev-chat.test.ts
  • bun test apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.test.ts

Summary by cubic

Enables desktop chat to run offline in SKIP_ENV_VALIDATION mode. In this mode, chat boots locally, uses local model options, and avoids cloud APIs so you can test chat/streaming without signing in.

  • New Features
    • Added renderer/lib/dev-chat helpers: dev-mode detection, MOCK_ORG_ID resolution, session readiness, and fallback model options.
    • Use local model options when in dev mode; skip chat.getModels fetch.
    • Client-side attachment handling in dev mode (returns data URLs; no server upload).
    • Skip remote chat session create/delete calls; treat local sessions as ready and show them in the session selector.
    • Updated apps/desktop/BUILDING.md to note local-only chat bootstrap in this mode.
    • Added tests for dev chat helpers and session init logic.

Written for commit 9bcb5e6. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

New Features

  • Enabled desktop chat development mode for local-only testing without cloud API connectivity when local model credentials are configured.

Documentation

  • Updated build instructions for development server configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 28, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: db8a3265-c3b5-4a9d-947a-660016e996dc

📥 Commits

Reviewing files that changed from the base of the PR and between f655c31 and 9bcb5e6.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • apps/desktop/BUILDING.md
  • apps/desktop/src/renderer/lib/dev-chat.test.ts
  • apps/desktop/src/renderer/lib/dev-chat.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceChat/components/WorkspaceChatInterface/ChatPaneInterface.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceChat/components/WorkspaceChatInterface/utils/uploadFiles/uploadFiles.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceChat/hooks/useWorkspaceChatController/useWorkspaceChatController.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/ChatPaneInterface/ChatPaneInterface.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/ChatPaneInterface/utils/uploadFiles/uploadFiles.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts

📝 Walkthrough

Walkthrough

This change introduces a desktop dev-chat feature that allows testing chat and streaming functionality without cloud API dependencies when environment validation is disabled. It adds a new dev-chat helper module, integrates dev-mode checks throughout chat components and session management, and enables local fallback behavior for models, file uploads, and sessions.

Changes

Cohort / File(s) Summary
Documentation & Dev-Chat Module
apps/desktop/BUILDING.md, apps/desktop/src/renderer/lib/dev-chat.ts, apps/desktop/src/renderer/lib/dev-chat.test.ts
Added documentation for local-only session bootstrap in SKIP_ENV_VALIDATION mode. Introduced new dev-chat module exporting DEV_CHAT_MODELS and helper functions (isDesktopChatDevMode, resolveDesktopChatOrganizationId, isDesktopChatSessionReady, getDesktopChatModelOptions) to gate chat behavior based on environment validation flag. Comprehensive test suite validates all helper function behaviors.
Chat Model Fetching
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceChat/components/WorkspaceChatInterface/ChatPaneInterface.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/ChatPaneInterface/ChatPaneInterface.tsx
Updated useAvailableModels() hook to compute local models via getDesktopChatModelOptions(), disable remote API queries when dev mode is active, and prioritize desktop-provided models over server-fetched ones.
File Upload Handling
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceChat/components/WorkspaceChatInterface/utils/uploadFiles/uploadFiles.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/ChatPaneInterface/utils/uploadFiles/uploadFiles.ts
Added dev-mode early return that bypasses uploadAttachment API call and returns file data directly as FileUIPart. Refactored both locations to precompute data URLs before branching on dev mode.
Session Management
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceChat/hooks/useWorkspaceChatController/useWorkspaceChatController.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts
Added dev-mode guards to skip session API calls (createSessionRecord, deleteSessionRecord), replaced organization ID derivation with resolveDesktopChatOrganizationId(), and updated session readiness logic using isDesktopChatSessionReady(). Both files now prepend synthetic session entries in dev mode when sessionId is set but not persisted.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rabbit hops through desktop chat,
Where dev mode lets us test that,
Models loaded, files sent with care,
Sessions ready, everywhere—
No cloud calls needed here, hooray! 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch external-contributor-chat-testing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite Kitenite merged commit 1637aa3 into main Mar 28, 2026
18 of 27 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 28, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Fly.io Electric (Fly.io) View App
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 10 files

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