Repository navigation
Conversation
There was a problem hiding this comment.
3 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/opencode/src/plugin/request.ts">
<violation number="1" location="packages/opencode/src/plugin/request.ts:2456">
P1: `sanitizeRequestPayloadForAntigravity` runs after this repair and re-adds `thoughtSignature: SKIP_THOUGHT_SIGNATURE` to the first function call in each content, so GPT-OSS requests can still be rejected for an unsupported signature. Skip this injection for GPT-OSS or strip the signature after sanitization.</violation>
</file>
<file name="packages/opencode/src/plugin/request-helpers.ts">
<violation number="1" location="packages/opencode/src/plugin/request-helpers.ts:3106">
P2: Valid `executableCode` and `codeExecutionResult` parts reach this fallback as if they were empty, so it adds `text: '.'` alongside their payloads. Include both fields in the emptiness check to avoid sending malformed Gemini parts.</violation>
<violation number="2" location="packages/opencode/src/plugin/request-helpers.ts:3295">
P2: This can reuse an ID already owned by a later call, giving two calls the same ID and making their responses ambiguous. Track IDs owned by other calls and allocate a fresh ID when the response ID is already claimed.</violation>
</file>
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
| ) | ||
| } | ||
|
|
||
| if (isGptOss && Array.isArray(requestPayload.contents)) { |
There was a problem hiding this comment.
P1: sanitizeRequestPayloadForAntigravity runs after this repair and re-adds thoughtSignature: SKIP_THOUGHT_SIGNATURE to the first function call in each content, so GPT-OSS requests can still be rejected for an unsupported signature. Skip this injection for GPT-OSS or strip the signature after sanitization.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/plugin/request.ts, line 2456:
<comment>`sanitizeRequestPayloadForAntigravity` runs after this repair and re-adds `thoughtSignature: SKIP_THOUGHT_SIGNATURE` to the first function call in each content, so GPT-OSS requests can still be rejected for an unsupported signature. Skip this injection for GPT-OSS or strip the signature after sanitization.</comment>
<file context>
@@ -2447,6 +2453,12 @@ function prepareAntigravityRequestIn(
)
}
+ if (isGptOss && Array.isArray(requestPayload.contents)) {
+ requestPayload.contents = repairGptOssToolPairing(
+ requestPayload.contents,
</file context>
| if (pairedResponses.has(respHolder)) continue | ||
| if (isResponseAfterCall(respHolder, callHolder)) { | ||
| let pairedId: string | undefined = | ||
| callHolder.call.id || respHolder.resp.id |
There was a problem hiding this comment.
P2: This can reuse an ID already owned by a later call, giving two calls the same ID and making their responses ambiguous. Track IDs owned by other calls and allocate a fresh ID when the response ID is already claimed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/plugin/request-helpers.ts, line 3295:
<comment>This can reuse an ID already owned by a later call, giving two calls the same ID and making their responses ambiguous. Track IDs owned by other calls and allocate a fresh ID when the response ID is already claimed.</comment>
<file context>
@@ -3063,6 +3063,266 @@ export function applyToolPairingFixes(
+ if (pairedResponses.has(respHolder)) continue
+ if (isResponseAfterCall(respHolder, callHolder)) {
+ let pairedId: string | undefined =
+ callHolder.call.id || respHolder.resp.id
+ if (!pairedId) {
+ pairedId = allocateId()
</file context>
| if (cloned.functionCall && typeof cloned.functionCall === 'object') { | ||
| cloned.functionCall = { ...cloned.functionCall } | ||
| } | ||
| if ( |
There was a problem hiding this comment.
P2: Valid executableCode and codeExecutionResult parts reach this fallback as if they were empty, so it adds text: '.' alongside their payloads. Include both fields in the emptiness check to avoid sending malformed Gemini parts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/opencode/src/plugin/request-helpers.ts, line 3106:
<comment>Valid `executableCode` and `codeExecutionResult` parts reach this fallback as if they were empty, so it adds `text: '.'` alongside their payloads. Include both fields in the emptiness check to avoid sending malformed Gemini parts.</comment>
<file context>
@@ -3063,6 +3063,266 @@ export function applyToolPairingFixes(
+ if (cloned.functionCall && typeof cloned.functionCall === 'object') {
+ cloned.functionCall = { ...cloned.functionCall }
+ }
+ if (
+ cloned.functionResponse &&
+ typeof cloned.functionResponse === 'object'
</file context>
Problem
When using Google Antigravity with GPT-OSS models (such as \gpt-oss-120b-medium) in OpenCode:
Solution
epairGptOssToolPairing\ to \packages/opencode/src/plugin/request-helpers.ts:
epairGptOssToolPairing\ into \prepareAntigravityRequestIn\ in \packages/opencode/src/plugin/request.ts\ when target model is GPT-OSS.
equest-helpers.test.ts\ and integration tests in
equest.test.ts.
Verification
equest-helpers.test.ts\
equest.test.ts\
Summary by cubic
Fixes multi-turn tool calls and rejected turns when using Google Antigravity with GPT-OSS models like
gpt-oss-120b-medium.functionCallandfunctionResponseparts with matchingtool-call-NIDs in document order, preserving existing IDs and avoiding collisions.thoughtandthoughtSignaturefrom parts for GPT-OSS models, which reject them..text fallback unless they carryinlineDataorfileData.Written for commit fc9f3f1. Summary will update on new commits.