Summary
An ACP conversation can fail when codex-acp handles an unknown slash command such as /codereview-roasted.
Reproduction
- Start an
ACPAgent conversation backed by @agentclientprotocol/codex-acp.
- Send an unsupported slash command, for example
/codereview-roasted this PR.
- The adapter handles the command locally and returns a successful
session/prompt response without a model turn or usage update.
Actual behavior
codex-acp returns usage: null and _meta.quota.token_count: null. ACPAgent._extract_token_usage() treats the null token count as a mapping and raises:
'NoneType' object has no attribute 'get'
The generic ACP turn-error path then emits ACPPromptError and marks the entire conversation ERROR, so it cannot continue normally.
Expected behavior
A successful handled command with no usage information should record zero token usage and complete the turn. Unknown commands should show the adapter-provided response without poisoning the conversation.
Proposed fix
Normalize nullable quota and token_count values to empty mappings before reading counters, with a regression test for {"quota": null} / {"quota": {"token_count": null}}.
Summary
An ACP conversation can fail when
codex-acphandles an unknown slash command such as/codereview-roasted.Reproduction
ACPAgentconversation backed by@agentclientprotocol/codex-acp./codereview-roasted this PR.session/promptresponse without a model turn or usage update.Actual behavior
codex-acpreturnsusage: nulland_meta.quota.token_count: null.ACPAgent._extract_token_usage()treats the null token count as a mapping and raises:The generic ACP turn-error path then emits
ACPPromptErrorand marks the entire conversationERROR, so it cannot continue normally.Expected behavior
A successful handled command with no usage information should record zero token usage and complete the turn. Unknown commands should show the adapter-provided response without poisoning the conversation.
Proposed fix
Normalize nullable
quotaandtoken_countvalues to empty mappings before reading counters, with a regression test for{"quota": null}/{"quota": {"token_count": null}}.