[PR #4167] [MERGED] fix(chat): prefill default connection on new chats + label wizard connection select #6265

Closed
opened 2026-10-23 04:08:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4167
Author: @Gunterlie
Created: 7/27/2026
Status: ✅ Merged
Merged: 7/27/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/new-chat-default-connection


📝 Commits (5)

  • 2145c67 fix(chat): seed default connection on new chats and label wizard connection select
  • 91c18a0 Merge branch 'staging' into fix/new-chat-default-connection
  • 9299cbf fix(chat): associate roleplay wizard connection label with its select
  • 967bf33 Merge branch 'fix/new-chat-default-connection' of https://github.com/Gunterlie/Marinara-Engine into fix/new-chat-default-connection
  • 1144eb9 Merge branch 'staging' into fix/new-chat-default-connection

📊 Changes

3 files changed (+31 additions, -16 deletions)

View changed files

📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+21 -14)
📝 packages/client/src/components/chat/NewChatConnectionGate.tsx (+4 -2)
📝 packages/server/src/routes/chats.routes.ts (+6 -0)

📄 Description

Why

With a Main Default and a Fallback connection configured in the Connections tab, clicking New Chat (from either the Characters or Chats menu) opens the setup wizard with the Connection field empty. The dropdown also had no field label, unlike every other field in that step.

It looked like a config mistake but it isn't:

  • All new-chat entry points pass connectionId only from a starred chat preset — useStartChatFromCharacter (use-start-chat-from-character.ts:48), ChatSidebar.tsx:622, HomeNewChatLauncher.tsx:38. With no starred preset, connectionId is undefined.
  • The server create route didn't fill it in either, so chat.connectionId stayed null and the wizard rendered "None".
  • Generation still worked, which is why this reads as cosmetic: it falls back to connections.getDefault() at request time (chats.routes.ts:1165). The fallback connection is only for post-failure retry, so it was never going to appear here.
  • NewChatConnectionGate did prefill, but with connectionRows[0] — first in the list, not the user's default. A third inconsistency.

What changed

  • packages/server/src/routes/chats.routes.ts — POST /chats seeds connectionId from connections.getDefault() when the client omits it. Fixing it here means all four callers agree instead of patching each one.
  • packages/client/src/components/chat/ChatSetupWizard.tsx — added the missing <label> wrapper on the roleplay step's connection <select> (the conversation step already had one). Also an a11y gap: the control had no accessible name.
  • packages/client/src/components/chat/NewChatConnectionGate.tsx — prefill the default connection rather than the first row. Note isDefault arrives as the string "true"/"false" over the wire, so this compares explicitly instead of testing truthiness.

No schema change, no migration. Existing chats are untouched — this only affects newly created ones.

Validation

  • pnpm check
  • pnpm version:check (not expected to be relevant — no version-bearing files touched)

Test plan

  • Configure a Main Default connection and a Fallback connection, with no starred chat preset. Click New Chat from the Chats menu — manually verify the wizard's Connection dropdown shows the default connection, not "None".
  • Repeat from the Characters menu (Start Chat on a character) and from the Home screen New Chat launcher.
  • Manually verify the Connection dropdown in the roleplay wizard step now shows a "Connection" label above it, matching the conversation step.
  • With zero connections configured, click New Chat — manually verify NewChatConnectionGate still shows the "No connections found" empty state and that creating a chat after adding one works.
  • With a starred chat preset that specifies a connection, manually verify the preset's connection still wins over the default.
  • Manually verify in the browser that changing the connection in the wizard still persists to the chat.
  • Regression check: import a chat (the import path also hits POST /chats) and manually verify an imported chat's connection is not unexpectedly overwritten.

Notes

There is no linked issue for this — one should be opened before this PR leaves draft, per CONTRIBUTING.md § Before You Open a Pull Request.

No user-facing docs under docs/ changed, so no docs-i18n follow-up is needed. The one new UI string reuses the existing ui.chat.conversationquicksetup.connection key, so no new locale entries.

Summary by CodeRabbit

  • New Features
    • Improved connection selection in the chat setup wizard with a clearer labeled layout.
    • Automatically selects the configured default connection when starting a new chat.
    • New chats now use the default connection when no connection is explicitly selected.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4167 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/27/2026 **Status:** ✅ Merged **Merged:** 7/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/new-chat-default-connection` --- ### 📝 Commits (5) - [`2145c67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2145c678a4929a4332264fefc97f5e6381f0c773) fix(chat): seed default connection on new chats and label wizard connection select - [`91c18a0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/91c18a0314f332c8e1b66bf82c7478888e12dcaa) Merge branch 'staging' into fix/new-chat-default-connection - [`9299cbf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9299cbf9b1b0c255c58da32fd739ea6c565e7261) fix(chat): associate roleplay wizard connection label with its select - [`967bf33`](https://github.com/Pasta-Devs/Marinara-Engine/commit/967bf332e1d0dbc472336ad0869c5b629eee8e3c) Merge branch 'fix/new-chat-default-connection' of https://github.com/Gunterlie/Marinara-Engine into fix/new-chat-default-connection - [`1144eb9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1144eb934836f9979ec43542097d43ae5bfee836) Merge branch 'staging' into fix/new-chat-default-connection ### 📊 Changes **3 files changed** (+31 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+21 -14) 📝 `packages/client/src/components/chat/NewChatConnectionGate.tsx` (+4 -2) 📝 `packages/server/src/routes/chats.routes.ts` (+6 -0) </details> ### 📄 Description ## Why With a **Main Default** and a **Fallback** connection configured in the Connections tab, clicking **New Chat** (from either the Characters or Chats menu) opens the setup wizard with the Connection field empty. The dropdown also had no field label, unlike every other field in that step. It looked like a config mistake but it isn't: - All new-chat entry points pass `connectionId` **only** from a starred chat preset — `useStartChatFromCharacter` (`use-start-chat-from-character.ts:48`), `ChatSidebar.tsx:622`, `HomeNewChatLauncher.tsx:38`. With no starred preset, `connectionId` is `undefined`. - The server create route didn't fill it in either, so `chat.connectionId` stayed `null` and the wizard rendered "None". - Generation still worked, which is why this reads as cosmetic: it falls back to `connections.getDefault()` at request time (`chats.routes.ts:1165`). The *fallback* connection is only for post-failure retry, so it was never going to appear here. - `NewChatConnectionGate` did prefill, but with `connectionRows[0]` — first in the list, not the user's default. A third inconsistency. ## What changed - `packages/server/src/routes/chats.routes.ts` — `POST /chats` seeds `connectionId` from `connections.getDefault()` when the client omits it. Fixing it here means all four callers agree instead of patching each one. - `packages/client/src/components/chat/ChatSetupWizard.tsx` — added the missing `<label>` wrapper on the roleplay step's connection `<select>` (the conversation step already had one). Also an a11y gap: the control had no accessible name. - `packages/client/src/components/chat/NewChatConnectionGate.tsx` — prefill the default connection rather than the first row. Note `isDefault` arrives as the string `"true"`/`"false"` over the wire, so this compares explicitly instead of testing truthiness. No schema change, no migration. Existing chats are untouched — this only affects newly created ones. ## Validation - [ ] `pnpm check` - [ ] `pnpm version:check` (not expected to be relevant — no version-bearing files touched) ## Test plan - [x] Configure a Main Default connection and a Fallback connection, with **no** starred chat preset. Click New Chat from the Chats menu — manually verify the wizard's Connection dropdown shows the default connection, not "None". - [x] Repeat from the Characters menu (Start Chat on a character) and from the Home screen New Chat launcher. - [x] Manually verify the Connection dropdown in the **roleplay** wizard step now shows a "Connection" label above it, matching the conversation step. - [x] With zero connections configured, click New Chat — manually verify `NewChatConnectionGate` still shows the "No connections found" empty state and that creating a chat after adding one works. - [x] With a starred chat preset that specifies a connection, manually verify the preset's connection still wins over the default. - [x] Manually verify in the browser that changing the connection in the wizard still persists to the chat. - [ ] Regression check: import a chat (the import path also hits `POST /chats`) and manually verify an imported chat's connection is not unexpectedly overwritten. ## Notes There is no linked issue for this — one should be opened before this PR leaves draft, per `CONTRIBUTING.md § Before You Open a Pull Request`. No user-facing docs under `docs/` changed, so no `docs-i18n` follow-up is needed. The one new UI string reuses the existing `ui.chat.conversationquicksetup.connection` key, so no new locale entries. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved connection selection in the chat setup wizard with a clearer labeled layout. * Automatically selects the configured default connection when starting a new chat. * New chats now use the default connection when no connection is explicitly selected. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:44 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6265
No description provided.