Braide runs each agent and each terminal as a child process. This page describes what happens when those processes start, when they exit, and what guarantees you can rely on — particularly if you're running Braide headless on Linux or scripting around it.
When you enable an agent (or when Braide restarts and restores agents from your saved settings), the agent goes through a short startup sequence:
npx or uvx skip this step.If a running agent exits unexpectedly — crash, killed by the OS, network drop on a remote — Braide tries to restart it automatically with exponential backoff:
| Attempt | Delay before retry |
|---|---|
| 1st | 1 second |
| 2nd | 2 seconds |
| 3rd | 4 seconds |
After three failed attempts the agent moves to error state and stays there until you manually restart it from the Process Manager. A successful handshake at any point resets the counter.
If you stop the agent yourself (toggle it off, or click Stop), Braide does not auto-restart it.
If the desktop app's renderer crashes, Braide shows recovery actions while keeping the backend running where possible. Show Crash Report opens the preserved native crash report, and Show Logs opens the logs directory; after either action, the recovery dialog appears again so you can still choose Reload Braide without losing the background processes. Choose Quit only when you want to stop the application instead.
When you quit Braide, disable an agent, or stop one from the Process Manager, the agent goes through a layered shutdown so it has a chance to flush state but cannot block you forever:
When the whole Braide server is shutting down, an overall 40-second cap applies: if shutdown hasn't completed within that budget, Braide exits anyway. This prevents a single unresponsive agent — or a stuck background task — from blocking quit indefinitely.
Some work must not be interrupted mid-way. Archiving a session, for example, stashes uncommitted changes, removes the worktree directory, renames the branch, and only then flips the session to its archived state — and worktree removal on a large tree can take 10+ seconds. If that work were cut off by shutdown, the session would be left half-archived and would surface an "archive interrupted before completion" error on the next launch.
To prevent this, Braide drains in-flight background work first when it shuts down:
While this is happening, the desktop app shows a shutdown overlay that lists what is still finishing (for example, Archiving session "my-feature"), so quit never looks frozen — you can see it is waiting on real work rather than hung. The overall 40-second cap still bounds the whole sequence.
Terminal processes (PTY shells, both interactive and agent-spawned) follow the same process-group shutdown pattern: SIGHUP first (or SIGTERM for non-PTY terminals), a 5-second grace period, then SIGKILL. Anything you started inside the terminal — long-running commands, background jobs — receives the signal too, so closing a terminal cleans up its children.
If you're running the Braide server directly rather than the desktop app, you can shut it down with any of these signals. All trigger the same graceful sequence and exit with code 0:
| Signal | When you'd send it |
|---|---|
SIGTERM | Standard "please stop" — what systemctl stop and kill send. |
SIGINT | Ctrl+C in the foreground terminal. |
SIGUSR2 | Used by nodemon and similar tools for graceful restarts. |
If Braide itself crashes (an uncaught exception or unhandled promise rejection), it logs a fatal error and exits with code 1 after running shutdown. The FATAL line is also written synchronously to ~/.braide/logs/braide-crash.log (or electron-main-crash.log for crashes in the desktop app's main process) so the record survives even an abrupt exit — see Crash Logs. Signal handlers are idempotent — sending SIGTERM twice doesn't double the shutdown, it just confirms you really meant it.
If you're seeing different behaviour — orphaned node or java processes after quitting Braide, agents that never restart, or shutdown that hangs — that's a bug. Capture the logs and file an issue.