Skip to content

refactor: unify model residency control, gate the OpenAI UI, and remove phase jargon#236

Merged
quiet-node merged 4 commits into
mainfrom
chore/220-phase2-followups
Jun 18, 2026
Merged

refactor: unify model residency control, gate the OpenAI UI, and remove phase jargon#236
quiet-node merged 4 commits into
mainfrom
chore/220-phase2-followups

Conversation

@quiet-node

@quiet-node quiet-node commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Overview

Addresses the three Phase 2 follow-ups tracked in #220, all pre-release cleanups deliberately kept out of the stacked feature PRs (#217/#218/#219) to keep those diffs focused. The feature is unreleased, so the config-shape change here is migration-free.

What changed

  • Unified model-residency control. The built-in engine and Ollama now share one setting, keep_warm_inactivity_minutes, with one consistent meaning: -1 keeps the model resident forever, 0 uses the provider's natural short default (about 5 minutes), and N unloads after N idle minutes. The redundant idle_unload_minutes field is removed. A small tested translator maps the field onto the built-in runner's internal timer; the Ollama keep-alive path is unchanged. Settings now shows a single "Keep Warm" control for both local providers (hidden for a remote OpenAI-compatible server, whose residency Thuki does not manage). The built-in engine's effective default moves from "resident forever" to "unload after about 5 minutes idle", which frees several GB of RAM when idle now that built-in is the default provider on every fresh install; power users can set -1.
  • OpenAI provider UI gated behind a compile-time dev flag. Thuki ships local-only (built-in plus local or remote Ollama). The Settings affordances to create or manage an OpenAI-compatible provider are now behind VITE_ENABLE_OPENAI_PROVIDER, off by default and tree-shaken out of shipped builds. The backend stays fully active and tested (the /v1 client shared with the built-in engine, Keychain storage, the routing arm, the config kind); this gates only the user-facing kind, so no end user can reach an OpenAI provider in a shipped build.
  • Internal phase jargon removed. "Phase 1/2/3" and "Phase A/B" references in comments, section headers, and test labels are reworded to describe behavior. The screenshot algorithm's "Phase 1/2" local steps become "Step 1/2". The animation phase state and the mmproj download phase are left as-is (real domain terms).

How it works

The unified field is read at the two boundaries that already forward residency policy: startup engine seeding and the Settings change-forwarder. Both translate through one warmup::builtin_idle_minutes helper (-1 to the runner's "disabled, stays resident forever", 0 to a fixed about-5-minute timer, N to N minutes), so the runner's internal "0 = disabled" convention stays an implementation detail behind one tested boundary. The OpenAI gate reads import.meta.env.VITE_ENABLE_OPENAI_PROVIDER inline at the one render site that mounts the OpenAI card and its add-a-server affordance; Vite statically replaces the value at build, so a production build folds it to false and tree-shakes the affordance out of the bundle.

Testing

bun run test:all:coverage and bun run validate-build both clean: frontend at 100% across lines, branches, functions, and statements; backend 100% line coverage; lint, format, typecheck, and build all clean. The residency translator has unit tests for every arm; the OpenAI flag is tested in both enabled and disabled states.

Closes #220.

…ty_minutes

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node quiet-node merged commit 3261951 into main Jun 18, 2026
3 checks passed
@quiet-node quiet-node deleted the chore/220-phase2-followups branch June 18, 2026 23:22
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.

Phase 2 follow-ups (deferred cleanups and decisions)

1 participant