# Forwarding decisions https://fenzi.dev/docs/forwarder The forwarder runs on the developer's machine, next to the sandbox runtime. It sends decisions and requests up to the console, and brings reviews back down. Every connection starts on the machine. The control plane never connects in. Command: fenzi forward · Outbound only ## Run it ```bash fenzi forward ``` Example output ``` ■ Forward ✓ Decisions 12 ✓ Requests 1 ✓ Applied 0 ■ Forward ✓ Decisions 3 ✓ Requests 0 ✓ Applied 1 ``` On a machine signed in to a team, `fenzi run` and `fenzi connect` also forward in the background while the agent runs, every five seconds, and make one last pass when it exits, so a request the agent files reaches the console without anything else running. A Free machine does not forward. When another forwarder is already running, such as the Mac app's or the service, the run leaves the passes to it. `fenzi forward` is for the time between runs, or a sandbox kept running with no terminal attached; `fenzi forward --install` keeps it running as a service. It runs until you press Ctrl-C, and looks every five seconds. `--every 30s` changes that. `--once` does one pass and exits, which is what a scheduled job or a test wants. ## What one pass does 1. **Sync.** If the team published a host-only revision, load it onto running sandboxes. A path change is left for the next run, and the note says so. 2. **Ship decisions.** Read new allow and deny decisions for each sandbox Fenzi started, turn each into a decision record, and upload them. 3. **Ship requests.** Send pending requests for more access, with the agent's reason and any notes the runtime attached. 4. **Apply reviews.** For each request a reviewer decided in the console, make the same approve or deny call the terminal would, and mark it applied. ## What it sends One record per decision, the pending requests, and a report on the machine. Every field is listed once, in [What our cloud receives](https://fenzi.dev/docs/team#records). ## Reading the runtime's stream The forwarder watches the runtime's log stream for each sandbox and keeps the position of the last event it read. After a restart, or a dropped connection, it resumes from that position, so nothing is sent twice and nothing in the runtime's buffer is skipped. If the runtime says events were lost, for example because its buffer filled or it restarted, the forwarder starts again from the current position and sends a gap record: the sandbox and the time span it could not read. The console shows the gap as a row. Those decisions are not recovered from anywhere else, and the console does not pretend otherwise. ## When the console is unreachable Records wait on the machine, in `~/.config/fenzi/spool.jsonl`, and upload when the control plane answers again. The queue has a limit. If it fills, records are dropped and the forwarder prints how many, so a hole in the console always has an explanation on the machine. Requests stay pending while the console is unreachable, and the blocked call stays blocked. The sandbox keeps enforcing its policy the whole time. See [When something is down](https://fenzi.dev/docs/offline). ## When a request changed after review The runtime can refresh a request after it was filed, or replace the request the sandbox wrote on its own with the agent's request for the same host. If a reviewer decided the old version, the runtime refuses the decision. The forwarder does not retry it. It puts the request back on the console as pending, or, if the runtime replaced it, asks for a review of the new one. A person always decides the version that gets applied. ## Run it as a service To keep forwarding after the terminal closes, and again at every login, install the forwarder as a service. `fenzi login` offers this in a terminal. To do it later: ```bash fenzi forward --install ``` On macOS this writes a launchd agent, `~/Library/LaunchAgents/dev.fenzi.forward.plist`. On Linux it writes a systemd user unit, `~/.config/systemd/user/fenzi-forward.service`. Both run as your own user, need no administrator rights, and point at the `fenzi` you ran the command with. They keep your shell's `PATH`, so the forwarder finds the sandbox runtime as `fenzi run` does. If the forwarder fails, the service manager starts it again ten seconds later. Run `fenzi forward --install` again after you move `fenzi` or the runtime. It writes one line for each pass that did something, and one line for an error, not the same line again, to `~/.cache/fenzi/forward.log`. When that file passes 1 MB, the older lines move to `forward.log.1`. `fenzi status` and `fenzi doctor` say whether it is installed and running. `fenzi logout` stops it and removes it, and so does: ```bash fenzi forward --uninstall ``` **One at a time.** One forwarder that repeats runs on a machine at a time. While the service runs, `fenzi run` leaves the passes to it and makes only its last pass when the agent exits, and a `fenzi forward` in a terminal or in the Mac app waits and takes over if the service stops. The Mac app forwards while it is open, so on a Mac that is open all day you may not need the service. **On Linux**, systemd stops user services when your last session on the machine ends, unless lingering is on for your user. On a machine you reach over SSH, `loginctl enable-linger` keeps the forwarder running after you log out; your distribution may ask an administrator to allow it. A system with no systemd user manager, such as WSL without systemd, cannot install the service: `fenzi forward --install` says so, and `fenzi forward` in a terminal still works. There is no MDM package yet; see [Rolling out to many machines](https://fenzi.dev/docs/enroll#fleet).