Typed outcomes and errors
The typed outcomes every BotPassword intent returns, from success and approval_required to needs_human and unknown_outcome, and how agents should react.
Every BotPassword intent returns a typed outcome instead of free text or a secret. Each result is one JSON object with a machine-readable outcome code and, for the outcomes that need one, a detail (a request ID, a rotation step, a revision or a reason), so an agent can react without guessing. The outcomes are implemented in the Outcome type in crates/agent-policy. The outcome reference has a page for each code, generated from that type, with what it means, which intents return it and what to do next.
What outcomes exist?
| Outcome | Meaning |
|---|---|
success |
Done. Intents may use a specific success such as rotated or signed_in. |
approval_required |
A human must approve in BotPassword. The agent should tell the user an approval is waiting. |
vault_locked |
The vault is locked. The user needs to unlock it. |
grant_expired |
The grant has ended. Request access again. |
scope_denied |
The request is outside the grant, for example http_request to a host not on the credential’s allowed list. |
disclosure_not_granted |
The intent hands the value to a tool (cli_login, run_with), and the grant does not allow disclosure. |
session_required |
The call came from outside an agent session. Start one with bpw agent run -- <harness>. |
wrong_account |
The provider account does not match the credential. |
provider_auth_expired |
The provider rejected the stored credential or management credential. |
provider_rate_limited |
The provider is rate limiting. |
provider_unavailable |
The provider could not be reached. |
host_restricted |
The host environment’s own controls block the action. |
containment_unsupported |
The requested containment cannot be provided here. |
value_reflected |
A credential’s value came back in a response or a sealed run’s output. None of it is returned, and that value’s grant is revoked, which may not be the grant this request used. If that grant had already gone, nothing is revoked. A person decides whether to grant it again. |
value_too_short |
The value is under 16 bytes, too short for sealed delivery. |
revocation_pending |
A revocation is in progress. |
needs_human |
A step needs a person: a CAPTCHA, device check or email confirmation. BotPassword does not bypass bot detection. |
unknown_outcome |
BotPassword cannot tell what happened and will not retry blindly. |
partially_rotated |
A rotation stopped partway, with the exact pending step reported. |
needs_human, unknown_outcome and partially_rotated are additions to the plan’s original list.
How do intent-specific results map?
| Intent | Typical results |
|---|---|
request_access |
approved with a grant reference, denied, expired, approval_required with a request ID to check, or request_limited |
sign_in, fill_totp |
success with the fields filled and whether the form was submitted (not whether the site accepted the login), needs_human (no tab at the site, an ambiguous form, or no paired browser in agent mode), scope_denied (wrong site, or the page left the site before the fill), disclosure_not_granted, or unknown_outcome (the extension had the value but did not report back) |
change_password (planned, not built yet) |
changed, failed (old password still current), or unknown_outcome (both kept, needs confirmation) |
rotate (partly built) |
rotated with a new revision reference, or partially_rotated |
run_with |
exit code and output (a disclosing run’s redacted), or value_reflected |
cli_login |
success with the tool, credential, canonical site and setup lines (never a value), or scope_denied, disclosure_not_granted, session_required, vault_locked, grant_expired (only when the call names a credential; with none named, an expired grant serves nothing and the answer is scope_denied) or needs_human when two granted credentials match |
What do message and next_step add?
A result that is not a plain success carries two more fields next to outcome. message is one sentence on what happened. next_step is one sentence on what the agent or the person should do now. Both are fixed text chosen by the outcome code, so they never hold a value or anything from the request. The code stays the thing to match on. For rejected, message is the daemon’s own text and next_step follows its reason. A next_step never tells an agent to ask for a password or secret in chat, or to work around a refusal.
When the daemon cannot be reached (daemon_unavailable) or answers in a form bpw cannot read (daemon_incompatible), the transport error is in detail, not in message. bpw agent prints both after the code. With --json it prints the same object an MCP result carries. Its exit status is 0 for done, 1 for failed (no daemon, bad arguments), 2 for a command line that cannot be parsed, 3 for refused and 4 for not finished (approval_required or partially_rotated: a person must act).
What should an agent do on each error?
approval_required: stop and tell the user an approval is waiting in BotPassword; do not ask for the secret.vault_locked: ask the user to unlock.grant_expiredorscope_denied: forrun_with,http_requestandrotate, ask for a grant withrequest_access, as narrow as the task needs; if the person says no, stop. For every other intent (cli_login,sign_in,fill_totp) asking from the agent is not built yet: stop and tell the user, who can add the grant withbpw grant add.provider_rate_limitedorprovider_unavailable: wait and retry later.needs_human: hand off to the user.unknown_outcomeorpartially_rotated: do not retry blindly; read thedetail.
Why is unknown_outcome its own type?
Rotation and password changes mutate both a provider and the vault. If a step cannot check provider state first or use an idempotency key, the result is unknown_outcome, never an automatic retry. For the planned change_password, the new password is saved as a pending revision before submission, so an ambiguous page can never lose the password the site now has. Both are kept until you or a follow-up sign_in probe settles it. See Rotation.
Do outcomes ever contain values?
No. A disclosing command’s output is scrubbed of the secret values the broker injected, including base64, base64url, URL-encoded, hex, JSON-escaped and HTML-escaped forms, and each is replaced with [bpw:redacted], which does not say which item matched. On a sealed path a known value in the output or a response means value_reflected and none of that output. Streams are buffered just enough to catch values split across chunks. Matching is best effort: it does not catch every transformation a program might apply. See Security model.
Where do outcomes appear?
The same outcome set applies over MCP, the CLI and the credential helpers, since all call the same daemon.
Next steps
- Outcome reference for every code, one page each.
- Intent catalog for what each intent returns.
- Grants and approvals for the approval outcomes.