Transport & Sandbox
Generated reference for Transport & Sandbox, including its syntax, options, results, and constraints from the canonical cockpit CLI source.
Some screens and steps may differ in the latest version.
This reference is generated from the same canonical source distributed as cockpit CLI help. See Cockpit CLI for concepts and safe operating guidance.
Remote control is available for task, autorun, accounts, fleet, hooks, and ask list/get/answer/close/pair through --host <host|alias>, --port, and --https. crew list/get/status/invite-url/channels/groups/send and project list/get take the same options, but go through this computer's Cockpit, which checks the calling task and forwards the request to a device of the same Tailscale owner (cockpit help crew); they need this computer's Cockpit running and ignore AGI_COCKPIT_TASK_HOST. Other families return host_not_supported for an explicit --host, --port, or --https; the only exception is remote-access configure, whose --port and --https are its own settings.
--port and --https only describe a remote target. Without --host (or AGI_COCKPIT_TASK_HOST, for the families that honor it), they answer invalid_arguments with a message that --host is required, and nothing is sent, because the command would otherwise run on this computer.
Option names are case-sensitive in every shell: --JSON is not --json. A name in the wrong case is an unknown option, and nothing is sent.
The CLI checks the arguments first, then resolves aliases, then device names (see cockpit help task), through the local device registry just before its first request, and connects directly to the target SyncServer. Arguments that fail the check send nothing, not even the alias lookup or the lookup of the current task from the working directory. Task, Fleet, Hooks, and Ask list/get/close authenticate the same way: a verified Tailscale peer on the same tailnet with the same owner, or a loopback connection, needs no token; any other connection needs a paired bearer token (AGI_COCKPIT_TASK_REMOTE_TOKEN, falling back to AGI_COCKPIT_SYNC_TOKEN). Remote Ask answer always requires a valid pairing token, even from loopback or a same-owner Tailscale peer; a transport-authenticated caller without one gets ask_answer_authentication_required. PWA WebSocket connections request pairing before initial state, so a paired PWA sends its stored token before answering. A peer with a different owner and no valid token gets authentication_failed. When the target allows Tailscale only, connections that are neither a Tailscale peer nor loopback are refused even with a token. These responses include device: { host, ip, name }, including server errors, and omit the local instance. Remote connection failures report host_unreachable, or tls_name_mismatch when the HTTPS certificate is issued for another name, and never fall back to local file IPC, including when --host is 127.0.0.1 with --https false. Accounts keeps its existing task transport and supports remote login.
cockpit ask pair --host <target> --sign-in opens the browser to sign in with the target PC's AGI Lab account, then retrieves an owner token in data.token using a private result secret. It shares PWA sign-in start limits and obeys network and origin restrictions; a target that allows Tailscale only refuses starts from outside Tailscale with tailscale_required. It also works from the target PC itself, whose own addresses share one start limit. Supply the token through AGI_COCKPIT_TASK_REMOTE_TOKEN; paired tokens survive restarts and Remote Access off/on, while sign-in-issued tokens are revoked on PC sign-out or sign-in revocation. See cockpit help ask for credential handling and connection revocation.
Remote commands never start or wait for the local app. Alias and device-name lookup uses local connection data already available from the environment or runtime file; if the registry is unavailable or has no matching alias or device, the CLI connects to the supplied hostname or address directly. The alias and this-computer lookups each have a two-second timeout; the device-list lookup, which asks the other devices, has five seconds. Bash retains its local file IPC fallback for that lookup, including with AGI_COCKPIT_TRANSPORT=file; only requests to the resolved remote API bypass it. Both launchers require the deployed cli-families.tsv capability table and return a JSON file error naming it if it is missing or unreadable.
The cockpit CLI talks to the AGI Cockpit app over loopback HTTP (127.0.0.1), with an automatic file-based IPC fallback (AGI_COCKPIT_IPC_DIR) when a sandbox blocks network access. The fallback is limited to the Cockpit instance that supplied that IPC directory; an explicit connection is never redirected through another instance's runtime file. When the environment says sandbox networking is disabled (CODEX_SANDBOX_NETWORK_DISABLED=1, as Codex sets for sandboxed commands) and AGI_COCKPIT_TRANSPORT is unset, local requests use file IPC directly without trying loopback first. Bash does not print curl's connection error when file IPC answers instead. Commands therefore work identically in restricted sandboxes — never request escalated, full-access, or network permissions to run cockpit commands; doing so only pops a needless approval prompt.
Before task, talk, HTML, or side-panel commands run, the CLI authenticates the task API through loopback and then file IPC if needed. Authentication checks share a 20-second deadline across connection candidates. Loopback receives at most 200 ms before switching to file IPC. The first file response can use the remaining time minus up to 1.5 seconds reserved for checking rejection of an invalid token. File IPC can wait up to 20 seconds for a queued request to be consumed, bounded by the command's own timeout. A transport timeout is not authentication success and never prevents the next transport from being tried. Internal recovery paths may accept a final timeout only after all available transports have been attempted; cockpit doctor still reports such a result as unauthenticated.
While the task listener is recovering, authentication GET requests may be retried within the shared deadline. A changed port is followed only when the runtime still has the same PID, token, and IPC directory; a 401/403 response with the advertised token stops recovery. Bind failures and unexpected listener stops are recorded, retried with increasing delays from 1.5 seconds up to 60 seconds, and use a free port if the previous one is occupied or denied. The runtime advertises the actual port atomically only while its listener is bound. During recovery it leaves the port unadvertised, and the CLI waits within the authentication deadline for the same instance to publish a listening port. Slow HTTP responses alone do not restart a listener. Deliberate shutdown drains active responses for up to one second and closes idle connections; a subsequent start chooses a fresh port.
After recovery completes, commands from existing tasks use the same instance's current advertised port without probing their inherited previous port. A changed or temporarily missing task port alone does not change the instance identity when the task token and IPC directory still match; the caller's task context is retained. Other conflicting connection settings still identify a foreign instance.
The PowerShell launcher does not need Node.js on PATH. File IPC, task authentication through file IPC, cockpit doctor, cockpit secret, and gen-video run on the first available runtime: AGI_COCKPIT_NODE_PATH; the AGI Cockpit executable, started as Node — the running app named by the runtime file, the executable path the runtime file records, or the installed Microsoft Store package, so it works while the app is closed; then node on PATH. With none of them, task commands keep native loopback authentication with a two-second request timeout, and commands that need a runtime return node_runtime_unavailable. A runtime that was found but cannot be started returns node_runtime_access_denied when Windows denies starting it (access denied, for example inside an agent's sandbox) and node_runtime_start_failed otherwise; neither names the path or the raw error, and Cockpit does not change permissions or try another runtime. These three answers also carry source: "cockpit-cli". A runtime that exits without printing JSON returns node_runtime_failed with its first error line. All of them exit 7 on the file IPC transport and 1 otherwise. File transport preserves HTTP status, error body, and timeout information for command error handling and task creation reconciliation; directory-context lookups use the selected transport.
On Windows, run cockpit from PowerShell, never cockpit.cmd. PowerShell picks cockpit.ps1 for cockpit, which receives piped text as strings. Text piped to cockpit.cmd is first encoded with $OutputEncoding, which is US-ASCII in Windows PowerShell 5.1, so every non-ASCII character such as Japanese reaches Cockpit as ? and cannot be recovered. cockpit.cmd is for cmd.exe, Git Bash, and other callers that cannot start a .ps1 script; text they pipe reaches Cockpit unchanged. Tasks and Crews that Cockpit starts on Windows get PSExecutionPolicyPreference=RemoteSigned unless it is already set, so cockpit.ps1 runs for that process even when the user's execution policy is Restricted; a Group Policy execution policy still takes precedence.
When Cockpit answers a local command with an HTTP error (4xx or 5xx), the command exits non-zero. See the command's help topic for its exit codes; for example, cockpit help task describes when task turn exits 3. HTTP errors are distinct from connection failures. Cockpit's answers carry instance (production, dev, or dev-task-<hash>) whether they succeed or fail, and so does an answer the CLI makes up in their place, such as the timeout: true answer of task wait, talk wait, or fleet wait with --timeout 0. A command sent to another computer with --host has no instance.
The PowerShell launcher decodes every response as UTF-8 and prints exactly one line of JSON. An HTTP error returns the server's JSON body with its code (a non-JSON or empty body becomes code: "http_error" with status; an empty body has error: "HTTP <status>"), and an unexpected failure returns code: "unexpected_error" instead of a PowerShell error record. In PowerShell, --stdin also reads pipeline input, such as Get-Content report.html -Raw -Encoding UTF8 | cockpit html show --stdin. PowerShell decodes the file before the CLI sees it, so name the file's encoding, and several piped strings are joined with line feeds; use a --*-file option to send a file's text exactly. An empty pipeline fails with code: "stdin_no_input" instead of a missing-option error and never falls back to the process's own standard input. Both launchers remove one leading byte order mark (U+FEFF) from text read through --stdin or a --*-file option, because Windows PowerShell can put one in front of text it pipes to another program; a U+FEFF anywhere else in the text is kept, and text that is only a byte order mark counts as empty. Text given directly, such as --text or --html, is sent as written, including a leading U+FEFF. Credential values read by cockpit settings set agents.credential.<name> --stdin or --key-file are the exception: surrounding whitespace is trimmed as well, and the bash launcher's trim also removes every byte order mark at either end.
Each file IPC request is written once, under a fresh request id, and the CLI then only waits for the matching response file — it never re-submits a request that is still in flight, so a task create or task send is not at risk of running twice. Loopback exit 7 means no connection was established, so the file IPC fallback that follows it delivers the request for the first time rather than repeating it. Timed-out request files are removed immediately; a late response remains covered by the bridge's existing orphan-file garbage collection.
If a local command fails with exit code 7 or {"ok":false,"error":"Cannot reach AGI Cockpit ..."}, that is a transport availability issue: AGI Cockpit is not running, or an old CLI lacks the file bridge. It is NOT a permissions or argument problem — do not retry with elevated network permissions or different arguments. Make sure AGI Cockpit is running, then re-run the exact command.
cli-runtime.json (mode 0600) is the connection file of the running Cockpit: it holds its ports and the random tokens Cockpit makes at every start, and Cockpit removes it at quit. It stays a file rather than an item in the OS secure store so that every cockpit command of the same user, in a shell or a task, can read it at once and without a permission prompt; tasks also receive the same values in their environment. See cockpit help secret.
cockpit doctor compares cli-runtime.json with AGI_COCKPIT_*_PORT overrides. It distinguishes PID visibility, direct loopback reachability, file IPC reachability, and the authenticated effective transport. It also reports the resolved local instance — the Cockpit the CLI will actually send to, not merely the profile that shipped the binary. Use it when task or talk commands fail with exit 7; the per-transport result identifies which path was attempted and why it failed. A CLI pinned to one local instance does not follow inherited AGI_COCKPIT_* connection settings that point at another; it fails with instance_mismatch instead of sending. --host commands omit instance because they are not talking to that local target.
Choosing the local instance
A command reaches exactly one local Cockpit and never falls back to another one. The cockpit inside a Cockpit data directory (<data directory>/master/bin/cockpit) is pinned to that directory's instance; any other cockpit uses the default runtime file. To reach an instance whose data directory is not in the default location, run the cockpit in that data directory; setting its ports and tokens by hand is not needed.
Connection values in the environment (AGI_COCKPIT_*_PORT, AGI_COCKPIT_*_TOKEN, AGI_COCKPIT_IPC_DIR) that disagree with the CLI's runtime file point at another instance. Cockpit injects its connection into a task together with the task identity, so values accompanied by AGI_COCKPIT_TASK_ID or AGI_COCKPIT_CONTEXT_TASK_ID are inherited; values without it are explicit. Tokens are created anew each time an instance starts, so when some AGI_COCKPIT_*_TOKEN values match the runtime file and others do not, the values mix two instances, as when only some of a task's values are overridden. Every CLI then fails with instance_mismatch, naming both groups, whatever the task identity.
- A pinned CLI ignores inherited values that point at another instance and sends to its own. It never ignores explicit ones: it fails with
instance_mismatch, naming the values, its runtime file, and how to reach either instance. - Any other CLI sends explicit values to the instance they point at; values whose
AGI_COCKPIT_IPC_DIRmatches the runtime's and that do not mix two instances belong to the same instance after a restart and are recovered as before. When the command also needs a value they do not include, such asAGI_COCKPIT_TASK_PORTandAGI_COCKPIT_TASK_TOKENfortask,accounts, anddoctor, it fails withinstance_mismatchinstead of filling the gap from the runtime file of another instance. File IPC is then used only through theAGI_COCKPIT_IPC_DIRgiven with those values. Results omitinstancewhen noAGI_COCKPIT_IPC_DIRidentifies the target.
These failures happen before any request is sent, for doctor as for every other command. Only cockpit help, a command whose first argument is help, and a command given -h or --help are exempt, because they print help without contacting Cockpit. -h and --help print the command's usage wherever they appear, except as the value of an option that takes free text (--text -h sends the text -h).