Skip to content

fix: degrade Pi unknown-command RPC errors that omit request id - #161

Closed
zleo-ai wants to merge 1 commit into
BytePioneer-AI:mainfrom
zleo-ai:fix/pi-idless-unknown-command-frames
Closed

zleo-ai wants to merge 1 commit into
BytePioneer-AI:mainfrom
zleo-ai:fix/pi-idless-unknown-command-frames

Conversation

@zleo-ai

@zleo-ai zleo-ai commented Sep 5, 2026

Copy link
Copy Markdown

Why

Pi 0.73.1 (current @mariozechner/pi-coding-agent) answers unknown RPC commands with an error frame that omits id:

{"type":"response","command":"get_available_thinking_levels","success":false,"error":"Unknown command: get_available_thinking_levels"}

get_state and get_available_models still echo the request id. Inspect then calls get_available_thinking_levels; the adapter already maps an id-correlated Unknown command to PiRpcUnsupportedCommandError so Thinking can degrade to unsupported. An id-less frame instead trips Pi RPC response has no id, faults the whole session, and the connections panel marks Pi as error.

This is a Pi RPC protocol quirk, not a Codex Desktop / Renderer injection bug. It reproduces by talking to pi --mode rpc directly, on any OS that runs that Pi version.

Change

If a response has no id, but it is an Unknown command: <name> error and exactly one pending request uses that command name, reject that pending request with PiRpcUnsupportedCommandError. Any other id-less frame still faults.

Test

  • Unit: packages/adapters/pi/test/pi-rpc-session.test.ts — degrades an unknown Thinking command whose error frame has no id (41 tests in this file pass).
  • Live: Linux + ChatGPT Desktop 26.901 + Pi 0.73.1; after this adapter behavior, codexhost binding probe reports pi: ready.

Relation to #113

#113 already contains this adapter hunk, mixed with the 26.810 Renderer request-bridge work. That PR is waiting on whether the Desktop probe issue is Linux-only. This change is independent and can land on main without that Desktop discussion.

Pi 0.73.1 replies to unknown commands such as get_available_thinking_levels
with `{ type: "response", command, success: false, error }` and no `id`.
The adapter already treated an id-correlated Unknown command as
PiRpcUnsupportedCommandError so inspect could continue, but an id-less
frame faulted the whole RPC session at the capabilities stage and marked
Pi unavailable.

Route an id-less unknown-command frame back to the unique pending command
it names; any other id-less frame still faults.

Verified against Pi 0.73.1 on Linux: inspect reaches ready after this
change. Independent of Codex Desktop / Renderer injection.
@BytePioneer-AI

Copy link
Copy Markdown
Owner

你可以使用@earendil-works/pi-coding-agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants