Repository navigation
CLI errors as one JSON object that states the rule and the current state - #94
Conversation
The CLI writes a refusal to stderr as one JSON object, `{error, detail,
...facts, hint}`, instead of an `agent: CODE` line; `--pretty` keeps a
readable line. Daemon refusals name the rule they enforce in `detail` and
carry the state a client needs to act as facts: the running turn for
`bot_busy`, the holder's `bot_id` for `bot_exists`, the recorded decision
for an approval already answered. `invalid_request` echoes the request id.
The app reads the JSON error.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ecad68035e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- `bot_exists` names the holder's `bot_id` while that bot is being deleted, instead of null, and says the name is taken until the deletion finishes. - A submit's `invalid_reasoning_level` names the allowed `levels`, as a creation's does: one refusal, `Family::check_reasoning`, for both. - A failure is printed for `--pretty` only when the parser accepted that flag, so `run --bot --pretty` still reports JSON. - The app reads remote hosts' CLI errors with the same JSON parser as the local daemon's. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6fb718ff4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- `active_agent_limit` gets the CLI hint `--delivery queue`, as `bot_busy` does. - `--pretty` counts as asked for once `prepare` accepts it, so a later flag's failure still prints the readable line. - `approve_not_in_tools` names the refused entries as `approve`, the field they came from. - A turn's end carries its error's facts in `turn_finished`, so a budget stop says `budget_tokens` and `tokens_used`. - A session serving a tag already is told to renew its lease, with it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31e083b0b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- `Error::reported` reads an error from a reply or an outcome with its facts, and `From<agent_client::Error>` keeps them: the socket client, the pruned-retry reconcile, `agent approver` and `models` all use them, so no CLI path drops what the daemon sent. - `history_read` and `artifact_page` say an offset is past its bound instead of blaming a valid page limit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aab4c7387b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A bot named like a flag, such as `--worker`, still parses as the source when the hint is copied. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e8c95e38f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… daemon's error A refusal's detail is elided in its middle past 4 KiB at the response boundary, so a detail that echoes a whole request line still fits. invalid_delivery states the rule and lists deliveries. A daemon that fails to start reports its error, and the CLI fails with that error. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c11487aac0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
report() prints CLI-side errors without passing a daemon response, so it applies the same bound to a detail that echoes an argument. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01L9TT37y1798majTjQbUtZW
|
The finding deferred here, the shared daemon log race, is listed in #96 and is being fixed in its own small PR. Generated by Claude Code |
Before: a refused command printed one
agent: CODE: textline to stderr. A program had to pattern-match prose, and many refusals had no text at all (agent: bot_exists,agent: store_not_found).After: stderr carries one JSON object,
{error, detail, ...facts, hint}.detailstates the rule. The facts carry the state a client needs to act on, such as the running turn, the holder'sbot_idor the allowed values.hintgives flags to copy.--prettystill prints a readable line.This is C2 of the CLI feedback plan (
agent-notes/shipping-plan/PLAN.md) and followsAPI_DESIGN.md. It sets no defaults of its own;--effortand duration flags come in C4.What a client sees
Captured with a synthetic provider on a scratch store:
How
main.rsrenders anErroras JSON: its code and detail, its facts flattened in, plus the CLI's hint.--prettygivesagent: CODE: DETAIL; HINT. The flag counts only once the parser has accepted it.Error::reportedbuilds an error from any reply or turn outcome and keeps every fact. Daemon replies, pruned-retry reconciles, the approver, and a daemon that fails to start all use it. A failed auto-start now fails with the daemon's own error, such asinvalid_provider_url.bot_busy:running_turn,fork_point;active_agent_limit: a--delivery queuehint;bot_exists:bot_id, including a name still being deleted;invalid_reasoning_level:levels;invalid_delivery:deliveries;approve;lease;budget_tokensandtokens_used, also inturn_finished.cli_reasonreads the JSON error, and the remote launcher shares it.docs/CLI.mdanddocs/RUST_PROTOTYPE.mddescribe the shape.One Codex finding is declined and left for the owner: two launchers auto-starting the same store at once, both with invalid flags, can read each other's startup error from the shared log.
Performance
Only refusal paths change. The facts come from rows each refusal already read, so accepted requests make no new store reads and do no new work. I took no new measurements because no hot path changed.
Checks
cargo fmt --check.cargo clippy -p agent-runtime -p agent-client --all-targets -- -D warnings.cargo test -p agent-runtime -p agent-client: all pass.AGENT_TEST_RUNTIME=1 python3 -m unittest discover -s tests: 403 tests, OK (39 skipped). The last commit touched onlyreport(), so for it I reran test_cli and test_runtime.node --test app/tests/state.test.cjs: 140 pass.The app crate doesn't build on Linux, so I checked its
cli_reasonchange separately.🤖 Generated with Claude Code