mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:17:01 +01:00
Where a dispatch runs used to be guessed from runner presence: "a desktop is connected" was read as "the operator is at the laptop", and every misroute this subsystem shipped came from that inference. A phone dispatch landed on a laptop nobody was watching and died when the lid shut. A repo-only project was pinned to a laptop that then hunted for a zellij tab that could not exist (Heidi, 2026-09-10). A product-created box workspace was sent to a runner that does not clone (velokiosk, 2026-09-10). Each was patched with one more tier — battery durability, a clone-only exception, a box-root lock — and the rule grew to four tiers that still guessed. Now the answer is stored. `pickDispatchChannel(project)` reads the project and nothing else: the locus lock (a laptop-only tree stays local, a box-rooted tree stays cloud), then the new `user_projects.builder_pref` column, then the cloud floor. DEFAULT_BUILDER_CHANNEL flips to "cloud" — the always-on box is the tier a project runs on when its row says nothing; "This computer" is chosen per project in Control → project profile → "Runs on", and honored whether or not that computer happens to be online. An offline builder queues visibly (`runnerConnected: false`); nothing is rerouted behind the operator's back. Removed with the guess: the battery-durability tier (channelDurability, getBuilderFitness, ExecutionAccess.localDurability) and isCloneOnlyProject. Power source stays in the heartbeat row as data; it no longer routes anything. Migration 0065 adds the nullable column. Routing tests rewritten to pin the stored rule, including that the same project routes the same way whatever is online, and that pickDispatchChannel takes exactly the project. Verified: pnpm run verify green (tsc, lint, design, desktop, 144/144 unit files, ops). Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
6 lines
301 B
SQL
6 lines
301 B
SQL
-- Migration: user_projects.builder_pref — the project's stored builder tier.
|
|
-- NULL = cloud (default). 'local' = the operator's own machine via Fleet Runner.
|
|
-- Routing reads this instead of guessing from runner presence.
|
|
|
|
ALTER TABLE "user_projects" ADD COLUMN IF NOT EXISTS "builder_pref" text;
|