Adopt the proxy's reasoning and tool-call fidelity in the coder #31

Closed AtlantisPleb opened this 3d ago 1 comment

Outcome

The thread-backed coder session shows the model's reasoning and runs a faithful client-side tool loop, completing OpenAgentsInc/openagents.com#164.

What the server now provides (landed as openagents.com c26c188)

  • Reasoning arrives as choices[0].delta.reasoning (string, whole — the proxy buffers the SSE body), interleaved with delta.content.
  • Tool calls: choices[0].delta.tool_calls[] with id, type: "function", function.name, function.arguments (JSON string), then finish_reason: "tool_calls".
  • The request side now preserves standard OpenAI chat shape: assistant messages with tool_calls (content may be empty) and role:"tool" messages with tool_call_id are replayed faithfully to the provider.

CLI work

  1. Parse delta.reasoning in the thread lane and render it into the existing reasoning entries.
  2. Replace the plain-turn tool-result feedback in the client tool loop with proper history: replay the assistant tool_calls message plus role:"tool" results.
  3. Keep the 4,000-char tool-result bound as a context decision; the transcript writer (#23) records the unbounded server copy separately.
  1. AtlantisPleb opened this issue 3d ago
  2. AtlantisPleb closed this as completed in cf1861c 3d ago
  3. A AtlantisPleb Author 3d ago

    Closing as completed. Merged to main and pushed as cf1861c9cb (WAL receipt seq 67). The thread lane now parses delta.reasoning into reasoning chunks (rendered in the UI and recorded whole-block by the transcript writer), and the client tool loop replays faithful history: one assistant message per round carrying the round's tool_calls with raw JSON arguments, followed by role:"tool" results in call order regardless of concurrent completion order. Interrupted and MAX_TOOL_STEPS turns can no longer send orphaned tool_calls. Wire bound (4,000 chars) and record bound (64,000 chars) verified distinct. 41 targeted tests pass; server shape verified against openagents.com c26c188 with no mismatches.

Sign in with GitHub to comment on this issue.