> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Keep the web bridge up across reboots

> Install the launchd agent that starts the web bridge and the answer endpoint at every login, and restarts them after a crash.

The web bridge is the small web server that `fno mux serve --web` starts. It serves the HQ page. With `--attention-api`, the same command also serves the answer endpoint on port 8724. The answer endpoint is the HTTP service that your phone answer buttons and other automations call to record answers to questions. Started by hand, the bridge and the endpoint die at the next reboot or crash and stay down until you notice.

`fno mux web install-agent` installs a launchd agent that ends that. The agent starts the same serve a hand-run bridge uses, `fno mux serve --web --attention-api`, at every login (so after every reboot), and launchd restarts it after a crash. To open the page the bridge serves, see [Command page](/docs/guides/command-page.md). To answer the questions it lists, see [Answer from chat](/docs/guides/answer-from-chat.md).

> **Note:** The agent commands need a build newer than v0.4.8rc2. No release carries them yet. On 0.4.8rc2 and earlier, the command prints `fno mux web: unrecognized subcommand 'install-agent'` and changes nothing. After a release carries the commands, `fno update` brings them. See [Update](/docs/install.md#update).

## Install the agent

You need F\[no] installed on a Mac. You do not need a mux server running yet. The command writes one file, `sh.fno.web-bridge.plist`, into `~/Library/LaunchAgents`, and registers it with launchd.

Run this in a terminal:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
fno mux web install-agent
```

A working install prints a receipt like this:

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
fno mux web: installed: agent loaded (gui/501/sh.fno.web-bridge.<HOME-HASH>); the bridge starts now and at every boot
fno mux web: plist <HOME>/Library/LaunchAgents/sh.fno.web-bridge.plist
```

`<HOME>` is your home directory, which the receipt spells out in full. `<HOME-HASH>` is the label's suffix: 8 characters hashed from your home path, so two machines with shared storage never collide. `gui/501` is launchd's per-user domain, with your user id. Exit code 0 means launchd holds the agent.

Check that launchd holds the agent:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
launchctl list | grep web-bridge
```

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
92446	1	sh.fno.web-bridge.<HOME-HASH>
```

The first column is the bridge's process id. It is a number once the bridge attaches to your mux server. While the bridge still retries, it can read `-`. The middle column is the last exit code launchd recorded. A nonzero value names an early exit before the bridge attached. The sample pairs a pid with a 1: the bridge runs now, and it exited once before it attached. The label carries your own hash in place of `<HOME-HASH>`.

![A terminal. fno mux web install-agent prints the installed receipt and the plist path.](https://mintcdn.com/fno/0aHgMHtfN97mjnfv/images/web-bridge-install.png?fit=max\&auto=format\&n=0aHgMHtfN97mjnfv\&q=85\&s=d85dce3486960fd64302611acf546848)

### Check the page answers

The bridge needs a mux server to attach to, and it binds its port only after that attach. On a machine where your fleet runs, a mux server is already up, so the bridge attaches within seconds of the install. If no mux server runs yet, the bridge exits, launchd retries it, and the log stays empty. Start the mux with `fno mux`, the way [Run a fleet](/docs/guides/run-a-fleet.md) does, wait a few seconds, and read the log again.

When the bridge binds, it prints two lines into its log: the page's private URL, and the answer endpoint's own line. The URL carries a token, so read it from the log instead of guessing:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
grep "^fno " ~/.fno/logs/web-bridge.out.log
```

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
fno mux web (backlog writes on, loopback only): http://127.0.0.1:8722/?t=<TOKEN>
fno attention api: http://127.0.0.1:8724/v1/attention/items (sink token required)
```

The first line is the page's URL. The second is the answer endpoint, and it serves only callers that carry a sink token. The log carries one pair of lines per start of the bridge, and the last pair is the bridge that serves now. `backlog writes on` names the answering ability: a loopback bridge accepts answers, so the page's Answer section is live. Open the URL in a browser. The page loads and its top bar reads `fno fleet · read <N>s ago · <N> sessions` once your fleet reports. Then run `fno doctor`: no `web bridge` line in its output means the agent, the bridge, and the answer endpoint are all healthy.

> **Warning:** The token is the only guard on the page. Anyone with the full URL can read your fleet. Keep the URL private.

## What the doctor prints

`fno doctor` checks the agent, the bridge, and every answer endpoint you configured. If something needs you, it prints a `web bridge` line. Silence is the healthy state. These are the lines it can print, and what each one means:

| You see | What it means | What to do |
| - | - | - |
| `plist present but the label is not loaded` | The file is on disk, but launchd does not hold the agent. A manual unload or a failed install leaves this state. | Run `fno mux web install-agent` again. The command re-registers the agent. |
| `the agent is loaded but the bridge is <STATE>` | launchd holds the agent, but the bridge it starts is not serving. `absent` is normal while no mux server runs. | Read `~/.fno/logs/web-bridge.err.log`. If no mux server runs yet, the line clears when one starts. If the same failure keeps returning, stop the agent for good. See [Stop the agent](#stop-the-agent). |
| `answer_base_url <URL> answers <CODE> (unreachable)` | The answer endpoint your phone buttons call did not answer with a success code. | Read [the answer endpoint is down](#the-answer-endpoint-is-down). |

![A terminal. fno doctor prints two web bridge lines: the plist is present but the label is not loaded, and the answer base URL refuses connections.](https://mintcdn.com/fno/0aHgMHtfN97mjnfv/images/web-bridge-doctor.png?fit=max\&auto=format\&n=0aHgMHtfN97mjnfv\&q=85\&s=6a734f9d38da0d8e3270aea7b5490499)

The second line names the state it saw. `absent` means no bridge bound yet. `dead_pid` means the recorded process is gone. `port_refuses` means nothing answers on the port.

> **Tip:** The `web-bridge-agent` step in `fno config setup run` installs this agent during setup, so a new machine can get it without a separate command.

## Stop the agent

A crash-looping bridge, or a port you need for something else, is the time to remove the agent for good. Run:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
fno mux web uninstall-agent
```

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
fno mux web: uninstalled: agent unloaded and plist removed
fno mux web: plist <HOME>/Library/LaunchAgents/sh.fno.web-bridge.plist
```

launchd drops the agent and the file is gone. Nothing restarts at your next login.

> **Warning:** The agent restarts the bridge within seconds. Ctrl-C and `fno mux serve --web --stop`, the flag that stops a hand-started bridge, cannot stop it for long. `fno mux web uninstall-agent` is the permanent stop.

## Install options

The command takes four flags:

| Flag | What it does | Default |
| - | - | - |
| `--bin <PATH>` | Pins the fno binary the agent starts. | The `fno` found on your `PATH` at install time. |
| `--port <N>` | The web bridge port. | `8722` |
| `--attention-port <N>` | The answer endpoint port. | `8724` |
| `--json` | Prints the receipt as JSON. | Human text |

The receipt pinned one binary path at install time. If you later move fno, run the command again with `--bin /path/to/fno` to re-pin it. If the file already matches and launchd holds the agent, the run prints `unchanged: plist matches; not re-registered` and restarts nothing.

## Limitations

### Other systems

launchd is macOS-only. On Linux or elsewhere, both commands print:

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
fno mux web: unsupported: launchd is macOS-only; keep the bridge up with your init system (e.g. `nohup fno mux serve --web --attention-api &` or a user systemd unit)
```

and exit 1. The commands install nothing.

### The agent serves loopback only

The agent starts the bridge bound to `127.0.0.1`, so the HQ page answers only on this machine. Opening it from another device still uses the manual Tailscale bind from [Command page](/docs/guides/command-page.md#open-it-from-another-device). The agent has no bind option. You start that Tailscale bridge by hand after a reboot, so it is not reboot-proof. A bridge bound to a Tailscale address can run beside the agent's bridge, because the two hold different addresses. The answer endpoint behind the agent stays loopback-only too. An automation that calls it from another machine needs its own path, such as `tailscale serve`.

## Troubleshooting

### `fno mux serve --web: cannot bind 127.0.0.1:8722: ...`

Something already holds the port. If the agent owns it, the error's own note names the bridge that holds the port, and you do not need a second one. To run a manual bridge on this machine anyway, give it another port: `fno mux serve --web --port 8723`.

### `fno mux web: unrecognized subcommand 'install-agent'`

Your fno build predates the agent commands, and the refusal changes nothing. No release carries the commands yet. If you installed from a release, wait for a release that carries them. A source install gets them by rebuilding from its checkout. See [Update](/docs/install.md#update).

### `fno mux web: failed: ...` after an install

The receipt names the step that failed: a file write, or a `launchctl` call with its exit code. The usual causes are a permission problem on `~/Library/LaunchAgents` or an unhealthy launchd state. Remove that cause and run the command again. If launchd does not hold the label, the run re-registers. A file that already matches changes nothing.

### The answer endpoint is down

The doctor line names the URL it probed and the code it got. `000` means nothing answered. Check that launchd holds the agent (`launchctl list | grep web-bridge`), then read `~/.fno/logs/web-bridge.err.log`. The probed URL comes from a `[[attention.sinks]]` row in your `~/.fno/config.toml`. If that row points at another machine, check the agent on the machine that serves the URL.

## Next steps

* [Command page](/docs/guides/command-page.md): open the HQ page the bridge serves, and answer questions in its drawer.
* [Answer from chat](/docs/guides/answer-from-chat.md): the answering workflow the answer endpoint records.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.