internal/translator/interactions/claude: streaming step.start drops inline function_call.arguments when no subsequent arguments_delta arrives

Open Beginner friendly
#7,976 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
api

Research direction

Read internal/translator/interactions/claude/interactions_claude_response.go around lines 155-160 (interactionsStepStartToClaude) and 232-244 (appendClaudeToolBlockStart) and trace how the tool block start is built and emitted. Run go test -v -race -count=1 -run TestRepro_InteractionsClaudeStepStartDropsInlineArguments ./internal/translator/interactions/claude to see the arguments dropped. Done means the stream contains a content_block_delta with input_json_delta carrying the inline arguments JSON between the tool content_block_start and content_block_stop, plus a regression test covering the no-delta case.

Written by the indexing model from the issue text.

Description

Summary

In internal/translator/interactions/claude/interactions_claude_response.go:155-160 (interactionsStepStartToClaude) and 232-244 (appendClaudeToolBlockStart), when an Interactions step.start event for "type": "function_call" includes inline "arguments" (e.g. {"q":"x"}) without a subsequent step.delta (arguments_delta), interactionsStepStartToClaude only records name, id, and signature. appendClaudeToolBlockStart emits content_block_start with "input":{} and never emits a content_block_delta (input_json_delta) for the inline arguments, silently dropping all tool arguments.

Environment
  • CLIProxyAPI revision: origin/dev at 32842348 (confirmed on v8.1.2)
  • OS / Go: Windows 11 amd64, go1.27.4
  • Route: POST /v1/messages (streaming) -> Interactions -> ConvertInteractionsResponseToClaude
Minimal Reproduction & Observed vs Expected
go test -v -race -count=1 -run TestRepro_InteractionsClaudeStepStartDropsInlineArguments ./internal/translator/interactions/claude

Observed output (origin/dev 32842348):

=== RUN   TestRepro_InteractionsClaudeStepStartDropsInlineArguments
    repro_v812_test.go:20: inline function_call.arguments in step.start was dropped (no input_json_delta):
        ...
        event: content_block_start
        data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"call_1","name":"lookup","input":{}}}
        event: content_block_stop
        data: {"type":"content_block_stop","index":0}
--- FAIL: TestRepro_InteractionsClaudeStepStartDropsInlineArguments (0.00s)
Check / Field Observed (origin/dev 32842348) Expected
Inline step.arguments in step.start Dropped (input:{} only) Emits input_json_delta with partial_json: "{\"q\":\"x\"}"
Proposed fix (internal/translator/**)

In interactionsStepStartToClaude (interactions_claude_response.go:155-160), if step.Get("arguments").Exists() and is non-empty, emit an input_json_delta event right after appendClaudeToolBlockStart.

What ran / Not run
  • Ran: Hermetic go test -v -race -count=1 -run TestRepro_InteractionsClaudeStepStartDropsInlineArguments ./internal/translator/interactions/claude against origin/dev (32842348).
  • Not run: Live upstream calls.
Dominant language
Go
Stars
58.8k
Forks
9k
Avg merge
14h 20m
Merged PRs (30d)
67

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from router-for-me/CLIProxyAPI

All issues in router-for-me/CLIProxyAPI

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.