WARNING on the rootsign logger and your tool returns its real result. Exceptions reach your code in four cases only:
- An approval decides against a tool call. A person rejects it, nobody answers in time, or the approval itself cannot be stored. The tool does not run.
- A session cannot be opened.
rootsign.session()raises before its body runs, so the agent does no work that would leave no record at all. - You asked for failures to stop the agent, with
ROOTSIGN_ON_RECORD_LOSS=fail. - RootSign is set up wrongly: no session is open, or an extra is missing.
Catch everything from RootSign
Every exception on this page, apart from those under Other exceptions, derives fromRootSignError:
rootsign.errors. RootSignError, RootSignNotInitializedError, HiTLRejectedError, HiTLTimeoutError and EscalationDepthExceededError can also be imported from rootsign.
Approval
These come from tools marked@rootsign.trace(require_approval=True). Require human approval shows each one in context.
HiTLRejectedError
A person rejected the call, withrootsign approve <action_id> --reject or by answering anything but yes at the inline prompt. The tool did not run, and the rejection is recorded.
HiTLTimeoutError
Nobody decided withintimeout_seconds, on the PostgreSQL backend. The tool did not run. The action is recorded as timed_out, which is kept apart from a person rejecting it. The inline prompt on the JSONL backend has no timeout.
HiTLUnsupportedBackendError
require_approval=True was used where nobody can be asked: on the JSONL backend with no terminal to prompt in, such as a background job or CI; on the cloud transport, whose approvals will come from the hosted backend once it is live; or with a LocalIngestClient bound to your own database transaction, whose pending record nobody can see until you commit. Raised on the tool’s first call, before it runs and before anything is recorded. Run it in a terminal, or use the PostgreSQL backend and rootsign approve.
The cloud and own-transaction cases were added after RootSign 0.3.1. In 0.3.1 and earlier, a held call with your own transaction waited for an approval nobody could see, then failed with
ActionNotFoundError. A held call on the cloud transport tried to reach a local PostgreSQL database and failed with OSError, or with ActionNotFoundError if one was running. In neither case did the tool run.HiTLPersistenceError
The record of a held call, or of the decision on it, could not be stored: the session file could not be written, or the database refused it. Raised before the tool runs, whateverROOTSIGN_ON_RECORD_LOSS says: a decision that cannot be recorded is not acted on. For example, on the JSONL backend with a session file that cannot be written:
RecordPersistenceError, so except RecordPersistenceError catches both.
Before the release after RootSign 0.3.1, the JSONL backend ran an approved tool even when the approval record could not be written, and the JSONL and PostgreSQL backends raised
RuntimeError when the pending record could not be written.Recording
RecordPersistenceError
A record could not be stored anywhere, and you setROOTSIGN_ON_RECORD_LOSS=fail. Raised by the cloud transport when the endpoint is unreachable and the spool cannot be written. It can come from the call that writes the record: opening the session, a tool call, or closing the session.
warn, nothing is raised. RootSign logs the loss at CRITICAL, the agent keeps running, and the gap in the chain makes the session verify as INCOMPLETE. See ROOTSIGN_ON_RECORD_LOSS.
rootsign.session() also raises it, on every backend and whatever ROOTSIGN_ON_RECORD_LOSS says, when it cannot open the session: the agent cannot be registered, or the session’s first record cannot be written, for example because the data folder is not writable or the database is down. Nothing in the async with block runs. A record lost later leaves a gap that verify reports, but a session that never opened leaves no file to show that anything was missed.
__cause__.
It is raised the same way when the store refuses the session’s first record, for example on PostgreSQL for an agent ID that was never registered. A first record the cloud transport could not deliver at all is not a refusal; ROOTSIGN_ON_RECORD_LOSS decides what happens to it, as above. For an unknown agent ID:
Failing on a refused session open was added after RootSign 0.3.1. Until then the session body ran, and the store refused every record in it.
Before the release after RootSign 0.3.1, a session that could not be opened raised the underlying
PermissionError or OSError instead.Setup
RootSignNotInitializedError
A traced tool,wrap_tools(), the MCP proxy or record_decision() was used with no session to record into: outside async with rootsign.session(...), and without an explicit ctx= and client=.
RootSignPostgresExtraRequired
ROOTSIGN_BACKEND=postgres was set, but the database packages are not installed. Raised when the first session opens. Install them with pip install 'rootsign[postgres]'.
RootSignCloudExtraRequired
AnHttpIngestClient was created without the HTTP package. Install it with pip install 'rootsign[cloud]'.
EscalationDepthExceededError
Reserved for chained approval escalations. This version never raises it.Ingest errors
IngestError and its subclasses are raised inside the store when it refuses a record, and are turned into an error code in the store’s response. They do not reach your code. You see the codes in rootsign-admin sync output and in sync receipts.
Each carries
error_code and retryable attributes. The full list of codes, with which ones to retry, is in the ingest specification.
Other exceptions
Some mistakes raise standard Python exceptions rather thanRootSignError:
For example:
What is logged instead of raised
Failures that do not affect whether a tool should run are logged on therootsign logger and never raised:
-
A record that could not be written, on any backend, logged at
WARNING. On the cloud transport it goes to the spool first. For example, on the JSONL backend: -
Records lost entirely with
ROOTSIGN_ON_RECORD_LOSS=warn, logged atCRITICAL, with a chain gap that verify reports. -
A decision that could not be recorded. The action is still recorded, without a
decision_id.
logging.basicConfig(level=logging.WARNING).
Related
Require human approval
Hold a tool call until a person decides, and handle the outcome.
Configuration
Every environment variable, including
ROOTSIGN_ON_RECORD_LOSS.