Local-only daemon installs were silently broken: prompts queued from
localhost:3000 sat unclaimed because the daemon polled cloud, and "Not
running / Workspace tab open" contradicted itself on every project card
whose Zellij tab was open without an agent. This change wires both
sources, auto-launches the configured agent when its tab is empty, and
honestly labels tab-open-but-untracked state.
Daemon (scripts/cockpit-daemon.sh, _agents.sh, agent-hook-lib.sh):
- COCKPIT_BASE_URLS=local,cloud forks one child per extra URL so both
cockpit-app instances drain to the same machine; per-URL flock so
the children coexist.
- execute_inject auto-launches the chosen agent when none is running in
the project dir, then polls 20s for the process before injecting —
fixes prompts being typed into a bare bash shell.
- Wrap every `zellij action` call in `timeout 3` so one hung subprocess
no longer freezes the single-threaded dispatch loop.
- Delete the obsolete _base_url local-probe / DAEMON_FORCE_REMOTE
branch; each child now owns exactly one URL.
Auth (src/lib/session.ts):
- Legacy COCKPIT_DAEMON_TOKEN bearer was short-circuited by the `ck_`
prefix check, returning 401 against local cockpit-app. Fall through to
the legacy env-var path when the ck_ token isn't in the DB.
Control UI (ProjectCard, control-presenter, ZellijLivePanel,
project-intent-panel, ControlPanel):
- Idle + tab-open + !session-open → badge reads "Tab open" (was
contradictory "Not running"); evidence line and intent-panel copy
follow suit.
- Hide Launch CTA + saved-handoff block when the workspace tab is
already open — they were inviting the user to "launch" something
the daemon would have to refuse.
- Replace autonomy hint when tab is open but no agent is tracked.
- Surface "Last dispatch <age> · <prompt>" in the header evidence line
so the cloud UI shows what was sent without scrolling to Activity.
Malformed Vercel VAPID keys caused setVapidDetails to throw; wrap configure
and notify in try/catch. Use STALE_CLAIM_SECONDS in reclaim SQL.
Co-authored-by: Cursor <cursoragent@cursor.com>
Runtime presenter no longer requires agentRunning for Working; handoff
status:working does not stale an active prompt; fleet status bar for mobile.
Co-authored-by: Cursor <cursoragent@cursor.com>
Session-handoff watchdog fires when status:ready is fresh; Stop hook runs
autopilot first and queues inject via /api/inject with bearer fallback.
Co-authored-by: Cursor <cursoragent@cursor.com>
Adds a mic button to the command palette that records a clip, posts to
/api/control/transcribe, and fills the search input with the transcript.
The user can then select a matching prompt with Enter — same flow as
typed search.
- New /api/control/transcribe route — re-exports POST from the existing
/api/beacon/transcribe so Whisper/Groq routing stays a single source
of truth during the beacon retirement. Implementation moves to this
file in Stage 6 when the beacon route is removed.
- New use-voice-input hook — wraps MediaRecorder with state lifecycle
(idle → recording → transcribing → idle / error), auto-stop at 60s,
graceful cleanup on unmount. Greenfield extraction from the
BeaconClient mic code so any surface can light up voice cheaply.
- CommandPalette: mic button between input and Esc kbd. Pulses while
recording (oklch ring). Transcript fills the search input; errors
surface in a one-line band beneath.
Voice-driven dispatch (palette → project picker → /api/inject) lands
later — Stage 5 wires push so the autopilot ↔ user loop closes first.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Folds the shell pass into Stage 3 of the autopilot rollout. Three new
surfaces and four restraint passes — designed to look closer to x.ai
(quiet chrome, type-driven hierarchy, soft separation) without breaking
the existing design-token contract.
New surfaces (all SSOT, all ui-* classes):
- CommandPalette — global ⌘K / Ctrl-K / `/` opens a searchable list of
every agent prompt (~/.config/agent-prompts.json), every built-in
PROMPT_TEMPLATE, and every active route. Recent selections survive
in sessionStorage. Click → navigates to /control (agent), /prompts
(template), or the route. Arrow keys + Enter; Esc closes.
- AppTopBar — slim sticky bar above <main>; only content is the
palette trigger for now. Reserved on the right for Stage 5's push
status pill and the eventual account chip.
- AppFooter — micro strip at the bottom of <main> on desktop. Env
badge + commit SHA + link to /system. Counterweight to the sidebar.
Shell polish (from the x.ai-aligned review):
- ui-sidebar: hard 1px border → inset 0.04 opacity shadow; soft edge.
- ui-mobile-nav: backdrop-blur-xl → -md, less visual artifact.
- ui-nav-item-active: drop the full border, swap for a 2px left-edge
accent. Reads as a marker, not a card.
- ui-sidebar-utility: tighten px-4 py-2.5 → px-3 py-2 so the footer
utilities don't out-weigh the nav items above them.
- SidebarNavItem: nav descriptions go quiet at rest (opacity 0) and
reveal on hover or active. Row height unchanged; calm at rest.
State management for the palette uses React Context (no new deps).
Hotkey listener lives in AppShell; trigger button is in AppTopBar.
Slot concept stays untouched in the data layer — the palette simply
doesn't surface it; Stage 6 removes the dead slot-driven code paths.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the two-layer popup race (KDE D-Bus notification + Chrome --app
beacon window + /tmp/beacon-choice polling) with a single POST to
/api/control/dispatch. The hook now becomes a thin autopilot client:
Stop → readyAt + finish_run + worker.finished (unchanged lifecycle)
→ push_notify_stop (Stage 5 lands the endpoint; silent until then)
→ autopilot_dispatch_and_inject:
auto_inject_mode=off → idle
server returns composed → inject strategist prompt
server returns queue → inject queue head, dequeue
server returns nextbest → inject canned next_best with session
server returns off → idle (queue empty, etc.)
Removes ~250 lines of choice-file race, beacon_launch helper, and slot/
custom/switch popup branches. handle_stop drops from ~280 lines to ~70.
beacon_launch is unreferenced and deleted; notify-choice.py + beacon.py
will be repurposed/removed in Stage 6.
Cockpit's promise is autopilot. The Stop hook is the moment that promise
pays off — and the popup was the thing in the way.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cockpit's promise is autopilot — agents keep working when you're away.
The "queue_only" default introduced 2026-05-25 silenced the strategist on
day one, leaving new users in a non-autopilot product. Safety rails are
already in /api/control/dispatch (manual override, health gate, hard_stop,
queue priority) and the Stop hook respects them; the day-one risk that
prompted the flip no longer applies after /control became trustworthy in
6da8d7e + 7d7c40a.
Centralizes the default in DEFAULT_AUTO_INJECT_MODE (src/lib/constants/
control.ts) so the schema, queries, Settings UI, and Python/shell fallbacks
all source one constant. Adds an inline self-test (test:autopilot-defaults)
that pins every fallback to the autopilot value, wired into pre-push.
Existing users keep their explicit choice — only NEW rows get strategist.
The Drizzle migration is idempotent and reaffirms the column default.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a claude case to _agent_direct_activity that reads the most recent
~/.claude/projects/<dashed-cwd>/*.jsonl mtime. The daemon already consumes
this signal for grok; with claude wired in, prompts typed straight into the
TUI (no Cockpit dispatch sentinel) surface as Working instead of falling
through to Agent shell open.
Gates direct-terminal evidence on readyAt so a just-finished agent stays
Ready: a Stop hook fires after the last transcript write, and without the
gate the next daemon tick would re-promote the stale mtime back to Working
and overwrite the legitimate ready badge.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This is the UI the user is asking to see live + the reflection fixes for direct terminal use (Cockpit tab showing correct agent).
Part of the approved zellij-control + terminal-reflection plan.
The /sign-in page has an "Owner key" tab driven by LOCAL_AUTH_PASSWORD.
That tab signs in via the "local" Credentials provider, which auths
against getDefaultUser() — meant for single-tenant installs (the
founder's local cockpit-app, where they're the default user). But
LOCAL_AUTH_PASSWORD is also set in Vercel prod for legacy reasons, so
the tab renders to every visitor on cockpitapp.vercel.app. Harmless
today (no is_default=true user on Neon prod, auth always rejects with
"user-not-found") but confusing for new customers and a brute-force
surface if someone later mistakenly marks a prod user is_default.
Add a structural ENABLE_OWNER_KEY=1 gate (defense in depth):
• src/app/sign-in/page.tsx — UI tab only renders when both
LOCAL_AUTH_PASSWORD set AND ENABLE_OWNER_KEY === "1". Cloud has
the password but not the flag, so tab stays hidden.
• src/auth.ts — "local" Credentials authorize() returns null with
user-not-found if ENABLE_OWNER_KEY !== "1". UI gate alone wouldn't
stop a direct POST to /api/auth/callback/credentials/local;
runtime gate closes that path too.
• .env.example — documents the new variable and the rationale
(LOCAL_AUTH_PASSWORD alone no longer enables Owner-key tab).
Local cockpit-app's .env.local has been updated separately (not
committed; gitignored) to add ENABLE_OWNER_KEY=1, so the founder's
existing Owner-key login keeps working after the next rebuild.
Cloud impact: Owner-key tab disappears from /sign-in for every cloud
visitor. New customers see only Email and OAuth providers — cleaner
onboarding signal, no "what's an Owner key?" confusion.
Coordinated with the LOOP v2 deploy to ~/.config/agent-prompts.json
(out-of-git; backup at agent-prompts.json.bak-20260525-164621). The
prompt body and the handoff template ship atomically — buildPromptWith
Session() is the only emitter of the trailing handoff block per the
prompts-system.md SSOT rule "Never duplicate the handoff instruction in
the prompt body."
What changed in the 9-field template:
• status: kept (functional — daemon dispatch gates on 'ready')
• last-3-same-dir: NEW (gravity signal — LOOP v2 rule 5 fires on this)
• wip-or-revert-in-last-5: NEW (thrashing signal)
• tsc: NEW (replaces vague "health" composite)
• lint: NEW (replaces vague "health" composite)
• tests: kept (real signal, already worked)
• todos: now explicitly auto-computed via `rg -c '(TODO|FIXME|HACK)' src/`
• done: kept
• next: changed — "state to resume from, NOT a verb. EMPTY if nothing
mid-flight; empty > lie." Stops the agent writing "continue the
sweep" when the sweep is done, which the previous session then
obeyed as if real.
• health: REMOVED — vanity field. "good" written reliably exactly when
the loop was in trouble. Replaced by the six constituent signals
above.
Gravity signals come FIRST in the template so the next session reads
them before any commit-summary narrative — can't be lulled by a tidy
story when the underlying state is repetitive.
Each new signal includes the exact shell command in a trailing comment
so the agent (any agent — Claude, Codex, Gemini) has the canonical
computation, no interpretation room.
This unlocks every LOOP v2 rule that references roadmap.md, blockers,
gravity, or recent-message scan — the prompt body deployed in the JSON
is now matched by a handoff that captures the data those rules need.
Today a fresh customer signing up gets the strategist firing autonomous
prompts at their projects the moment the daemon connects — Groq composing
prompts from context the customer never saw, with no human in the read-loop
between turns. That IS the closed-loop drift failure mode the prompt-design
conversation just spent a day diagnosing, made concrete and shipped to
every new user on day one.
Flip the default from "strategist" to "queue_only". New users must
explicitly opt into autonomous loops via /control settings. Existing
users with a beacon_settings row keep their setting (including the
founder, who explicitly chose strategist long ago — DB DEFAULT only
applies to new INSERTs, existing rows untouched).
Four touchpoints, all aligned:
• src/db/schema/beacon-settings.ts — column default + explainer comment
• src/db/queries/beacon-settings.ts — DEFAULTS{} when row absent + coerceAutoInjectMode fallback
• src/app/api/control/dispatch/route.ts — `?? "queue_only"` fallback for missing-settings race + leading comment
• src/components/settings/BeaconSettings.tsx — useState initial (cosmetic; replaced by fetch)
The single highest-leverage commit from the prompt-design conversation —
binary protection for every new user against autonomous-strategist drift,
zero behavior change for existing users.
Bootstraps the very first roadmap.md primitive at
~/.claude/sessions/Cockpit.roadmap.md, where this change is the inaugural
DONE entry and the full LOOP v2 / strategist-guardrails / blockers-
primitive / dispatch-wrapper / daemon-signal-computation plan is T1.
After f3a08fd a new customer's daemon supports all three agents, but it
still dies on shell exit — the install incantation says "start the
daemon: ~/.local/share/cockpit/cockpit-daemon.sh" which is a foreground
process. The `--install` flag was supposed to register a systemd user
service via install-daemon.sh, but that file wasn't in the bundle and
the agent CLI only looked in process.cwd()/scripts/.
Three-file change:
• route.ts FILES + next.config.ts outputFileTracingIncludes add
install-daemon.sh (now 12 files in the bundle).
• cockpit-agent.js --install handler now prefers ${DAEMON_DIR}/
install-daemon.sh, falling back to process.cwd()/scripts/install-
daemon.sh for developers running from inside the repo.
install-daemon.sh's existing structure works in the flat ~/.local/share/
cockpit/ layout without modification: WorkingDirectory + ExecStart use
$SCRIPT_DIR (= the daemon dir, all 12 files siblings), and the token
arrives via env from the CLI's spawn — bypassing the PROJECT_DIR/
.env.local fallback that would have been wrong for non-clone users.
After this, `curl … | node - init --token ck_… --install` enrolls the
daemon as a systemd user service in one shot — survives shell exit,
reboot, and restarts on failure.
The 4-file bundle that 02c2551 shipped is enough for a new customer
running the Claude agent — but agent-hook-bridge.sh references seven
more sibling files at $SCRIPT_DIR, and absence is silent failure:
• run-codex-task.sh / run-gemini-task.sh — HARD fail when dispatching
those agents (the bridge invokes `bash $SCRIPT_DIR/run-<agent>-task.sh
...` with no fallback path; tab gets the command but the runner
doesn't exist)
• beacon.py (+ _beacon_config.py import) — audio beacon silently no-op
• get-idle-secs.py — X11 idle detection falls back to "always idle"
• notify-choice.py — zenity prompt silently fails
• sync-agent-runtime-config.py — silent no-op
Each Python helper is wrapped in `|| true` / `2>/dev/null` in the
bridge so the daemon doesn't crash, but the feature degrades and the
user has no signal why. The codex/gemini runners DO crash dispatch
for those agents.
Two-file change: add the 7 missing files to FILES in route.ts and to
outputFileTracingIncludes in next.config.ts. All cross-references in
the added files resolve within the bundle (run-*.sh call back into
agent-hook-bridge.sh; beacon.py imports _beacon_config — both shipped).
Bundle grows from 4 files / ~20 KB compressed to 11 files / ~28 KB —
still under one HTTP round trip.
Verified locally with the same pure-Node ustar builder the route uses
(scripts/test-tar-v2.mjs equivalent): all 11 files extract at the
destination root, bytes-identical to repo source, 0755 mode, valid
under system `tar -tz`. Tsc + eslint clean.
After this lands, a new customer's daemon supports Claude, Codex, AND
Gemini agent dispatch end-to-end without a repo clone.
The documented install path is curl … | node - init, but node consumes
process.stdin to receive the script body, leaving stdin at EOF by the
time the script runs. If the user omits --token, the prompt() call
printed "Paste your ck_* agent token:" and silently terminated — the
readline closed immediately on EOF, the answer was empty, the next
check exited the process with no useful error to the user. Verified
the silent failure locally before fixing.
Two changes:
1. prompt() now opens /dev/tty directly when process.stdin isn't a
TTY, so the user can still type a token even when the script body
came in through a pipe. Standard installer pattern (rustup, brew,
nvm). Falls back to process.stdin where /dev/tty doesn't exist
(Windows) — in that case --token is the only path forward.
2. Before prompting, check that we have *some* TTY (stdin or stdout).
If neither is a TTY (CI, sandboxes, daemons), exit 2 with the
clean message "Non-interactive environment: pass --token ck_… as
an argument." instead of hanging on an unread prompt.
Verified:
• cat agent.js | node - init (no token, no TTY) → exits 2, clear msg
• cat agent.js | node - init --token ck_invalid → 401 as before
• Tsc/eslint clean.
After 02c2551 (init now installs daemon scripts to ~/.local/share/cockpit/)
and fcc56f1 (route verified live), three customer-facing lines in the
agent CLI were still wrong:
• `init` command description didn't mention daemon install — said only
"Save daemon token and verify connectivity"
• "After init, start the daemon: source ${ENV_FILE} && cockpit-daemon.sh"
assumes cockpit-daemon.sh is on PATH (it isn't); correct path is
${DAEMON_DIR}/cockpit-daemon.sh
• Both the help Examples and the soft-fail retry hint referenced
`npx @cockpit/agent init` — a command that does not work because the
package isn't on npm; new customers can only get here via curl|node
Rewrites the help to:
- Describe what init actually does
- Document the install/upgrade incantation (curl|node -)
- Show the correct daemon start path
- Keep --install in the option list but note it's repo-clone-only for
now (the only path that still works there; ship a proper
~/.local/share/cockpit/install-daemon.sh in a follow-up)
Soft-fail retry hint now prints the same curl|node command with the
token already filled in, so the user can paste and retry without
having to remember the form.
Verified the route live and it returns HTTP 500 "Daemon bundle unavailable" —
my catch block from the spawn("tar", ...) path. Vercel's serverless runtime
either doesn't have the tar binary or spawn can't reach it from a Node API
route. Either way, depending on a system binary for an installer endpoint
is fragile.
Replace with a pure-Node ustar implementation: one 512-byte header per file
(name + mode 0755 + size + mtime + ustar magic + checksum), content padded
to a 512-byte boundary, then a 1024-byte end-of-archive marker, all gzipped
via Node's built-in zlib. ~50 lines of format-spec code, zero external
dependencies, zero system-binary dependencies.
Verified locally against the same scripts/ directory the route reads from:
• Output is a valid tar.gz (system `tar -tz` lists the 4 expected files)
• Extracts at the destination root with 0755 mode
• Bytes-identical to the repo source
Error catch now also reports the message + stack in the JSON body so any
future regression is diagnosable from `curl -s | jq` instead of needing
Vercel runtime logs.
Closes the second half of the connect-step gap. Last week's 422873a
made `curl|node - init --token X` reachable for new customers (the
agent CLI was served via /api/agent/install). 15727a7 added an
honesty disclaimer that the daemon scripts still required a Cockpit
repo clone. This commit removes the disclaimer by shipping the
scripts the same way.
• New /api/agent/daemon route spawns `tar -czf - -C scripts/ …`
with the 4 daemon files (~1500 lines bash: cockpit-daemon.sh,
_brand.sh, agent-hook-lib.sh, agent-hook-bridge.sh) and returns
the gzipped tarball (~20 KB).
• next.config.ts outputFileTracingIncludes pins those 4 source
files to the route so Vercel ships them in the bundle (the route
reads them via spawn at runtime — they'd otherwise be tree-shaken).
• src/proxy.ts matcher exception adds api/agent/daemon so the
download works pre-auth.
• packages/agent/bin/cockpit-agent.js gets a new downloadDaemon()
step inside `init`: after writeEnvFile, fetch the tarball, pipe
into `tar -xz -C ~/.local/share/cockpit`, chmod +x the two
executables. Soft-fail with a warning if it errors — the token
write still lands and the user can retry by re-running init.
• ConnectMachineStep step 3 drops the "requires repo clone, public
installer coming soon" caveat in favor of the actual path
(~/.local/share/cockpit/cockpit-daemon.sh).
After this, a brand-new customer's path is:
1. Sign up + onboarding (username + project + connect)
2. Generate token → copy one curl command → paste into terminal
3. ONE command installs both the env file AND the daemon scripts
4. Run ~/.local/share/cockpit/cockpit-daemon.sh and they're live
No repo clone. No npm publish dependency. Customer-#2-ready.
Last commit (422873a) made step 2 of the connect flow work for new
customers, but step 3 — "Start the daemon: ./scripts/cockpit-daemon.sh"
— was still a lie: the agent CLI only writes a token env file, it does
not install the 783-line daemon script. New customers would copy that
path, get "No such file or directory", and assume they did something
wrong.
Update both surfaces (the onboarding UI's step 3 + the CLI's post-init
"Next steps" output) to acknowledge that the daemon currently requires
a Cockpit repo clone and flag a one-line public installer as coming
soon. The "Skip for now" button on the step already lets non-developer
customers complete onboarding and explore the cloud — the copy now
makes that the explicit, honest path.
Does not change behavior. The real fix (serve scripts/cockpit-daemon.sh
+ _brand.sh + agent-hook-lib.sh via /api/agent/daemon, with a bash
installer that drops them into ~/.local/share/cockpit) is queued — out
of scope for one commit (1500+ lines of bash, multi-file tracing).
The connect step instructed new users to run
`npx @cockpit/agent init --token ck_...`, but:
• `@cockpit/agent` is NOT published to npm — `npm view` returns 404
• The repo is private, so raw GitHub fallback URLs are also gated
• Result: every new customer hit a dead end at step 3 of onboarding
The CLI itself is fully implemented at packages/agent/bin/cockpit-agent.js
(144 lines, no external deps — only Node builtins + global fetch). It just
isn't reachable from outside this repo.
Three-piece fix that ships value today without needing npm publish:
1. New route /api/agent/install (Node runtime) reads the script body
and serves it as application/javascript. Public, cached 5 min.
2. next.config.ts outputFileTracingIncludes pins packages/agent/bin/**
to that route so Vercel's tracer ships the file in the bundle
(otherwise tree-shaken — the route reads it via fs at runtime).
3. src/proxy.ts matcher exception adds api/agent/install so the
curl request reaches the route without a session cookie.
4. ConnectMachineStep init command swaps to:
curl -fsSL ${APP_URL}/api/agent/install | node - init --token ...
The npx form is left in a comment for the eventual swap-back when
@cockpit/agent ships to npm publicly.
What this still does NOT fix (out of scope for one commit): the daemon
script (`./scripts/cockpit-daemon.sh`) still requires a cockpit repo
clone — the agent CLI only writes the token env file. That's the next
layer of the "no public install path" gap.
Extracted the branch logic from healReturningUserOnboarding into a
pure decideHealPatch() function in src/lib/onboarding-heal-decision.ts,
so it can be unit-tested without spinning up Postgres (the previous
location imported @/db/queries/* transitively, which fails at import
time without DATABASE_URL).
The I/O wrapper in onboarding-heal.ts now resolves projectCount and
suggested-username availability up front, then delegates the patch
decision to the pure function. Re-exports decideHealPatch + HealPatch
type so existing callers don't need to update import paths.
Test suite (npm run test:onboarding-heal) covers the six observable
branches:
- brand-new user → no heal
- returning user + free suggestion → both fields patched
- returning user + taken suggestion → onboardedAt only
- already-onboarded + valid username → no heal
- legacy migrated row (onboardedAt set, no username) → username only
- zero projects + onboardedAt set → still treated as returning
The never-throws contract on the I/O wrapper is verified by inspection
(try/catch wraps every await — there is no test-framework-friendly way
to inject a throw through the @/db import boundary without a real DB).
Three call sites (jwt callback in auth.ts, /api/onboarding GET, POST)
awaited healReturningUserOnboarding without try/catch. Heal does a
DB write (updateUser) which can fail transiently (DB hiccup, unique
constraint race on the suggested username when two users register
the same email near-simultaneously) — a throw out of heal propagates
to NextAuth as AccessDenied for the jwt() case, or a 500 from the
route handler for the API cases. Either way the user is bounced.
Heal is an optimization layer on the sign-in path. The un-healed user
is still valid — they just fall through to the normal onboarding step
instead of skipping it. So wrap the body in try/catch, log to stderr
(not logDebug — the DB might be the very thing that's failing, and a
logDebug insert would compound the error path), and return the user
unchanged. Every call site is now automatically safe; no per-caller
boilerplate.
Pulling prod secrets with `vercel env pull .env.production.local` is
the canonical way to query the prod DB from this repo, but that file
wasn't covered by .gitignore — only the older .env.local and
.env.vercel.production patterns were. One absent-minded `git add -A`
and the Neon DATABASE_URL, AUTH_SECRET, GITHUB_CLIENT_SECRET, etc.
would land in a public commit.
Add .env*.local to cover every Next.js env-overlay convention
(.env.production.local, .env.development.local, .env.test.local).
Finishes the Oracle migration plumbing started in ec6f423. Three pieces:
1. scripts/db/oracle-await-cutover.sh — polls
~/.config/cockpit/oracle-migration.env every 15s for ORACLE_HOST
(timeout 7200s by default), then runs oracle-cutover.sh with
SKIP_DUMP=1 once the IP is set. Lets the operator launch this
before creating the VM in the Oracle console; cutover fires
automatically the moment the public IP lands in the config.
2. scripts/db/oracle-cutover.sh — SKIP_DUMP=1 reuses an existing
pre-oracle-cutover.sql.gz instead of re-dumping prod, so the await
loop doesn't double-dump on every retry; env -u NODE_ENV wraps
`npm run build` and `vercel deploy`/`vercel redeploy` so the
ambient NODE_ENV=production from systemd or .env files can't
poison the build's mode resolution.
3. package.json — adds db:oracle-await alias.
The heal flow in 1f9155b dropped the trigger gate on jwt(), so every
request to a Node handler ran getUserById + countActiveProjects (+ a
possible updateUser). resolveSessionUserId() added a second getUserById
on every API call. Two-to-three DB round-trips per authenticated request,
unconditionally — fine for one user, a real bottleneck at multi-tenant
scale (which is the explicit goal: "start getting other customers").
Restore the original gate: jwt() only refreshes on sign-in or an explicit
session.update(). All the moments that need fresh state (post-onboarding
finish, /onboarding mount, username save) already call update() — so
correctness is preserved.
resolveSessionUserId() trusts a valid-UUID token.id without a DB lookup.
Email fallback still fires for the rare stale-cookie case where the JWT
carries an OAuth provider id instead of our UUID.
The returning-user branch awaited POST /api/onboarding and redirected
unconditionally. When heal couldn't pick a free username (suggestion
taken or unsuggestable), POST returned 400 with "Choose a username
before finishing onboarding." — but the page redirected anyway, the
stale cookie still failed the middleware's onboardingComplete check,
and the user bounced right back here. Infinite loop.
Check res.ok: on success, redirect as before; on failure, surface the
error and fall through to the normal username step so the user can pick
one explicitly.
Migrated/returning users with existing projects were stuck on /onboarding
because their JWT cookie carried onboardedAt=null even though the DB had
project data. The middleware then bounced them back every navigation.
Heal them transparently in three places that all share the same primitive:
- events.signIn: backfill username + onboardedAt when DB shows projects
- jwt callback: re-heal on every refresh and carry onboardingComplete
- /api/onboarding GET/POST: heal-on-read so a stale cookie self-corrects
Onboarding page now calls session.update() on mount to sync JWT from DB,
and auto-finishes for returning users instead of forcing them through
the username step a second time.
Session helpers gain resolveSessionUserId(): when JWT carries an OAuth
provider id instead of our UUID, fall back to email lookup so getUserById
queries don't poison API routes with invalid-uuid errors.
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).
Co-authored-by: Cursor <cursoragent@cursor.com>
Control buried fleet state behind config metrics and only showed an open-tab count on cloud. Push the full Zellij tab list from the daemon, store it in runtime_snapshots, and lead the page with a workspace table showing agent, state, and current activity per tab.
Co-authored-by: Cursor <cursoragent@cursor.com>
Mobile was cramped by six bottom tabs plus a floating FAB. Consolidate to five slots with Ask Ivy in the bar, put Control's brain panel first, and tighten spacing/safe-area padding across shell pages.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add @cockpit/agent init, server-side PIN enforcement for private APIs,
Postgres-backed cron jobs, daemon auto-continue sync, and cloud/local docs
so SaaS users get a clear path from browser signup to local dispatch.
Co-authored-by: Cursor <cursoragent@cursor.com>
Last leaf in the cloud-mode silent-failure audit. The "Clear context"
button in IntentButtonPanel's More-intents submenu called /api/project/
clear-context, which directly invoked injectIntoTab() — a zellij helper
that throws on Vercel because the binary isn't on $PATH. The click
handler awaited the response but threw away the result, so cloud users
saw a brief spinner and then nothing — silent no-op with no feedback.
Two fixes:
1. /api/project/clear-context now guards on isRuntimeAvailable() and
returns 503 {ok:false, reason:'runtime_offline'} — mirrors the
existing shape of /api/project/commit's 503. The previous behavior
was a generic 500 from the zellij module that didn't carry a
useful error code.
2. The button only renders when runtimeAvailable is true. Threaded
the existing runtimeAvailable prop from ProjectCard into
IntentButtonPanel; gated the button's render alongside the
existing currentAdapter === "claude" gate. Cloud users no longer
see an action they can't successfully fire.
Of the three per-project 503 action endpoints (sync, commit,
clear-context), the other two were already indirectly gated by their
UI: "Update from GitHub" only renders when git.behindRemote > 0,
and the commit chip only renders when uncommitted changes exist —
both require git state that the daemon populates, so they're
implicitly absent on cloud. clear-context was the only one with no
UI gate, so it's the targeted fix.
tsc + eslint + build clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>