devin: wrong wire fields in client metadata, tool call deltas, and usage stats

Author: luyishuiCreated Sep 17, 2026Updated Sep 17, 2026
LabelsFixed

Is it a request payload issue? [x] No, it's another issue.

Describe the bug

Three field-level bugs in the Devin executor's Connect-RPC wire handling, verified against the upstream protobuf schema.

  1. Client metadata sends a wrong ide_name and a field the client does not send.

    BuildDevinClientMetadataBytes writes field 1 (ide_name) as "devin-cli". The client name is "chisel", and the code already has it as DevinDefaultClientName; GetUserStatus in internal/auth/devin/user_status.go uses it. The function also emits field 28 (ide_type), which the client does not send.

  2. Tool call deltas decode field 4 as a varint index that does not exist.

    In ChatToolCall, field 4 is invalid_json_str (string), field 5 is invalid_json_err (string), and field 6 is is_custom_tool_call (bool). There is no index field. The decoder reads field 4 as a varint Index, so the string payload never decodes, Index stays 0 on every delta, and all tool calls collapse into slot 0. invalid_json_str, the raw argument text for custom tool calls, and is_custom_tool_call are dropped entirely.

  3. Usage field 4 is folded into prompt tokens.

    ModelUsageStats field 4 is cache_write_tokens, not extra prompt tokens. The parser adds it into PromptTokens, so reported input is inflated whenever the upstream writes cache. For example a real usage block {input_tokens: 3, cache_write_tokens: 14361} is reported as prompt_tokens = 14364.

CLI Type devin

Model Name swe-1-6 (any devin model)

LLM Client Any client routed through the devin provider.

Expected behavior

  • metadata field 1 sends chisel and field 28 is not emitted
  • tool call deltas decode invalid_json_str / invalid_json_err / is_custom_tool_call, and fragments aggregate by call id
  • cache_write_tokens is accounted separately from PromptTokens

Source: router-for-me/CLIProxyAPI