Skip to content

feat(mobile): support configurable Quick Chat backends - #7322

Merged
iscekic merged 11 commits into
kwf/app-agent-settings-tools-stacked-5895-f7f6-l1from
igor/quick-chat-backends
Oct 10, 2026
Merged

iscekic merged 11 commits into
kwf/app-agent-settings-tools-stacked-5895-f7f6-l1from
igor/quick-chat-backends

Conversation

@iscekic

@iscekic iscekic commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Changelog for users

  • Configure Quick Chat backends with Chat Completions, Responses, or Messages. Kilo remains the default.
  • Add models manually, discover models when supported, and test a real inference request before saving.
  • Choose modern max_completion_tokens or legacy max_tokens for Chat Completions endpoints.
  • Keep each conversation's backend separate, including concurrent chats and queued questions.
  • Confirm context transfer before changing backends. Text-only models receive no tools.
  • Edited or deleted backends require a new explicit selection. Failed questions retain their original target through Retry and restoration.
  • Sign-out and account changes remove backend profiles and credentials.
  • HTTPS remains the default. Local HTTP needs endpoint-specific approval; Android release builds remain HTTPS-only.

Changelog for maintainers

  • Add the focused @kilocode/harness-sdk/plugins/remote-model entry. The SDK continues to own history, compaction, and tools.
  • Share SSE parsing with Kilo while retaining direct-provider authentication and wire differences.
  • Preserve interleaved tool identities, direct assistant reasoning, and cancellation of pending stream reads.
  • Route each request through an immutable backend ID, revision, and upstream model ID.
  • Keep custom authentication separate from Kilo authentication. Block Kilo headers, redirects, and ambient cookies.
  • Clear backend credentials durably before publishing another account's credentials.
  • Persist failed question text and target together. Migrate old text records explicitly and remove records when conversations are deleted.
  • Add translated backend settings in all 87 catalogs. Keep the generated store changelog unchanged.

Verification

  • Built and installed the Android debug app on the owned GCE emulator with isolated backend services and two approved fake accounts.
  • Exercised discovery, real connection checks, streaming chat, all three protocols, and identical upstream IDs on distinct backends.
  • Confirmed explicit handover preserves the ORBIT conversation context. Cancel retained the draft and original backend.
  • Confirmed edit/delete recovery, explicit deleted-target errors, draft retention, profile persistence after relaunch, and account cleanup.
  • Held one inference request while another backend completed its own chat. Released the first request and observed its correct response.
  • Exercised modern and legacy token fields through the native settings and connection check. Observed checked radio states and saved selection.
  • Ran a disposable SDK consumer on the VM with real HTTP inference, local tool execution, reasoning replay, and tool-result replay.
  • SDK: 70 focused tests, typechecks, lint, build, all 11 built entry points, and platform/dependency checks passed.
  • Mobile: 166 focused tests, three auth lifecycle tests, typecheck, lint, unused-code check, and all 87 catalog checks passed.
  • Provider fixtures use synthetic credentials. No production model calls or real account changes.
  • Native iOS behavior is not exercised in this PR. The iOS configuration adds only the local networking exception.

Stack

@iscekic iscekic self-assigned this Oct 9, 2026
@iscekic

iscekic commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Android native evidence: explicit context-transfer approval, independently routed chat, and accessible completion-token field selection. These screens use isolated fake accounts and synthetic provider credentials.

Explicit context transfer approval

Independent backend chat completes after another chat

Checked protocol and completion token field

Comment thread apps/mobile/src/lib/chat/registry.ts Resolved
Comment thread apps/mobile/src/lib/chat/sign-out.ts Resolved
Comment thread apps/mobile/app.config.ts Resolved
@kilo-code-bot

kilo-code-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental change guards the pre-send target check on stored-backend load state, letting the registry validate a not-yet-loaded custom target instead of falsely reporting it deleted; the registry path (registry.ts:107) awaits waitForChatBackends and re-resolves via resolveChatTarget at stream time, and the test-only backend-store mocks match the real clearChatBackends wiring.

Files Reviewed (4 files)
  • apps/mobile/src/components/chat/chat-screen.tsx
  • apps/mobile/src/components/chat/chat-screen.mounted.test.tsx
  • apps/mobile/src/lib/auth/credentials.test.ts
  • apps/mobile/src/lib/auth/session-scoped-state.test.ts
Previous Review Summaries (5 snapshots, latest commit b69cb54)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit b69cb54)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commit b69cb54 only extends the case-guard allowlist with three backend files whose bare toLowerCase() calls normalize HTTP header names and compare hostnames, so no display text is re-cased; all three sites are verified non-display and the guard stays sound.

Files Reviewed (1 file)
  • apps/mobile/src/lib/case-guard.test.ts

Previous review (commit a510d83)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commit a510d83 makes Retry re-enter the chat before retrying, so a chat whose open failed now does recover; enterChat is a no-op for an already-open chat, and the previously reported inert-Retry suggestion is resolved.

Files Reviewed (3 files)
  • apps/mobile/src/lib/chat/use-chat.ts
  • apps/mobile/src/lib/chat/registry.ts
  • apps/mobile/src/lib/chat/registry.test.ts

Previous review (commit 5ef970d)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

All seven findings from the previous review are resolved by 5ef970d50b; the one new issue is a failure row whose Retry is inert when a chat fails to open rather than when a tool change fails.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
apps/mobile/src/components/chat/chat-screen.tsx 274 The failure row also renders for a failed chat open, where retryChat is a no-op
Files Reviewed (21 files)
  • apps/mobile/app.config.ts
  • apps/mobile/plugins/permission-prompt-copy.json
  • apps/mobile/src/components/chat/backend-form.mounted.test.tsx
  • apps/mobile/src/components/chat/backend-form.tsx
  • apps/mobile/src/components/chat/backend-headers-field.tsx
  • apps/mobile/src/components/chat/chat-failure-row.tsx
  • apps/mobile/src/components/chat/chat-list-screen.mounted.test.tsx
  • apps/mobile/src/components/chat/chat-list-screen.tsx
  • apps/mobile/src/components/chat/chat-screen.mounted.test.tsx
  • apps/mobile/src/components/chat/chat-screen.tsx
  • apps/mobile/src/i18n/permission-prompt-locales.test.ts
  • apps/mobile/src/i18n/permission-prompt-locales.ts
  • apps/mobile/src/lib/auth/auth-context.tsx
  • apps/mobile/src/lib/chat/backend-target.ts
  • apps/mobile/src/lib/chat/registry.test.ts
  • apps/mobile/src/lib/chat/registry.ts
  • apps/mobile/src/lib/chat/state.ts
  • packages/harness-sdk/src/plugins/gateway/wire/completions-body.ts
  • packages/harness-sdk/src/plugins/remote-model/edges.test.ts
  • packages/harness-sdk/src/plugins/remote-model/http.ts
  • packages/harness-sdk/src/plugins/remote-model/wires.ts

Fix these issues in Kilo Cloud

Previous review (commit e4a6c42)

Status: 7 Issues Found | Recommendation: Address before merge

Executive Summary

Backend target staleness and credential retention dominate the remaining findings: a queued question can be silently dropped when its custom backend is deleted, sign-out does not durably delete backend credentials, and the chat list can start on a stale backend.

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 4
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/src/lib/chat/registry.ts 720 targetSupportsTools can throw inside ontoTools for a deleted/edited backend, dropping a queued question silently
apps/mobile/src/lib/chat/sign-out.ts 26 Backend credentials are not durably deleted on sign-out (clearChatBackends is fire-and-forget)
apps/mobile/src/components/chat/chat-list-screen.tsx 84 picked is never reconciled after a backend edit/delete, so Start can open a chat on a stale target

SUGGESTION

File Line Issue
packages/harness-sdk/src/plugins/remote-model/wires.ts 210 Responses refusal branch lacks the empty-delta guard the Chat Completions branch uses
apps/mobile/app.config.ts 182 NSLocalNetworkUsageDescription is English-only, bypassing native prompt localization
apps/mobile/src/components/chat/backend-form.tsx 233 Custom headers render in cleartext while the API key field is masked
packages/harness-sdk/src/plugins/gateway/wire/completions-body.ts 156 The 'max' -> 'xhigh' mapping is unreachable for remote Chat Completions

Fix these issues in Kilo Cloud

Previous review (commit 1f91900)

Status: 7 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 4
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/src/lib/chat/registry.ts 720 targetSupportsTools throws for a deleted/edited backend inside ontoTools; reached from drain in the forked answer fiber, it drops a queued question silently
apps/mobile/src/lib/chat/sign-out.ts 26 Backend credentials are not durably deleted on sign-out (clearChatBackends is fire-and-forget), unlike the account-switch path
apps/mobile/src/components/chat/chat-list-screen.tsx 84 picked is never reconciled after a backend edit/delete, so Start can open a chat on a stale target

SUGGESTION

File Line Issue
packages/harness-sdk/src/plugins/remote-model/wires.ts 210 Responses refusal branch lacks the empty-delta guard the Chat Completions branch uses
apps/mobile/app.config.ts 182 NSLocalNetworkUsageDescription is English-only, bypassing native prompt localization
apps/mobile/src/components/chat/backend-form.tsx 233 Custom headers render in cleartext while the API key field is masked
packages/harness-sdk/src/plugins/gateway/wire/completions-body.ts 156 The 'max' -> 'xhigh' mapping is unreachable for remote Chat Completions
Files Reviewed (67 non-locale files + 88 catalogs)
  • apps/mobile/README.md
  • apps/mobile/app.config.ts - 1 issue
  • apps/mobile/src/components/chat/backend-form-state.ts (+ test)
  • apps/mobile/src/components/chat/backend-form.tsx - 1 issue
  • apps/mobile/src/components/chat/backend-model-row.tsx
  • apps/mobile/src/components/chat/backend-settings-sheet.tsx
  • apps/mobile/src/components/chat/chat-list-screen.tsx (+ mounted test) - 1 issue
  • apps/mobile/src/components/chat/chat-screen.tsx (+ mounted test)
  • apps/mobile/src/lib/auth/auth-context.tsx (+ lifecycle test)
  • apps/mobile/src/lib/auth/session-scoped-state.ts (+ test)
  • apps/mobile/src/lib/chat/backend-capabilities.ts
  • apps/mobile/src/lib/chat/backend-model-options.ts
  • apps/mobile/src/lib/chat/backend-request.ts (+ test)
  • apps/mobile/src/lib/chat/backend-routing.ts (+ test)
  • apps/mobile/src/lib/chat/backend-store.ts (+ test)
  • apps/mobile/src/lib/chat/backend-target.ts (+ test)
  • apps/mobile/src/lib/chat/backend-transport.ts (+ test)
  • apps/mobile/src/lib/chat/backend-url.ts (+ test)
  • apps/mobile/src/lib/chat/fetch.ts
  • apps/mobile/src/lib/chat/layers.ts (+ test)
  • apps/mobile/src/lib/chat/pending.ts
  • apps/mobile/src/lib/chat/registry.ts (+ test) - 1 issue
  • apps/mobile/src/lib/chat/sign-out.ts (+ test) - 1 issue
  • apps/mobile/src/lib/chat/state.ts
  • apps/mobile/src/lib/chat/use-chat.ts
  • apps/mobile/src/lib/storage-keys.ts
  • apps/mobile/src/i18n/locales/en.json (+ 86 catalogs spot-checked)
  • packages/harness-sdk/AGENTS.md, PLUGINS.md, README.md
  • packages/harness-sdk/e2e/readme-check.ts
  • packages/harness-sdk/package.json
  • packages/harness-sdk/scripts/check-package.ts
  • packages/harness-sdk/src/core/fetch.ts
  • packages/harness-sdk/src/index.test.ts
  • packages/harness-sdk/src/plugins/fetch/web.ts
  • packages/harness-sdk/src/plugins/gateway/http.ts, index.ts, indexed-calls.ts, stream.ts
  • packages/harness-sdk/src/plugins/gateway/wire/completions-body.ts - 1 issue
  • packages/harness-sdk/src/plugins/gateway/wire/completions.ts, wire.ts
  • packages/harness-sdk/src/plugins/remote-model/index.ts, http.ts, wires.ts - 1 issue
  • packages/harness-sdk/src/plugins/remote-model/*.test.ts
  • tools/i18n/check-catalogs.mjs

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 88.6K · Output: 7K · Cached: 539.4K

Review guidance: REVIEW.md from base branch kwf/app-agent-settings-tools-stacked-5895-f7f6-l1

@iscekic
iscekic added this pull request to stack #5908 October 9, 2026 00:50
@iscekic iscekic closed this Oct 9, 2026
@iscekic iscekic reopened this Oct 9, 2026
… igor/quick-chat-backends

# Conflicts:
#	apps/mobile/README.md
#	apps/mobile/src/i18n/permission-prompt-locales.test.ts
#	apps/mobile/src/i18n/permission-prompt-locales.ts
… igor/quick-chat-backends

# Conflicts:
#	apps/mobile/src/components/chat/chat-screen.tsx
@iscekic
iscekic merged commit d69ace0 into main Oct 10, 2026
64 of 65 checks passed
@iscekic
iscekic deleted the igor/quick-chat-backends branch October 10, 2026 23:09
iscekic added a commit that referenced this pull request Oct 10, 2026
main landed the Quick Chat stack as squash merges (#7322-#7342), so the
branch's stack history conflicted on 141 files. Resolve by keeping main's
integrated content for the stack files, and reapplying this branch's own
change on top:

- turns.ts keeps main's image support and question shapes, drops the model
  input, and exports askedMessageId.
- turns.test.ts drops the model input and uses Question[] waiting.

Verified: turns.test.ts (11) and chat-screen.mounted.test.tsx (14) pass.
iscekic added a commit that referenced this pull request Oct 10, 2026
main landed the Quick Chat stack as squash merges (#7322-#7342). Resolve the
141-file conflict by keeping main's integrated content and reapplying this
branch's mode-chip change on top:

- chat-toolbar.tsx keeps main's per-chip disabled dimming and gains the
  optional modeControl (modeSelector is null without it).
- chat-composer.tsx takes modeControl and keeps main's image picker import.
- chat-composer.test.ts drops the mode props (no leftover imports).
- session-detail-content.test.ts reads customOptions through modeControl.

Verified: chat-composer, chat-composer-attachment-send, chat-toolbar,
session-detail-content, new-session-configure-form, chat-toolbar-model-name,
chat-composer-send-once, chat-screen mounted, and oxlint on the changed 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.

2 participants