Skip to content

Generated Pi extension (cbmem.ts) breaks Gemini/Antigravity: Type.Union of Type.Literal serializes to anyOf/const #2787

Open

Description

@jeffhuen

Summary

The Pi extension that codebase-memory-mcp install generates (cbmem.ts) builds string enums with Type.Union([Type.Literal(...), ...]). TypeBox serializes that as anyOf: [{ const: ... }]. Google's function-declaration schema (Gemini, Antigravity / Cloud Code Assist) has no const, so the API rejects the whole request and Pi cannot make any model call while the extension is loaded.

Environment

  • codebase-memory-mcp 0.12.1 (latest release)
  • Pi 1.1.0, provider: Antigravity (Gemini)
  • macOS, cbmem.ts generated by codebase-memory-mcp install

Repro

  1. Run codebase-memory-mcp install with Pi present, then start Pi with a Gemini/Antigravity model.
  2. Send any prompt.

Result (every prompt, including "reply OK"):

Antigravity API error (400): Invalid JSON payload received.
Unknown name "const" at 'request.tools[0].function_declarations[5].parameters.properties[1].value.any_of[0]': Cannot find field.

function_declarations[5] is index_repository and properties[1] is mode. The generated file has 30 such Type.Union sites (for example mode, format, direction, diagnostics, aspects).

Removing cbmem.ts makes the same Pi session work again, so the generated file is the trigger.

Suggested fix

Emit enums as plain JSON-schema string enums instead of literal unions, for example Type.Unsafe({ type: 'string', enum: [...] }) (or Pi's StringEnum helper), so the serialized schema is { type: 'string', enum: [...] } with no anyOf/const. The earlier hand-synced copy referenced in #1806 used plain JSON schema and did not have this problem.

Workaround

Rewrite const-unions as enums where the provider builds functionDeclarations. That fixes it for every extension without editing the generated block, which is overwritten on update.

Related: #1806, #1867 (earlier Pi generator fixes).

Activity

  1. DeusData commented on Oct 25, 2026

    @DeusData
    Owner

    Thank you for the exact provider rejection and the control with cbmem.ts removed. The generated enum schema versus provider acceptance is a clear boundary to investigate. I’ll follow up after maintainer review of the generator compatibility case.

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

    bugSomething isn't workingeditor/integrationEditor compatibility and CLI integration

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions