Repository navigation
Replies: 1 comment
|
Your diagnosis is correct, and it is confirmed directly against the published The drop is real In The consequence is structural rather than incidental: the signature arrives on the same delta that creates the block, and the block is the only thing carried forward, so the information is destroyed at first contact rather than lost on the way back out. One correction to the patch framing Your diff extends On the second issue (error body shape) The one-element array A cheaper alternative worth mentioning alongside the patch
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Using a Google Argon 4 model through the OpenAI-compatible endpoint
(
https://generativelanguage.googleapis.com/v1beta/openai/), the second turn ofa tool call fails with HTTP 400:
Google streams the required signature inside the tool-call delta:
pi-ai'sopenai-completionsadapter dropsextra_contentwhile streaming andnever re-emits it when replaying the assistant tool call, so the signature is lost
and Google rejects turn 2.
A second, smaller issue: Google returns error bodies as a one-element JSON array
[{error:{...}}]rather than{error:{...}}. The OpenAI SDK readserrorResponse['error'], getsundefined, and the whole turn collapses into theopaque
400 status code (no body).Proposed patch
Two pnpm patches, both verified with
git apply --checkagainst the publishedtarballs (
@earendil-works/pi-ai@1.1.0,openai@7.19.0).1. Extend
patches/@earendil-works__pi-ai@1.1.0.patchIn
dist/api/openai-completions.js, capture the signature inensureToolCallBlock:and re-emit it in
convertMessages:block.thoughtSignaturealready exists onToolCall, is already persisted by theassistant-message frame, and is already stripped by
transform-messages.tswhenthe model changes -- so no new serialization or cross-model guard is needed.
2. New
patches/openai@7.19.0.patchIn
core/error.mjs(andcore/error.js), unwrap the array inAPIError.generate:Register it in
pnpm-workspace.yaml:Verification
git apply --checkagainst the published tarballs.forced failure surfaces
Function call is missing a thought_signature ...instead of
400 status code (no body).patchedDependenciesandpnpm-lock.yaml(patch hashes + snapshotpatch_hashvalues) were regenerated to match; the lockfile parses cleanly.
Ask
Either apply the two patches at the pinned versions, or take the equivalent change
upstream in
earendil-works/pi(packages/ai/src/api/openai-completions.ts) so afuture pin bump carries it. Happy to split this into the pi-ai-only change if the
openaipatch is out of scope.All reactions