Claude Code writes live per-PID status to ~/.claude/sessions/<pid>.json
(status idle|working, cwd). Three fixes hang off it:
- Dispatch verify: isPtyBusy was fooled by boot-screen redraw — on a
fresh clone the trust-folder dialog ate the injected paste and six
agents were acked 'launched + injected' while idle at an empty
composer. waitForAgentGenerating() now polls the CLI's own status
(fallback to isPtyBusy for agents without live status files) and
re-injects once when verifiably idle.
- Pusher lifecycle: readFastState synthesizes the direct_terminal
observation from live status, so headless PTY agents mid-task read
as Working instead of 'process detected, no lifecycle signal'
(the producer the presenter test always described but nothing built).
- Deploy hardening: the restart ssh runs under timeout 180 +
keep-alives after hanging 47 minutes post-restart and freezing the
deploy before verification and the runner sync.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Dogfood session drove FleetCrown against production and found the fleet
had been silently dead for 2 days behind a green light:
- nudge-idle raw-queried beacon_settings WHERE mode != 'off', so users
with NO row (missing row = default 'on') were invisible to the
scheduler — autopilot dispatched nothing while the hero said
'Autopilot on'. New SSOT getFleetAutopilotUserIds() decides
enrollment for schedulers; missing rows count as on.
- The stale-run reaper only ran on /api/control page loads: 16 runs sat
'waiting' for 51h until a human looked, then got stamped with
fabricated 51h durations. New hourly reap-stale-runs cron reaps all
users; finishedAt = startedAt + STALE_RUN_MINUTES (truthful).
- Hero headline was mode-derived ('Building' + pulsing green with 0
working and 16/16 failed runs). deriveFleetPulse() (pure, tested)
now derives Building / Waiting to dispatch / Stalled(+Review
failures link) / Paused from live counts + latest outcomes.
- OutcomeStreak ✗ glyphs were unlabeled dead-ends; the streak now
deep-links to /activity?window=week&project=<key>.
- box-runner logged 'connected · last poll 0s ago' every 2s to journald
(~40k lines/day); now logs on state change + 15-min heartbeat.
Presenter tests 25/25 (6 new fleet-pulse cases).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closes the two operational gaps in bridge Parts A/C (FC master plan
Phase 0.4/0.5):
- /api/crons/orangecat-promote-backfill re-emits project_published +
recent devlog promotes for every OC-linked project daily (09:00 UTC
timer added to install-hetzner-crons.sh). Deterministic external ids
make re-posting idempotent — 'best-effort must not mean silently
lossy' is now true.
- promoteMomentToOrangeCat/promoteDevLogEntry return a PromoteOutcome
so the janitor can count posted/skipped/failed (user-action call
sites still fire-and-forget via void).
- Settings → Account gains a Connect OrangeCat row for existing users
(env-gated like the sign-in button); links via the same OIDC flow,
which also unlocks Publish to OrangeCat.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wrap the dispatch-footer wait in a non-throwing gotDispatch check (local +
prod paths). On timeout, record a high-severity weakness and a timeout
screenshot instead of throwing on waitForSelector, so a hung Send produces a
report rather than aborting the whole run. Also force-click the owner-key tab
with a bounded timeout. (Concurrent-session edit, committed to keep the tree
clean — see pattern-concurrent-autopilot-worktree-race.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
npm run dogfood:self drives Control → Loki "Move forward" → Terminal Cloud →
Projects against local or prod (fleetcrown.orangecat.ch), screenshots each
step, and emits a weakness report. Mirrors dogfood:loki (same playwright/
chromium convention, undeclared dep shared by both — tracked as follow-up).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cloud inject always queues even when box-runner is connected; distinguish
runnerConnected in Loki footer, Control toasts, and dispatch-status SSOT.
Add prod dogfood script and dispatch-status tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
Browser-first onboarding and executor-copy SSOT; Loki imperatives and move-forward
route to the same builder queue as Control with cloud-first Terminal links; fleet-kick
queues when offline; deploy script syncs box-runner.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add Build/Pause selected on Control, multi-project command fan-out in Loki,
and route scoped screenshots to dispatch with vision preflight instead of chat.
Co-authored-by: Cursor <cursoragent@cursor.com>
Start building now batch-dispatches next_best on eligible idle projects
(capped at three concurrent) and Loki accepts develop-all phrasing; restore
the daily idle nudge for users with autopilot on after the mode collapse.
Co-authored-by: Cursor <cursoragent@cursor.com>
Route shell FAB and loki:open to /loki with composer prefill; retire the
chat-only modal. Add fleet list/create NL fast paths, project picker chips
for ambiguous dispatches, and a db helper to inspect recent conversations.
Co-authored-by: Cursor <cursoragent@cursor.com>
Merge SLH into surf-your-life on prod, drop orphaned box DB, remove SLH from
hetzner manifest, and wire Bitbaum user_projects dir for local dispatch.
Co-authored-by: Cursor <cursoragent@cursor.com>
Merge Cockpit and empty dupes into canonical entities, delete infra/stub
rows, and ship retire-stale-projects.ts plus merge helpers for future hygiene.
Co-authored-by: Cursor <cursoragent@cursor.com>
Re-ran enrich-prod-profiles against Hetzner — 16 projects now have
architecture/conventions/DoD. Add Groq retry for transient fetch failures.
Co-authored-by: Cursor <cursoragent@cursor.com>
Surface fleet-knowledge chunk counts on /memory, document box RAG ops via
install-fleet-rag.sh, and add rag-retrieval test script. Reindex on production
already active (24 chunks across 21 project profiles).
Co-authored-by: Cursor <cursoragent@cursor.com>
Phone/Loki/beacon dispatches queued bare promptKey strings on the cloud host;
assembleInjectPrompt now matches orchestration/run. Persist architecture/
conventions/DoD from AI briefs, expand injected fields, add build-contract UI,
and reindex profile embeddings on save when RAG is enabled.
Co-authored-by: Cursor <cursoragent@cursor.com>
Hide bottom nav and top bar while drawers/modals are open; improve project
profile header layout, tab bar, and card action sizes. Add mobile pages audit script.
Co-authored-by: Cursor <cursoragent@cursor.com>
Expand/collapse on phones gives xterm usable height; Loki dispatches route
"let's develop" through next_best and link to watch the agent. Profile drawer
follows action-first hierarchy with filtered activity noise.
Co-authored-by: Cursor <cursoragent@cursor.com>
UX — the composer mic was a bare icon. While recording/transcribing it now
shows a Grok-style overlay over the composer: a live animated waveform, a
pulsing record dot, an elapsed timer, and cancel (✕) / confirm (✓) controls
(globals.css ui-voice-*). Transcript still appends to the input.
Backend (a)+(b): the route already orchestrates Groq-first → local-Whisper
fallback. Two fixes to make the fallback real on the box: (1) the local path was
gated by isRuntimeAvailable() (false on the stateless box) — now also enabled by
TRANSCRIBE_LOCAL_AVAILABLE so the box runs it; (2) transcribe.py switched from
openai-whisper (heavy torch) to faster-whisper (CTranslate2 int8, no torch) —
far lighter on the shared CX22. Groq (whisper-large-v3-turbo) verified working.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Make a real Control dispatch run to completion on the box, not just spawn a PTY.
#2 clone-on-demand — src/lib/agent-execution/box-workspace.ts: a dispatch carries
the LAPTOP dir (absent on the box). ensureBoxWorkspace() resolves the project by
tab (name match) → gitUrl → git clone (GITHUB_TOKEN auth) into ~/dev/<key>, or
reuses the dir if it already exists. Hooked into launchAgentPty via dynamic
import gated by FLEETCROWN_BOX_PREPARE (keeps @/db + git off the desktop bundle).
#1 unattended claude — auth was never the blocker (the inference token launches
interactive claude); the blockers were claude's trust-folder gate and per-tool
permission prompts. box-workspace pre-seeds ~/.claude.json
projects[dir].hasTrustDialogAccepted, and the claude adapter adds
--dangerously-skip-permissions gated by FLEETCROWN_RUNNER_UNATTENDED (box-only;
desktop keeps interactive confirmations). Single-tenant owner box — acceptable
per the spec until SandboxExecutor lands.
Verified live: dispatched fleetcrown → cloned from github.com/maonakamoto, dir
pre-trusted, claude launched unattended in the clone.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The headless box-runner is live on the box and verified end-to-end with the
laptop off: presence online via bridge SSE, a launch_agent dispatch claimed +
executed in a FleetCrown-owned node-pty PTY, close_tab cleaned it up, PTY lives
in the box-runner's own process tree (deploy-independent from fleetcrown-app).
- scripts/mint-box-runner-token.ts — mints a ck_ token for the owner + writes it
to the token file (the box-runner equivalent of desktop "install runner").
- scripts/hetzner/install-box-runner.sh — idempotent install/redeploy: rsync
source, mint token if absent, write fleetcrown-box-runner.service, restart.
- Spec marked P0+P1 SHIPPED with the remaining follow-ups (claude /login full
scopes, project clone-on-demand, SandboxExecutor before multi-tenant).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Make the desktop runner core runnable headless on the box. pusher.ts loses its
lone Electron dependency (app.getVersion() → FLEETCROWN_RUNNER_VERSION env, set
by the desktop in index.ts so its behavior is unchanged). scripts/box-runner.ts
is the systemd entry: reuses the EXACT desktop poller + pusher (claim → execute
in owned PTY → stream → ack, presence via bridge SSE), graceful shutdown, run
via tsx from /opt/fleetcrown/runner. See docs/architecture/box-owned-pty-executor.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The embedded xterm had three real defects on the auth path (`claude
setup-token` prints a long OAuth URL):
- Copy was impossible: xterm keeps its selection in a canvas layer, not the
DOM, so the browser's native copy grabbed nothing. Mirror every non-empty
selection to the system clipboard (copy-on-select) + keep ⌘C/Ctrl-Shift-C.
- No paste: add ⌘V / Ctrl-Shift-V → clipboard into the PTY.
- Wrapped links were uncatchable: xterm's link addon detects per visual row,
so a URL wrapped across 5 rows was clickable only on row 1. The byte stream
keeps each URL on one logical line — scan the output and surface whole URLs
in a real-DOM LinkBar (clickable + one-click Copy), independent of wrapping.
Font is already correct GeistMono (verified loaded); remaining gap vs a native
GPU terminal is inherent to a browser DOM-rendered grid.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Make a future rename a one-place edit (APP_NAME in config/brand.ts + _brand.sh).
- Fixed identity chrome to use APP_NAME: PublicFooter copyright, BrandVersion,
releases brand link, landing CTAs ("Open FleetCrown") + hero copy.
- Page metadata titles: dropped the hardcoded "— FleetCrown" suffix so the root
layout's `%s — ${APP_NAME}` template supplies it (also fixes a latent
double-brand). Covers quickstart/download/releases/terms/privacy/license/import-local.
- scripts/check-brand.sh: lists every display-name string that bypasses APP_NAME
(the rename checklist); `--strict` gates CI. Exempts the lowercase `fleetcrown`
SLUG (DB/unit/repo/domain — survives a display rebrand by design) and editorial
prose in content/.
Architecture was already SSOT-correct (34 files use APP_NAME; layout fully
templated). Guard reports the remaining ~60 inline-copy/editorial escapes as the
explicit mop-up list for whenever the rename happens. tsc=0.
Captain-layer RAG — index what only FleetCrown sees across the fleet, never repo
code (the runtime retrieves that itself). Context injection becomes relevance-
ranked instead of profile-dump.
- Local embeddings: scripts/embed-server.py — fastembed BAAI/bge-small-en-v1.5
(384-dim) behind an OpenAI-compatible /v1/embeddings, on the box (no cloud key).
systemd fleetcrown-embed.service.
- src/lib/rag/embeddings.ts — provider-agnostic client (ported from OrangeCat's
convention; EMBEDDINGS_BASE_URL/MODEL/DIM, graceful-off when unset → local dev).
- knowledge_embeddings table (pgvector, vector(384), user_id-scoped) — Drizzle
schema + raw-SQL ingest/cosine-retrieve in db/queries/knowledge-embeddings.ts.
- scripts/reindex-knowledge.ts — backfill project profiles + dev-logs (P0).
- inject-core: dispatches now get a "Relevant context from your other projects"
block retrieved against the task, excluding the project it's for. The engine
under cross-project reference's suggested-references, and the first real fix
for the "memory is the weakest strut" gap.
- docs/architecture/{cross-project-reference,fleet-knowledge-rag}.md — specs.
Verified live on the box: retrieval is semantically accurate (bitcoin→orangecat,
refugee housing→aoz-housing). 24 chunks indexed across 21 projects. tsc=0, eslint=0.
On the hosted box there's no linked GitHub OAuth account (accounts table empty),
so getGithubToken returns null and Hermes couldn't push/PR. Fall back to
process.env.GITHUB_TOKEN (provided by `gh auth login` on the box → its stored
token, repo+workflow scopes). Verified live: the runner now clones, edits via
Hermes, pushes a branch, and opens a PR (fleetcrown#54).
Now that Hermes is installed + Nous-Portal-authed + verified executing agentic
code on the box, wire it end to end:
- run-hermes.ts: real invocation (`hermes -z "<task>" --yolo`, model+creds from
~/.hermes/config.yaml — dropped --ignore-user-config which bypassed the Nous
config). Crucially, it now PRESERVES the work: after the agent edits, commit on
a fresh `hermes/<slug>` branch, push, and open a PR via the GitHub API. No
auto-merge — a human reviews. No-op runs report "no changes" honestly.
- inject-core.ts (producer): when a WORK dispatch queues with the local Fleet
Runner offline, auto-enqueue a hosted_dispatch so Hermes makes the change and
opens a PR instead of the command waiting forever. Gated: real git URL + not a
lifecycle (close/stop) command. Hermes uses its own Nous model, so we don't
pass the local agent's model pref. Response surfaces hostedDispatchId.
- hosted-runner.ts: surface the PR URL / branch in the executed-command result
and dev log.
tsc=0, eslint=0.
- hosted_dispatch command type + enqueueHostedDispatchCommand (pending-commands.ts):
write-class tasks, distinct from read-only hosted_analyze and the local-runner path.
- scripts/hosted-runner.ts: the worker now claims BOTH hosted types and routes —
hosted_analyze → Groq read-only analysis (Phase 0); hosted_dispatch → runHermesTask
(Phase 1, orchestrate Hermes in its own sandbox). Verified: dispatch routes to
Hermes and reports a clean needs-install result (no crash) until the CLI is
provisioned. The whole path is ready the moment a Hermes credential lands.
- docs/positioning.md: the captain's-bridge one-pager — what we are (orchestration
layer over runtimes), what we're NOT (a runtime), the layer model, the moat
(cross-model verification + governance + economy), honest status.
- content/thoughts/the-harness-not-the-prompt.md: essay — leverage moved from
prompt engineering to harness engineering; FleetCrown is a harness at fleet scale;
maps our shipped pieces (profile-as-context, cross-model DoD gate, the loop) to
harness primitives, and names memory as the weakest strut.
(Recovers the box too: the prior Hermes-spike deploy failed on a missing `ws`
dep the fleet's Loki-gateway commit added; npm install fixed local node_modules,
so this build is clean.) tsc=0, eslint=0.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The read-only analysis core now runs the real runner loop, verified end-to-end:
- setRunnerConnected (runner-presence.ts): a hosted runner registers presence
(no bridge SSE), so a project stops showing fully dark while the operator's
laptop is off. Phase-0 simplification noted (shared presence boolean).
- hosted_analyze command type + enqueueHostedAnalyzeCommand (pending-commands.ts):
its own type so it never collides with the local-runner dispatch/inject path.
- scripts/hosted-runner.ts: the worker loop. Persistent mode claims presence +
polls; --once is a one-shot drain (cron-style) that does NOT claim persistent
presence. Each claimed command → getProjectContext + getGithubToken →
analyzeRepo → markCommandExecuted({ok,text}) + appendProjectDevLog so the
result shows on the project. Stale-claim reclaim + purge come free from
claimNextPendingCommand.
Verified locally: enqueue → presence ON → claim → clone+analyze a real repo →
report (result.ok, devlog) → presence reset. tsc=0, eslint=0.
Next (operational): run the worker as a box service (DATABASE_URL + GROQ_API_KEY)
so the founder's projects actually get a hosted runner; then a UI trigger
("Analyze on hosted runner"). Phase 1 swaps analyzeRepo for a sandboxed coding
agent. See docs/architecture/hosted-ephemeral-runner.md.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Privacy: the public /u/<username> profile + the greeting were showing the
operator's REAL name — "George" (hardcoded in seed.ts) and username "gbutaev"
(suggestUsername auto-derives a handle from the OAuth profile's real name). The
operator runs pseudonymously (Mao Nakamoto) and never typed either. Fixes:
- seed.ts seeds the pseudonym, never a real name (it surfaces on a public URL).
- The owning user's name/username were corrected to the pseudonym in both DBs.
- jwt callback now self-heals not just an orphaned id but a drifted username/name
too (compares cached token to the DB), so renaming an account propagates to the
session and the public profile it links to — instead of stranding the operator
on a now-dead /u/<old-handle>. token.name is refreshed too (fixes the greeting).
Thoughts: "The Captain Needs a Ship" — the agent-tool landscape (Claude Code,
Grok Build, Hermes, Codex, OpenClaw) is converging on a worker substrate (loop,
verifier, skills, memory, HOSTED execution). FleetCrown's bet is the captain
tier, but it borrows the operator's laptop to run the fleet — the keystone gap
behind every "runner offline" wall. The essay ranks the substrate gaps and why
hosted ephemeral execution is the one that unblocks the rest.
tsc=0, eslint=0, test:auth 13/13.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The pinned-deploy guard protected the box but not local. deploy-hetzner.sh
--ref checks HEAD==REF after the build and aborts the BOX rsync on drift — but
`npm run build`'s postbuild (deploy-local.sh) had already restarted the LOCAL
systemd service with the just-built (possibly torn) standalone. So a `git
checkout` mid-build left local prod on a torn tree even though the box was safe,
and the "not shipping a torn tree" abort message was misleading.
Fix: deploy-hetzner.sh exports FLEETCROWN_DEPLOY_REF into the build env;
deploy-local.sh skips the local restart when that's set and HEAD has drifted
from it. Now a mid-build branch switch restarts nothing — local and box
consistent — and the abort message says so. (Root cause was running git ops
during a backgrounded deploy; the guard is now airtight against it on both ends.)
bash -n clean on both scripts.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The /goal pattern. closeRunFromSession closes a run the moment the agent writes
status: ready — the agent grading its own homework (Ralph Wiggum). When a project
declares a definition_of_done (now a first-class profile field, injected into
every dispatch), the close is gated by a DIFFERENT-lineage model:
- dod-gate.ts: verifyDefinitionOfDone(dod, handoff) — gpt-oss-120b (not the
worker's lineage) reads the handoff against the stated bar, returns {met, gap}.
Fail-OPEN (a judge error lets the run close rather than wedge the loop).
- applyDoDGate (pure, unit-tested): a SUCCESS close with an unmet bar is
downgraded to "partial" with the gap written into `next`, so autopilot's
existing continue-loop keeps working instead of stopping. Only gates success;
error/partial are untouched.
- Wired at the control close seam, fire-and-forget + an in-flight guard so the
judge fires at most once per run and never blocks the control response.
This makes "done" an objective, cross-model-verified condition per project —
the lever the loop-engineering literature calls the real one. scripts/test/
dod-gate.ts (7 cases) added to the pre-push suite. tsc=0, eslint=0.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The second half of the frontier loop, and the differentiated one: turn each
day's digest into concrete proposals for how FleetCrown should evolve. The loop
AUTO-PROPOSES ONLY — a human accepts (→ a roadmap goal) or dismisses; it never
builds on its own (building straight from a news feed is exactly the ungoverned
action to avoid). Decision history grounds the next run so nothing is re-proposed.
Brain (src/lib/frontier/propose.ts):
- generateProposals — Groq, grounded in FleetCrown's mission + the owner's
active goals + already-considered titles. Returns ≤3 specific proposals, each
tying a real frontier item to a FleetCrown capability; empty list is the
correct (and common) answer. sourceUrls validated against the real digest.
- critiqueProposals — an adversarial reviewer that defaults to REJECTING and
scores 0-100; only ≥70 reach a human. The `model` param is the cross-model
verification swap point (callGroqText now takes a model override): point the
judge at a different model than the generator for uncorrelated errors.
- Code-level Jaccard dedup as a net beyond the LLM instruction.
Wiring:
- run.ts runFrontierProposals: target = owner of the "fleetcrown" entity
(resolved, not hardcoded) → generate → critique → store survivors.
- The daily cron runs it after the digest (best-effort; never fails the digest).
- frontier_proposals table (status proposed|accepted|dismissed, score, links).
- /api/frontier/proposals (GET list) + /[id] (POST accept→createGoal / dismiss),
owner-gated via requirePrivateApiAccess.
- /system: FrontierProposalsCard inbox (server read) + ProposalRow (client
Accept/Dismiss). Accept reuses createGoal; provenance links fold into the goal.
Verified: tsc=0, eslint=0; full local run drafted 3 / surfaced 3 real proposals
(78-90) from today's arXiv items; accept→goal path tested + cleaned up.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A daily auto-generated digest of the latest AI, robotics, and frontier-tech
developments. First increment of the dual-purpose goal: the public surface
(credibility + a daily reason to return). The self-improvement half (mining the
digest into roadmap proposals) is the next increment.
Pipeline (all server-side, no agent runtime):
- ingest.ts pulls curated sources — arXiv cs.AI/cs.RO/cs.LG RSS + Hacker News
(Algolia, points-gated, 3-day window) — dedupes by URL. Titles/links always
come from real feeds, so they can never be hallucinated.
- digest.ts has Groq act as editor: it returns only INDICES into the candidate
pool plus a one-line "why it matters" per pick, a headline, and an intro.
Deterministic fallback (top-N by source score) if the model errors/returns junk.
- run.ts ties ingest → rank → upsert (frontier_digests, one row per day).
Surfaces:
- /api/crons/frontier-digest — daily cron (requireCronAuth), 08:00 UTC via
install-hetzner-crons.sh.
- /frontier — public page (PublicSurface), new ui-frontier-* Layer-3 classes.
Added to the public route matcher (proxy.ts) and PUBLIC_NAV (config/auth.ts).
- scripts/seed-frontier.ts — manual regeneration / ranking iteration.
Verified: tsc=0, eslint=0; seed run produced a real 8-item digest from 19
candidates across 6 sources via llama-3.3-70b-versatile.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(ux): quick-win batch from the action audit
Four honest/routing fixes surfaced by the full UX audit:
- proxy.ts: /privacy /terms /license /docs/quickstart were auth-gated (missing
from the public matcher) — logged-out footer clicks bounced to sign-in. Now public.
- projects/[id] GET: the response omitted gitUrl, so the project detail DRAWER
showed no repo link for GitHub-imported projects (the grid card worked). Added.
- DesktopDownload: macOS + Windows were marked status:'ready' but ship no asset
(Linux-only) → the auto-detected Download CTA 404'd. Flipped to 'comingSoon'
and added the ComingSoonPanel branch (watch-releases + use-web CTA) the config
comment always promised but was never implemented.
- changelog.ts: added the real v0.8.9 entry (was stale at 0.8.8 vs the live
release) so the footer version pill + /releases are current.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(control): always surface the capacity banner when autopilot can't act
Chasing the auto-reroute banner gate (after the SSE/GET session fix made the
data correct) revealed a UX gap: shouldShowManualCapacityBanner returned false
under autopilot for 'tab-closed' — so a project that hit a rate-limit wall but
isn't running showed NO indicator and NO call to action. A capacity wall must
never be silently invisible.
Now surfaces the manual banner under autopilot whenever autopilot CANNOT act on
its own (all-tried / no-fallback / tab-closed). For a not-running project,
clicking Switch still persists the agent preference for the next launch. When
autopilot CAN act, the auto banner shows instead. Test asserts the tab-closed case.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes the SSE/GET divergence found while dogfooding auto-reroute. On the local
runtime the GET /api/control fell back to the persisted project_states row
(parseSession ?? dbState), but the SSE stream's local path (readFastState) was
file-only with no DB fallback. So a project whose session .md was absent but
whose project_states row persisted showed its session via GET yet null via the
live (SSE-driven) page — which hid the auto-reroute capacity banner.
src/lib/project-session.ts is the SSOT:
- dbRowToSession(r): the one project_states -> SessionState projection (was
duplicated inline in the GET route and the stream's dbToFastState).
- resolveProjectSession(fileSession, dbRow) = fileSession ?? dbRowToSession(dbRow).
Used by all three sites: the GET fallback, the stream's dbToFastState (cloud),
and the stream's local scanProjects (which now fetches project_states and fills
null sessions — the fallback it was missing). The two paths can no longer drift.
Contract test (test:project-session, wired into pre-push): file-present wins,
file-absent-DB-present surfaces the row, neither -> null, GET/SSE identical.
Implements milestone 1 of the 'Single derived-state read-model' roadmap goal.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(control): auto-reroute agents on capacity walls under autopilot
Closes the loop from 'we can resolve a fallback' to 'we reroute live.' When
a project hits a rate-limit/quota wall (detectCapacityIssueFromProject) and
autopilot is on, FleetCrown now switches to the next installed fallback agent
itself via the existing switch-agent path — no human click. With autopilot
off, the manual CapacityIssueBanner is unchanged.
- src/lib/auto-reroute.ts: pure, tested decision (decideAutoReroute +
shouldShowManualCapacityBanner). Loop-safe: AGENT_FALLBACK_ORDER cycles, so
a per-episode tried-set stops an all-exhausted fleet from churning and
surfaces a manual banner instead.
- ProjectCard: act once per distinct session state (mtime + outgoing agent)
so a switch landing (which lags the poll) can't re-fire or flash a false
'exhausted'; autopilot-gated; reuses performAgentSwitch.
- CapacityIssueBanner: 'auto' (switching…) and 'exhausted' variants.
- scripts/test/auto-reroute.ts (npm run test:auto-reroute): 12 cases incl.
loop safety + skip-gate priority.
First increment (client/control surface). Follow-up: same decision server-side
in the beacon path for headless reroute when no browser is open.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(beacon): headless auto-reroute on capacity walls (no browser needed)
Increment 2: the /control auto-reroute only fires while the page is open.
The beacon path runs server-side when an agent's session ends, so it reroutes
unattended — the real fleet-operation win. The beacon already detected the
capacity issue + computed the fallback (resolveNextAvailableAgent) and only
stored it; now it acts.
- src/lib/auto-reroute.ts: decideHeadlessReroute + MAX_AUTO_REROUTES_PER_WINDOW.
Loop safety without a client ref = DB guard: cap auto-switches per project
per 15-min window (one full fallback cycle, then stop) + skip while a switch
is still unclaimed.
- db/queries/pending-commands.ts: recentSwitchAgentStats(userId, tab) →
{windowCount, pending}, windowed so a dead unclaimed command can't block.
- api/beacon/route.ts: on capacityIssue, resolve effective autopilot
(per-project override ?? global) + dir/tab, then enqueue switch_agent.
Best-effort — never blocks or fails beacon creation.
- 7 new headless test cases (19 total).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The push-deploy hook backgrounds the box deploy with `sleep 5 & disown`, then
deploy-hetzner ran `npm run build` on the floating working tree. If you switched
branches in that window, it built+shipped the WRONG ref — it once shipped an
off-main feature branch to the production box.
The hook now captures HEAD at push time and passes it as --ref. deploy-hetzner
guards on it: build only when the working tree is STILL on that commit, and
re-check HEAD after the build so a switch mid-build can't ship a torn tree; on
drift it skips loudly with recovery instructions rather than shipping wrong code.
(An isolated git worktree would auto-recover the right ref, but Turbopack rejects
an out-of-root node_modules symlink, so we guard in-place instead.)
Verified: --ref to a non-HEAD sha skips before building (exit 1, no box touch);
matching ref takes the unchanged build+rsync+verify path.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
deploy-local.sh did `rm -rf <dir>; cp -r <dir>` for static/public/content,
leaving a multi-second window where the LIVE standalone dir was missing or
half-populated. The running server reads content/*.md at request time, so
/whitepaper (and broken CSS/JS) 500'd on every deploy until the copy finished —
exactly the marketing-page outage window we want gone.
swap_dir() builds each tree in a sibling temp dir then renames it into place:
the only window where the live dir is absent is between two consecutive renames
on one filesystem (microseconds), not seconds. Applies to .next/static, public,
content, and the node-pty build. Also clears swap temporaries left by an
interrupted deploy. Verified: content swapped with no nesting, no stray temps,
/whitepaper stays 200.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
brand.ts documents scripts/_brand.sh as the shell-side mirror of APP_NAME /
APP_SLUG / APP_DOMAIN — the rebrand lever for shell consumers — but the file
never existed. Shell scripts had no SSOT to read from, so a future rename had
no lever on the shell side despite the docs claiming one (Ground Truth #2).
- Create scripts/_brand.sh: the four canonical values + derived URLs, sourcing
guard, and a note on why APP_SLUG (infra id: DB, systemd unit, paths) stays
stable on a display rebrand.
- Wire its one genuine consumer — scripts/hetzner/verify.sh now sources it for
the FleetCrown health check + bridge domain (other products keep their own
identifiers). Not a mass rewrite; slug-tied infra is intentionally untouched.
- Add scripts/test/brand-sync.ts (test:brand-sync) enforcing that the shell
mirror never drifts from brand.ts, wired into the pre-push hook. Turns "keep
in sync" from a comment into a guarantee.
tsc clean, eslint clean, 6/6 brand-sync assertions, drift case verified to fail.
The pre-push schema-drift guard (#16) runs against the LAPTOP database, but the
Hetzner box has its own Postgres — so a table added in code but never pushed to
the box would silently 500 the first feature that queries it on prod (the same
failure that took down /prompts, /loki and System cron locally). deploy-hetzner
had no schema step at all.
- check-schema-drift.ts gains a `--print` mode: emit the schema-declared table
names (no DB needed) so a remote deploy can compare against a database the
laptop can't reach directly.
- deploy-hetzner.sh post-deploy verification now prints the declared tables,
fetches the box's public tables over ssh (box reads its own DATABASE_URL),
diffs them, and fails LOUDLY listing any missing — telling the operator to run
drizzle-kit push rather than trusting a half-broken deploy.
Verified on a live deploy: "✓ schema: all 45 declared tables present on box".
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Drizzle schema (src/db/schema) is the SSOT for what tables must exist, but
nothing in the deploy path runs drizzle-kit push. A table added in code reaches
the box unmigrated and silently 500s the first feature that queries it — exactly
how `prompts`, `cron_jobs`, `conversations` and `conversation_messages` went
missing and took down /prompts, /loki and the System cron list this session.
Add scripts/check-schema-drift.ts: compares schema-declared table names against
the live DB's public tables, exits 1 (listing the missing tables + the migrate
command) if any are absent. Strictly READ-ONLY — never creates/alters/drops.
Loads .env.local itself and skips cleanly (exit 0) when no DB is configured or
the DB is unreachable, so it never blocks a push for infra reasons.
Wired in two places:
- .husky/pre-push runs `npm run check:schema` — drift becomes a push-time error.
- scripts/deploy-local.sh prints a non-fatal warning on every local build, so
drift surfaces at rebuild time too (a plain `npm run build` doesn't push).
Verified: reports "all 45 declared tables exist"; before this session's manual
table creation it would have listed the 4 missing ones.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Dispatches can capture the fully-assembled prompt — context tiers plus harness
envelopes — so activity feeds rendered noise like "<task-notification><task-id>…"
as the title of every run. promptDisplayBody now runs a pure sanitizer that drops
<task-notification>/<system-reminder>/<command-*> blocks and stray harness tags,
falling through to the next source (resolved prompt → intent label) when a value
is all scaffolding. It only rewrites when a harness tag is actually present, so
clean prompts — and their whitespace — pass through verbatim. Fixes the titles on
both the /control Activity panel and the project-profile feed (PR #7).
Pure function, covered by 3 new prompt-history test cases (now 7/7).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>