Skip to content

Gemini side task fails with 400 due to unsupported encrypted field #85

Closed

Description

@Jossi02

Summary

When I select a Gemini model for a side task in Codex through OpenCodex, the request fails with HTTP 400 before streaming begins.

The Google Antigravity API rejects the generated tool schema because it contains an unsupported field named encrypted.

Steps to reproduce

  1. Enable and configure OpenCodex in Codex.
  2. Configure the google-antigravity provider.
  3. Start a side task.
  4. Select google-antigravity/gemini-3.5-flash-high.
  5. Set the reasoning effort to max.
  6. Send a prompt in a context where Codex tools are available.

Expected behavior

The side task should start successfully using the selected Gemini model.

The available Codex tools should be converted into a schema supported by the Google Antigravity API.

Actual behavior

The request fails immediately with HTTP 400 and invalid_request_error.

The upstream response reports that an encrypted field was included in multiple function declarations, but this field is not recognized by the Antigravity API schema.

Error log

{
  "requestId": "ocx-mreja3p0-1p",
  "timestamp": 1783663643700,
  "model": "gemini-3.5-flash-high",
  "provider": "google-antigravity",
  "requestedModel": "google-antigravity/gemini-3.5-flash-high",
  "requestedEffort": "max",
  "status": 400,
  "durationMs": 507,
  "errorCode": "invalid_request_error",
  "closeReason": "non_stream",
  "upstreamError": "Provider error 400: Antigravity invalid request: Invalid JSON payload received. Unknown name \"encrypted\" at 'request.tools[0].function_declarations[9].parameters.properties[0].value': Cannot find field.\nInvalid JSON payload received. Unknown name \"encrypted\" at 'request.tools[0].function_declarations[12].parameters.properties[0].value': Cannot find field.",
  "usageStatus": "unreported"
}

Suspected cause

OpenCodex appears to be forwarding or generating the non-standard encrypted property inside one or more tool parameter schemas.

The Google Antigravity API does not accept this property in its function_declarations schema. Unsupported schema fields may need to be removed before sending requests to Gemini through Antigravity.

The error references at least the following declarations:

  • request.tools[0].function_declarations[9]
  • request.tools[0].function_declarations[12]

Environment

  • OpenCodex version or commit: 2.7.3
  • Codex app version: latest
  • OS: Windows 11 25H2
  • Provider: google-antigravity
  • Model: gemini-3.5-flash-high
  • Requested reasoning effort: max

Provider configuration verification

I verified that the built-in google-antigravity provider is being used with the following configuration:

  • Adapter: google
  • Authentication: oauth
  • Google mode: cloud-code-assist
  • Base URL: https://daily-cloudcode-pa.googleapis.com
  • Default model: gemini-3.5-flash-low
  • Selected side-task model: gemini-3.5-flash-high

The Google account is authenticated successfully, quota information is available, and gemini-3.5-flash-high is present in the provider's model list.

Therefore, this does not appear to be caused by a custom provider or an incorrectly registered model.

Activity

  1. lidge-jun commented on Jul 10, 2026

    @lidge-jun
    Owner

    Thanks for the report. We've confirmed this is a compatibility issue with the multi-agent v2 tool schema: Gemini rejects the Responses-only encrypted field.

    Until a fix is released, please switch back to multi-agent v1 as a temporary workaround. We'll update this issue once the fix is available.

  2. Jossi02 commented on Jul 10, 2026

    @Jossi02
    Author

    I switched the multi-agent mode to v1, restarted the Codex app, and created a completely new chat.

    Gemini side tasks now work correctly in the new v1 chat. Existing chats created under v2 continued to fail with the same encrypted field error, as expected.

    This confirms that the issue is specific to the multi-agent v2 tool schema. Thanks for the workaround.

  3. lidge-jun commented on Jul 10, 2026

    @lidge-jun
    Owner

    Fixed in commit e335e84 on dev.

    Root cause: upstream openai/codex (commit 5f4d06ef, PR #26210) stamps a Responses-only JSON-Schema marker encrypted: true on the v2 collaboration tool schemas (spawn_agent / send_message / followup_task → message property). Since v2.7.3 opencodex forwards Codex Desktop's v2 additional_tools, and the Gemini sanitizer's keyword blacklist didn't cover encrypted, so the marker reached the Google backend verbatim — Gemini/Antigravity rejects the whole request with 400 Invalid JSON payload... Unknown name "encrypted" before streaming, even if the tool is never called.

    Fix:

    • google-tool-schema.ts: encrypted added to DROPPED_SCHEMA_KEYS — stripped recursively from every functionDeclaration.
    • kiro-tools.ts: same defensive strip for the Kiro/Bedrock wire (its validator also rejects an undocumented narrow schema subset).
    • Regression tests at the sanitizer, google-adapter (end-to-end functionDeclarations), and kiro wire levels. OpenAI Responses passthrough keeps the marker untouched, as required.

    We also ran a provider risk audit for this keyword class: OpenAI chat non-strict is contractually tolerant (additionalProperties: true), Anthropic/Cursor are unverified but now defensively covered where evidence warranted, Bedrock-family is the riskiest and is covered.

    Workaround until the next release: keep multi-agent on v1, or use reasoning levels that don't expose the v2 collaboration tools. The fix will ship in the next release. Thanks for the clean report and for confirming the v1 workaround!

  4. lidge-jun commented on Jul 10, 2026

    @lidge-jun
    Owner

    Closing — fixed by e335e84 (ships in the next release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions