Developer reload - swap the backend in place, agents intact
The backend reload swaps the process that serves the control API and the agents' work for a fresh one, while the window you are looking at stays exactly where it is. Nothing is re-authenticated, no session restarts, and no agent loses its turn.
On this page
What it is
The backend reload replaces the process that serves the control API and the agents' work with a fresh one, while the window you are looking at stays exactly where it is. The window's link to the backend pauses, the old engine drains, the new engine takes over, and everyone's next call is answered by the new engine. Nothing is re-authenticated, no session restarts, and no agent loses its turn.
It is a developer tool. It is shown only in a from-source run with the engine-process switch on,
and it does not exist in a packaged build. The routes below are only useful on such a run; every
other build answers not-running because no separate backend process exists.
Where to find it
There is no button for it and no panel to open: a normal install has no separate backend process to swap, so every call on one answers that nothing is running.
Two things a developer reaches for. First, the switch that permits a separate engine at all — a
developer setting, off by default (engineProcessEnabled), and one that only asks for the
separate engine rather than promising it. Second, the reload commands themselves, called on the
local control server while a from-source run is up.
How it behaves
The engine-process switch
The switch is the setting engineProcessEnabled. It is off by default, and the ordinary
in-process boot is exactly what it always was while it is off.
Turning it on is a request, not a promise. The boot asks the entry checks below, and any one of them failing keeps the app on the ordinary in-process boot and says why in the log. A packaged build always refuses, so an installed app can never be asked to run its engine separately.
| Entry check | Refusal reason | What it means |
|---|---|---|
| The build is not packaged | packaged-build |
An installed build has no separate engine. |
| The engine facade bundle is present | facade-bundle-missing |
The engine has nothing to start from. |
| The agent host is on | agent-host-off |
Without the host, agents would not survive a reload. |
| The engine-held secret key is ready | secret-key-not-ready |
A separate engine could not open saved credentials. |
| No engine handler reads the raw window event | raw-event-handler-present |
A separate engine cannot receive the raw event. |
| No window-only boot row remains | boot-rows-remaining |
The engine is not ready to boot on its own. |
| The window link can route pushes to a new engine | push-routing-not-ready |
Updates would be lost after a swap. |
Only when the switch is on and every check holds does the app boot the engine as its own process. The decision is made once at boot and never throws; a refusal is a plain-language sentence beside the reason word, so a developer reading the log knows which gate to clear.
Both switches travel to the window side in shell-state.json before any engine exists, so the
boot can decide without opening the settings store. The agent-host value is normalized to a plain
on/off: only true or a 100 percent share counts as on, and a named list or a smaller share stays
off, so a partial rollout never asks the engine process to start. The push-routing check asks
whether the window-side link ports are installed; while they are not, the answer is no, so a
separate engine never starts with pushes going nowhere.
The two commands
POST /app/reload-backend
Requests a backend swap and answers when the swap has finished. The body is strict and takes three optional fields:
{ "targetGenerationId": "optional-generation-id", "force": false, "requestId": "optional-request-id" }
requestIdmakes a retry safe. A retry with the same id while the swap is still running joins that swap and receives its report. A retry after the swap finished returns the same cached report instead of running a second swap. A request with a different id (or none) while a swap is running answersbusywith the runningswapId, never a second swap.targetGenerationIdis passed through for a build that can name a generation; the supervisor otherwise picks the next one.forceis reserved for a future forced path; today it changes nothing.
Status: 200 for committed or no-change (a no-change answer carries the machine code
NO_CHANGE, never CONFLICT), 409 for busy, not-running, precheck-refused,
incompatible, aborted, deferred or rolled-back, and 500 for failed. Every answer also
carries data.report and data.summary, a plain-words sentence for a person.
The IPC twin is IPC.APP_RELOAD_BACKEND with the same body and the same answer shape. It goes
straight to the shell, so it never waits behind the window-link hold or the engine drain that the
swap itself is holding.
POST /app/interface/stage, then POST /app/reload
The backend and the window's interface are versioned separately. To move the window onto new interface code without restarting the app:
POST /app/interface/stagebuilds the interface and records the engine epoch it was built for.POST /app/reloadreloads the window onto the staged interface.
A staged interface is bound to the epoch that served when it was staged. If a backend reload moves
the serving epoch first, activating the staged interface is refused with
serving-epoch-changed; it must be staged again against the new engine. While a backend swap holds
the transition lock, the interface reload answers busy rather than racing it.
The ten outcome words
Only committed reads as success.
| Word | What happened |
|---|---|
committed |
The new backend took over and is serving. |
no-change |
The backend already served the requested generation; nothing changed. |
aborted |
The reload stopped before it finished; nothing changed. |
deferred |
The swap was put off because the app was busy; run it again later. |
rolled-back |
The new backend failed to take over and the previous one is serving again. |
failed |
The reload failed; the report names the reason. |
busy |
Another backend change is running; the report names its swapId. |
not-running |
No separate backend process exists, so there is nothing to reload. |
precheck-refused |
A safety check refused the reload before anything was paused. |
incompatible |
The new engine cannot serve what the running interface needs. |
Unknown numbers in a report are null, never 0.
What still needs a full restart
A reload refuses, before pausing anything, when it cannot be done in place:
- An agent the reload would end. An agent the app cannot carry across - a cloud session, an SSH agent, or a local agent whose lease cannot be read - is named in the refusal. Wait for it to finish, or turn agent hosting on.
- A channel the new engine does not serve. If the running interface uses a channel the
candidate engine's table lacks, the answer is
incompatibleand names the missing channels. This is the interface's signal to ask for a full restart. - A different preload or a version outside the interface's range. The window was built against another bridge; it needs a restart to pick the new one.
- A spawn that could not be reconciled. In-flight spawn reservations must settle before the
freeze completes. If they cannot, the reload fails closed as
precheck-refusedand nothing is paused.
Everything else - backend code, CLI routes, agent orchestration - is reloaded in place.
Appearing in the shell and being answered there are different things, which is what the first
reload has to get right. A shell-surface route (/app/interface/status, /app/interface/stage)
answers in the main process, which owns no database, so its provenance resolvers and its Team Chat
bot-scope gate must never touch SQLite: when a route really needs a database fact the shell asks
the engine over the internal pipe instead. POST /shell/bot-scope-check is that road - the engine
answers the caller's bot scope, the shell forwards the original call, and no answer means the
caller gets the ordinary 503 rather than a silent stand-down. The shell front door refuses that
path to any TCP caller with 403 before a forward, so the route never becomes a second public
door.
How host-owned agents survive
An agent's turn lives in the backend, and its streams are the rows and buffers a person sees. The handover treats them as a checkpoint, not a restart:
- Plain-road spawns are frozen for the whole swap, and in-flight reservations are reconciled before the freeze completes.
- The old engine quiesces its host streams and commits each lane, then acknowledges the frontier.
- The new engine claims the same leases and re-attaches each stream at the committed offsets.
A lease that cannot be confirmed is never started twice and never converted to attached; it is
reported unknown and stays held. In the ordinary case the proof is zero missing rows and zero
duplicated rows across the handover, and the agent's next turn carries on where it was.
What you see while it runs
The window's calls pause instead of failing. New CLI requests that arrive while the swap holds
admission are refused with 503, Retry-After and the backend-swapping code, so a retry is
correct advice. A request that was already admitted and whose engine died mid-drain settles
outcome-unknown (502, code outcome-unknown, no Retry-After): the caller must check before
retrying. The reload command itself is never refused by that fence, which is how a second caller
gets busy rather than a 503 while a swap is running.
Every attempt is recorded by the H-8598 telemetry recorder: kind (backend or frontend), swapId,
from/to build, from/to generation, the phase reached, how long admission was held, the outcome,
refusals, reasons and when it was recorded. The ring keeps the most recent 500 entries and can also
write them to a JSONL sink.
Related
- Developer Status — the panel that shows what the app's own processes, build and land queue are doing.
- Engine Setups — how the app's engine and window are versioned and paired.
Last verified 2026-11-29