zterm

Serving a team board

A team board accepts authenticated HTTP requests on the address in its [serve] configuration. Put Tailscale or a TLS proxy in front of any non-loopback listener, and set trust_front = true only when that front protects the connection. This setting does not authenticate callers or make forwarded address headers trustworthy.

[serve]
listen = "127.0.0.1:7440"

For a board behind a public TLS proxy, keep the daemon's listener private. Availability during a connection flood is the proxy's responsibility: authenticate or rate-limit traffic there. The daemon's limits bound the resources an unauthenticated caller can consume; they do not guarantee that a new authenticated caller gets in while a flood fills admission. No quota is based on the peer address, since a proxy can put every member behind the same address.

Request limits

The team listener admits at most 96 unauthenticated readers. Authentication and the license check happen after the request head and before allocating the body. Successful authentication and license acceptance release that reader slot. Already authenticated requests and streams continue when the unauthenticated pool fills. Valid token holders are outside this resource bound.

Part of the request Limit
Request line, including CRLF 2 KiB
Each header field, including CRLF 4 KiB
Complete head, including request line and final empty line 16 KiB
Header fields, counted before insertion 32
Body 16 MiB
Accept through the last body byte 30 seconds
Each idle read within that deadline 10 seconds

These are fixed limits. Sending a byte periodically does not extend the whole-request deadline. The deadline stops when the complete request has arrived; it does not shorten long polling or streaming responses. A partial body is not accepted work, even after its token passes. An upgrade may drop it; retry with the same idempotency key.

An oversized request line receives 414, oversized headers or too many fields receive 431, malformed framing receives 400, and an oversized body receives 413. These carry E_ARGS. A read timeout receives 408 with E_TIMEOUT_TRANSPORT. Unknown tokens still receive 401 with E_AUTH, and a license that does not serve still receives 503 with E_LICENSE.

For an authentication or license refusal with a valid body length, the daemon sends the error first, then discards the body within the original request deadline before closing. The reader slot remains occupied during that drain. Malformed or oversized framing receives only a short bounded drain, so a client that keeps sending may see a reset instead of the error.

When the board is busy

At the admission limit, the daemon attempts a 503 response with E_DAEMON and Retry-After: 1, then closes the connection. It creates no reader thread for the excess connection. Since the request may still be unread, the client can receive a closed connection or reset instead of the response.

When the CLI receives the 503, it says the board is busy reading incoming requests. Wait at least one second, then retry with the same idempotency key. If this continues, ask the board administrator to check traffic at the TLS proxy. An overload response does not carry the restarting header. Do not assume that an arbitrary disconnected write is safe to repeat with a new key.

The private local socket and the browser dashboard listener retain their separate admission and parsing rules.

Local routing while the team board is offline

A relay remembers the last successful list of the team's project keys across daemon restarts. If a key is also on the local board, a bare alias such as CC1-3 still returns E_AMBIGUOUS while the team is offline. Use local:CC1-3 to select the local copy, or team:CC1-3 to select the team copy. For a command that names no artifact, use --project local:CC1 or --project team:CC1.

The relay tries to refresh the list on its first use after startup. A successful list is reused for 60 seconds; a failed refresh is retried on the next use after 10 seconds. Remembered keys have no expiry while the server cannot answer. If the team has since deleted a project, its key can keep a local alias ambiguous until a successful refresh replaces the list. An explicit local: qualifier lets local work continue in the meantime.

After startup or a change that invalidates the list, an old list's missing keys are treated as unknown. A project the relay has never seen on the team keeps the existing offline behavior: if it exists locally, unqualified work goes local. Project creation and publication still request a fresh listing; remembered keys do not count as a successful check.

The relay stores only the keys and the Unix timestamp of their successful read in team-projects-<hash>.json in its data directory. The hash identifies the configured team URL, so switching teams does not reuse another team's list. Files are replaced atomically, with mode 0600 on Unix and a protected current-user-and-SYSTEM DACL on Windows. A missing or unreadable file leaves the relay without remembered keys. A failed save is logged and the current process keeps its in-memory list.