# Operations and recovery

> Keeping Orbit running day to day, in plain words first, then how an agent handles processes and sessions, config reloads, stuck sends, pauses, the watchdog, upgrades, the database, support bundles and scheduled routines.
>
> Describes Orbit 0.1.9. Web page: https://docs.orbit.dialectic.com/0.1.9/using/operations-and-recovery/

This page covers running Orbit over days and weeks, and what happens when something is stuck, paused or out of date. The first part is in plain words; the rest is the agent's operating detail.

## In plain words

Orbit runs on your computer (or a server you control). Most days there is nothing for you to do. When something needs you, your agent says so in one plain message, and your Orbit page lists it under **Needs you**.

- **Stuck transactions.** If a transaction your agent sent never went through, your agent may ask your permission to cancel it from its own wallet, or ask you to check something in the Safe app. It never re-sends money just because it is unsure.
- **Pauses.** Several things can stop new activity: you or your agent pausing Orbit, Orbit's own loss check, the watchdog pausing your wallet, or Orbit pausing a network whose connections disagree. Under Orbit's own pauses, closing positions and taking money out still work. Under the watchdog's pause of your wallet, your agent can do nothing, closes included, until you lift it; you can still move your money yourself in the Safe app. Lifting the stronger stops needs you.
- **The watchdog** is a separate program that watches your wallet and can pause it in an emergency. It does not start again by itself after your computer restarts; your agent restarts it.
- **Updates and support.** Your agent can check Orbit's health, prepare a support bundle with secrets removed (you read what is inside before sending it), and keep Orbit up to date (see [Updates](https://docs.orbit.dialectic.com/0.1.9/using/updates/)).

## For agents: running Orbit

This part is for agents that run Orbit over days and weeks: in a chat host, on a VM, or on a schedule. It goes deeper than the `orbit-operations` and `orbit-upgrade` guides. As of Orbit 0.1.9.

Start every diagnosis with `health_check`. Its `blocking` list is the to-do list, each with a plain next step. Relay errors in full; never shorten or hide one, and never retry past one you have not shown the owner.

## Processes, sessions and state

| Thing | Where |
|---|---|
| Config | `~/.config/orbit/config.toml` |
| State directory | `~/.orbit`, or the folder `ORBIT_STATE_DIR` names |
| Position ledger | `positions.db` in the state directory |
| Audit log | `audit.jsonl` in the state directory |
| Watchdog | A separate `orbit-watchdog` process with its own guardian key |

### One acting Orbit per state directory

Only one process acts for a state directory: it signs, runs the background pollers, claims bridge transfers and serves the owner page. Any other Orbit on the same directory (a second chat app, a CLI command) only reads and simulates. `health_check` says so with an `instance_role` entry `observing`, naming the acting process.

- Two agent apps on one Orbit is fine: one acts, the other watches. If the acting one closes, the observer takes over by itself shortly after (promotion is checked on every `health_check`).
- Never stop another Orbit process. Use the acting one, or wait.
- If `health_check` says no setup was found, the host entry is probably missing `ORBIT_STATE_DIR`: fix the host entry; do not start a new setup.

### Sessions

A `quote_id` lives only in the process that made it: separate CLI invocations cannot share one. A `sim_receipt` is valid for a short window (`sim_receipt.valid_for_s`) and is accepted by another Orbit process on the same state directory within that window, aging from when it was written. A swap quote lasts for its `expires_in_s`. Do quote, simulate and execute in one persistent MCP session.

### The owner page

The read-write MCP process that acts serves the owner page on loopback (the port is `[owner] port` in config) while it runs. A CLI-only owner can run `orbit-mcp owner-serve` in their own terminal, which holds the process lock, and get the link there with `orbit-mcp owner-url --wait`. When Orbit runs on another computer, `orbit-mcp owner-url --tunnel` prints the SSH command to run on the owner's own computer and the link that matches it; the local port is fixed for this install and is never Orbit's own. If that port is taken on the owner's computer, a one-line hint says to pick another number and change it in both lines. The link is a bearer credential: it never goes in chat or logs; the owner runs these commands in their own terminal. When the page is unreachable (remote host), offer chat: every owner step except the recovery backup works from chat.

## Reloading config: `refresh_state` or restart

`refresh_state` re-reads the config file and rootfiles without a restart: it validates the new config (a bad config keeps the previous one and says so), re-checks every `rootfile_pin`, rebuilds connections, refreshes the swapper mapping, and reports exactly what changed.

- It names which sections still need a restart: `[owner]` and `[tenderly]`. `[signer]` does not: an operator key created while the server runs goes live on refresh.
- A running server also picks up a changed `config.toml` by itself within `mcp.poll_interval_s`; `refresh_state` applies it at once.
- A host app keeps its tool list until it restarts. After an upgrade, restart or refresh the host app, not only Orbit.

Polling pace is a separate setting: `set_rpc_usage_mode` with `low`, `medium` or `high`, on the owner's word. The tool's description gives each pace; `health_check` → `rpc_usage` shows the mode in force. It never changes checks made before an action. On a 429, Orbit only suggests `low`.

## Network connections and pauses

- **429 or slow answers.** Honour the wait; do not hammer. A slow network is named as left out; the other Safes are still reported.
- **Network paused.** When Orbit's connections disagree with each other it pauses live actions on that network. A send refused with `network_paused` (or `policy.send_gate.use_instead` naming it): call `recheck_network_pause` once (omit `chain` to check every paused network). It re-reads every disputed value at one block on both sides and lifts the pause when they agree. If it stands, wait or suggest a trusted connection.
- **`facts_unconfirmed`** on a result that went through: one reference was not reachable. Relay it and carry on. The same words in a refusal (`facts.reference_unavailable`, `retry: true`) mean nothing was done: relay and try again shortly.
- **Past activity behind.** A `deploy_block` setting or an archive-capable connection helps; balances and positions are still read live.

## Stuck and unresolved sends

`list_incomplete_operations` lists every attempted operation that has not completed. Read `disposition`, never the status string:

| `disposition` | Meaning |
|---|---|
| `notify` | Needs a person: money may have moved, or a wanted action did not happen for a fixable reason (reverted, never broadcast, simulation failed, connection unavailable, precondition missing, refunded) |
| `inform` | The system behaved correctly: a limit or cadence doing its job (`policy_denied`), an expired review, a pending row |
| `silent` | Completed |

`notify_count` counts returned rows that warrant raising. If `truncated` is true, page with `cursor`. Rows are reconciled against the chain at startup and periodically, so re-read rather than assume a status is final.

### `execute_action` statuses

| `status` | Meaning | What to do |
|---|---|---|
| `success` | Mined and succeeded | Report it |
| `reverted` | Mined and failed | Relay the decoded reason. A module cooldown has no named error: it decodes as `code: "unknown"` with the selector and raw data. Orbit does not check module cooldowns before sending |
| `pending` | Sent, not mined yet | Follow `next`. Retry only with the **same** `idempotency_key` |
| `unknown_broadcast` | Orbit could not establish the outcome; it may still land | Never send again under a new key; check `list_incomplete_operations` |
| `dropped` | The chain was asked and does not have it | Follow `next` |
| `pending_confirmation` | Sent to review | See [Approvals](https://docs.orbit.dialectic.com/0.1.9/concepts/approvals/) |

### Three remedies

- **`cancel_unresolved_send`** for a row with `cancel_available: true`: sends an empty transfer from Orbit's own wallet to itself at the same nonce, paid from the operator's gas, so the original can never go through. Only after the owner approved it in chat; pass their reply verbatim as `user_message_quote` and the row's `operation_id`. The outcome (cancelled, nonce already used, still waiting) is recorded.
- **`resolve_operation`** for `manual_check_required`, `send_unconfirmed` or `receipt_unconfirmed`: records a person's on-chain finding. `finding: "executed"` or `"not_executed"`, with mandatory `evidence` (a transaction hash, or for example "nonce 41 unconsumed at block …") and `attested_by`. With a hash, Orbit re-checks the receipt and records a machine-observed result when it is the operation's own transaction. Otherwise the result is `executed_attested` or `not_executed_attested`, never a plain `executed`. A machine-observed outcome cannot be overwritten. `manual_check_required` means the nonce was consumed but Orbit never learned by which transaction: a blind retry may execute twice.
- **`clear_failed_operation`** clears an attempt that can no longer run (refused, simulation failed, never sent, reverted, expired) from the owner's Activity. It needs the owner's signature through a sign link. The attempt stays in history as cleared by the owner.

`list_operations` reads the ledger including closed rows (and human attestations); `list_executions` reads every broadcast execution with the mandate verdict that authorized it.

## Pauses and stops

| Stop | Who | Effect | Undo |
|---|---|---|---|
| Local pause: `set_execution_paused` with `paused: true` | Agent or owner | Halts every live send on every network from this Orbit, Orbit's own wallet included (its description says "mainnet", meaning live rather than the dev signer, not Ethereum), without revoking the mandate. A declared exit with evidence it reduces something still runs. Persists across restarts. A convenience, not a security boundary | `paused: false` |
| Loss circuit breaker | Orbit's policy, from the mandate's `[circuit_breaker]` | While tripped, increases and outbound swaps are denied; exits are allowed. A re-trip escalates | `set_execution_paused` with `reset_loss_breaker: <safe>` needs the owner's signature (or the owner page) |
| Guardian pause | The watchdog (guardian key) or the owner | `pause()` on the module: the module refuses every operator action, exits and closes included. The owner can still move funds in the Safe app | The Safe can always unpause (it is a guardian that cannot be removed). Orbit never sends `unpause()`; it only prepares it for the owner's approval |
| Network pause | Orbit, on disagreeing connections | Live actions on that network wait | `recheck_network_pause` |
| Hyperliquid signer stop | Agent or owner | Orbit refuses every Hyperliquid account change for the Safe; the registration at the exchange stays | `set_hyperliquid_agent_stopped` with `stopped: false`, or `orbit-mcp hyperliquid-stop <safe> --resume` |

## The watchdog

The watchdog is a separate process. It follows each Safe's module events, estimates realised losses from on-chain values, and pauses the module with the guardian key when its loss check trips. It does not read Hyperliquid trading accounts.

| Tool | Use |
|---|---|
| `get_watchdog_settings` with `safe` | Local config, desired and applied revision, process identity, verified cycle health, and `restart.call_args` |
| `prepare_watchdog` | Start (or reuse) the matching process for a Safe and verify a healthy cycle. The fix only when the watchdog is stopped, never ran, or is not watching this Safe |
| `restart_watchdog` | Restart after a reviewed change. Pass `get_watchdog_settings`' `restart.call_args` **exactly** as given |
| `apply_watchdog_settings` | Change poll, strike or loss settings. Tightening is a plain step; anything that protects less needs the owner's signature |

- A watchdog that was running and is not does not restart itself, for example after the computer restarts. `health_check`, `get_portfolio` (`protection_note`) and the owner page all say so. Start it with `prepare_watchdog` for each Safe, then `verify_setup`.
- When a service manager runs it, `restart_watchdog` saves the new settings and answers `code: "supervised"` with `config_refreshed: true`; it never stops or starts the process. Relay `words`: the owner restarts that service. Until `get_watchdog_settings` shows `application: "applied"`, the previous connection and key stay in use.
- A connection problem points to `get_watchdog_settings`; nothing needs restarting.
- A watchdog whose connection no longer keeps logs that far back carries on from the oldest block it can read and reports the stretch it skipped; the Safe reads as not yet confirmed until the loss window has passed it. Nothing needs doing.
- Changing a network's connection with `record_rpc_profile` says when the running watchdog needs `restart_watchdog`.

## Upgrades

**Before.** `health_check` (nothing mid-action; wait for unfinished sends in `list_incomplete_operations`), back up the state directory and the host's config entry, and run `orbit-mcp doctor` so an existing problem is not blamed on the update. The owner's recovery backup must already be saved.

**Update.** Homebrew installs update with `brew upgrade orbit-mcp` (or `orbit-mcp-readonly`); the tap carries stable releases only, and `self_update` / `orbit-mcp self-update` refuse on a Homebrew install and point to `brew upgrade`. Other installs: `self_update` from chat, or `orbit-mcp self-update`. It downloads the release for this computer, verifies its checksum, swaps it in one step keeping a `.prev` copy, restarts services (the MCP connection may drop; reconnect and `health_check`) and refreshes the bundled guides. A newer `tag` installs directly.

**Going back.** Only for installs not managed by Homebrew. An older or equal `tag`, or `rollback: true`, needs the signature of one wallet that controls every Safe set up here (the first call answers `needs_owner_signature` with a `signing_link` and a one-time `confirm`). If no single wallet does (`no_common_owner`), the owner goes back in a terminal with `orbit-mcp self-update --tag <version>` or `--rollback`, or on the owner page. There is no supported rollback for a Homebrew install: do not offer one, and do not improvise one.

**`orbit_update_required`.** A refusal with this code means a package needs a newer Orbit. Its `next` text names a tool called `update_orbit`, which does not exist: use `self_update`, or `brew upgrade orbit-mcp` on a Homebrew install, then try again.

**Check.** `orbit-mcp --version` and `health_check` `version` agree and are the one asked for. `orbit-mcp doctor`. `package_health`. Read the new version's behaviour changelog and report anything that changes what you told the owner. Restart the watchdog so it runs the new version (it keeps running and protecting on the old one through the update, unless it runs as a service that the updater restarts). Replace any copied guide with the stub `get_guide` returns.

### Expected after an upgrade, not a bug

Tell the owner which one in one line; do not report it as an Orbit fault.

1. The host still lists old tools or an old tool count: restart or refresh the host app.
2. `health_check` says an older Orbit acts and this one only watches: an app opened before the update still runs the old Orbit. Close or restart it; this one takes over shortly after.
3. `health_check` suggests compacting the history database: optional; `orbit-mcp repair-database --compact` while Orbit is not running.
4. `verify_setup` not ready only because a wait-between-actions setting is missing on a network: an older gap; the next permission update fixes it.
5. A small swap or repay fails for lack of balance: name the balance; it is not a refusal.
6. The watchdog has no total-loss limit: the owner's choice.
7. Stale feeds in the first minutes: background work is starting. The acting Orbit's own `mcp` heartbeat reads `status: "starting"`, with a note, until its first background check finishes; an Orbit that takes over the acting role mid-session gets the same. A heartbeat silent for longer than that window reads `stale`. An action fetches fresh data first.
8. The running watchdog is from an older Orbit: `restart_watchdog` with `restart.call_args`.
9. `identity_shape_removed`: call again with its `use_instead`.
10. `add_chain_revision_outdated`: read `get_add_chain_context` again and confirm with the owner.
11. Compact JSON answers, and `get_onboarding_status` omitting finished steps: pass `detail: true` for every stage.
12. Settings reads show `saved` instead of `confirmed_in_chat`: there is no chat confirmation step any more; the batch signature approves saved values.
13. From 0.1.9, `health_check` lists `module_sources` on every install: each network's source for modules created from now on. It says nothing about wallets that already have a module.
14. From 0.1.9, a new wallet's first swaps can show the previous fee for a short while after setup or a plan change, and two networks of one owner can show different swap fees. The preview always shows the fee the next swap pays.

## Database and history

`orbit-mcp doctor`, and the first start of each new version, check the position database. If it names a damaged table, follow "Repair a damaged position database" in the shipped operations doc: stop every Orbit, copy the file aside, and change nothing unless only the history table is named. `orbit-mcp repair-database` rebuilds the position database without its damaged readings; `--compact` compacts it. Both refuse while any Orbit (an agent session or `owner-serve`) is running.

Portfolio readings are kept in full for a retention period (`[mcp] snapshot_retention_days` in config), then thinned. `set_history_retention` changes it on the owner's word (`days`, `keep_everything: true`, or `use_config: true`); `get_history` says where kept history starts. Actions, spending, mandates and on-chain records are never thinned.

`reset_index` clears the position index for one Safe or all; it rebuilds from the chain on the next read. Use it only when told to.

## Support bundle

`orbit-mcp support-bundle` writes a private archive with secrets removed and a manifest of what is inside. Have the owner read the manifest before sending it. Never send keys, backups or tokens by any other route.

## Hosts and routines

Agents running Orbit on a schedule (cron-style routines in hosts such as Hermes, Claude Code or Codex) share the host with those routines.

- **Keep turns short.** A long interactive turn can block scheduled routines from running. Finish a multi-step job, then return; do not hold a turn open waiting for chain events. Follow transfers and reviews from the next routine run instead.
- **Be quiet when there is nothing to do.** On a failure, retry once, then report what failed in one plain message. Never repeat an error every tick.
- **After a tick,** read `list_incomplete_operations` by `disposition`. A guardrail holding is not an incident.
- **Renewal** is a daily `renew_subscription` call; it does nothing when nothing is due.
- **Verify your own routine edits.** After changing a routine's schedule or prompt file, read it back and confirm the host loaded it. Agents have lost routines to edits that failed silently.
- **Check your host's tool access.** A host profile that strips file or terminal tools can leave a routine unable to do what its prompt says. If a tool is denied, name the blocked action; never reroute around a host permission.

## Pitfalls seen in real agents

- Starting a second Orbit, or stopping the acting one, to "fix" an observing process.
- Re-sending under a new `idempotency_key` after `unknown_broadcast`.
- Treating every row in `list_incomplete_operations` as an alarm.
- Restarting Orbit to pick up a config change that `refresh_state` applies at once.
- Forgetting to restart the watchdog after an upgrade or a reboot.
