mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 11:33:28 +01:00
Session 3 of killing-the-bash-daemon plan (/home/g/.claude/plans/
structured-baking-kazoo.md). Collapses the five-tier auto_inject_mode
ladder (off|queue_only|beacon|next_best|strategist) to binary off|on
and removes the dead complexity that protected the upper tiers.
What the modes meant (now retired):
off — manual, every dispatch is a click
queue_only — drain the queue, then stop
beacon — popup with countdown auto-pick (default for new users)
next_best — auto-fire canned template silently
strategist — Groq composes a fresh prompt from context
What "on" means now: when status:ready arrives, fire the queue head if
non-empty, else the canned next_best template. Safety rails (status:
working/blocked, blockers, no-op fuse, health/tests gate) all still
apply — being "on" doesn't override the agent's "not done" signal.
Most users only ever toggled between off and "fire when ready"; the
intermediate tiers added cognitive load without proportionate value.
DB migration applied to both local and Hetzner prod in this commit:
UPDATE beacon_settings SET auto_inject_mode = CASE WHEN
auto_inject_mode='off' THEN 'off' ELSE 'on' END
UPDATE entities SET auto_inject_mode_override = (same CASE)
ALTER TABLE ... ADD CONSTRAINT CHECK IN ('off','on')
ALTER TABLE beacon_settings ALTER COLUMN auto_inject_mode
SET DEFAULT 'on'
0 beacon_settings rows existed (both envs), 21 entities updated on
prod, 1324 on local. Constraints added cleanly.
Code deltas:
- src/config/beacon.ts — AUTO_INJECT_MODE_VALUES is ["off","on"].
LEGACY_AUTO_INJECT_MODE_VALUES + normalizeAutoInjectMode helper
kept for tolerant reads of any unmigrated row.
- src/lib/constants/control.ts — DEFAULT_AUTO_INJECT_MODE = "on".
- src/db/schema/beacon-settings.ts — default "on".
- src/lib/orchestration/dispatch-gates.ts — simplified to off/on
decision; no fall-through to a composer. Safety rails preserved.
- src/app/api/control/dispatch/route.ts — 361 → 160 LoC. Deleted
buildPrompt, callGroq, parseGroqResponse, OrangeCat fetch, the
strategist branch, and the gitBranch/recentCommits/mission
decision inputs. DispatchResult.source union dropped "groq" +
"fallback"; DispatchAction dropped "composed".
- scripts/test/dispatch-gates.ts — rewrote for binary modes;
11/11 pass.
Popup deletion (the L3 "beacon" mode's UI surface):
- src/app/beacon/{layout,[id]/{page,BeaconClient},live/{page,
BeaconLiveClient}}.tsx — the popup React tree
- src/app/api/beacon/{[id],cancel,sse,window/{hide,show}}/route.ts
— popup-specific API routes
KEPT: /api/beacon/queue (Fleet Runner uses it), /api/beacon/recent,
/api/beacon/transcribe, top-level /api/beacon/route.ts (other
consumers besides the popup import cancelActiveBeaconSessions).
UI updates (mode collapse fans through):
- AutomationPolicyControl.tsx — 2 dots not 5
- ControlFleetStatus.tsx — 2 hint strings
- ProjectCard.tsx — automation labels for off/on only
- use-project-card-actions.ts — strategist "composed" path removed
Verification: tsc clean, test:home 97/97, test:dispatch-gates 11/11,
test:control-presenter 19/19, lint clean (8 pre-existing warnings).
scripts/agent-hook-bridge.sh shows as dirty in the working tree from
earlier system-level edits today; intentionally left out of this
commit. It (and the rest of the bash scripts) gets deleted in
Session 4.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>