Skip to content

AppBuilder - Fix model selector not showing saved model on reload#4

Merged
eshurakov merged 2 commits intomainfrom
eshurakov/app-builder-fix-model-selection-on-reload
Feb 5, 2026
Merged

AppBuilder - Fix model selector not showing saved model on reload#4
eshurakov merged 2 commits intomainfrom
eshurakov/app-builder-fix-model-selection-on-reload

Conversation

@eshurakov
Copy link
Copy Markdown
Contributor

Summary

  • Fix race condition where the saved model wasn't displayed when opening or reloading an App Builder chat
  • The previous logic cleared selectedModel while waiting for the models API to load, then failed to restore it because projectModel was always truthy (defaults to anthropic/claude-sonnet-4)

Changes

  • Use a ref (initialProjectModelRef) to track the initial project model and only sync when a different project loads
  • Simplify the fallback effect to only set a default when the current selection is invalid
  • User model selections are now preserved and not overridden by the sync logic

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 4, 2026

Deployment failed with the following error:

The value for maxDuration must be between 1 second and 300 seconds, in order to increase this limit upgrade your plan: https://vercel.com/pricing

Learn More: https://vercel.com/docs/functions/limitations

// Sync selectedModel when a different project loads (projectModel changes from initial)
useEffect(() => {
if (projectModel) {
if (projectModel && projectModel !== initialProjectModelRef.current) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Model sync only triggers when the model ID string changes

If you navigate to a different project that happens to use the same projectModel value as the previous project, this effect will not run, so selectedModel can incorrectly carry over a prior user selection. Consider keying this sync off a project identity (e.g., project id / manager) rather than projectModel value, or resetting selectedModel when the manager/project changes.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Feb 4, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
src/components/app-builder/AppBuilderChat.tsx:287 287 Model sync may not run when switching projects that share the same model id
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

None.

Files Reviewed (4 files)

@eshurakov eshurakov merged commit dcb9a42 into main Feb 5, 2026
9 of 10 checks passed
@eshurakov eshurakov deleted the eshurakov/app-builder-fix-model-selection-on-reload branch February 5, 2026 09:51
jeanduplessis added a commit that referenced this pull request Mar 28, 2026
Turborepo was evaluated and deferred. The root build/test/lint scripts
have specific semantics that turbo run would silently broaden (e.g.,
fanning out to EAS builds, Bun wrappers). CI has intentionally separate
jobs for cloud-agent, cloud-agent-next, and matrix workspace tests that
would lose failure isolation under turbo run test. The existing shell
scripts already handle orchestration including trpc prebuilds.

Changes:
- Remove Phase 9 (Add Turborepo) and renumber subsequent phases
- Replace turbo run references in Phase 8 root scripts with explicit
  pnpm --filter and scripts/ delegates
- Remove turbo.json from target structure
- Remove turbo from root devDependencies
- Update concern #4 to document the rationale for deferral
- Add Turborepo to Out of Scope section for future evaluation
jrf0110 added a commit that referenced this pull request Apr 3, 2026
…review fixes

- Fix #1: Add WHERE clause to updateConfig (config.ts accepts wastelandId param)
- Fix #2: Update router.ts and ownership.ts imports from stub to Wasteland.do
- Fix #3: initializeWasteland/storeCredential/updateConfig now return records
- Fix #4: Implement all 6 missing RPC methods (updateMember, connectTown,
  disconnectTown, listConnectedTowns, getWantedBoard, refreshWantedBoard)
- Fix #5: Synchronous initializeDatabase(), no ensureInitialized/initPromise
- Fix #7: Delete WastelandDO.stub.ts

New files:
- 5 table definitions under db/tables/ (config, members, credentials,
  connected-towns, wanted-cache)
- 5 sub-modules under dos/wasteland/ with business logic
- Wasteland.do.ts: thin DO class delegating to sub-modules
jeanduplessis added a commit that referenced this pull request Apr 5, 2026
Turborepo was evaluated and deferred. The root build/test/lint scripts
have specific semantics that turbo run would silently broaden (e.g.,
fanning out to EAS builds, Bun wrappers). CI has intentionally separate
jobs for cloud-agent, cloud-agent-next, and matrix workspace tests that
would lose failure isolation under turbo run test. The existing shell
scripts already handle orchestration including trpc prebuilds.

Changes:
- Remove Phase 9 (Add Turborepo) and renumber subsequent phases
- Replace turbo run references in Phase 8 root scripts with explicit
  pnpm --filter and scripts/ delegates
- Remove turbo.json from target structure
- Remove turbo from root devDependencies
- Update concern #4 to document the rationale for deferral
- Add Turborepo to Out of Scope section for future evaluation
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