Skip to content

google-antigravity: a reasoning signature carried on a standalone thought part is dropped by the replay cache #897

Closed

Description

@brunoflma

Client or integration

Codex CLI

Provider or upstream service

google-antigravity (Antigravity / Code Assist), reasoning-signature replay.

OpenCodex version

2.10.0

Endpoint or capability

observeAntigravityReplay() / applyAntigravityReplay() in src/adapters/google-antigravity-replay.ts — the reasoning-signature replay cache used across sequential tool loops.

Current behaviour

observeAntigravityReplay() only records a signature when it appears on the same part as the functionCall:

for (const raw of parts) {
  if (!raw || typeof raw !== "object") continue;
  const part = raw as Record<string, unknown>;
  const sig = extractSignature(part);
  if (!sig) continue;
  const fc = part.functionCall as { name?: unknown; args?: unknown } | undefined;
  const ck = fc ? functionCallKey(fc.name, fc.args) : undefined;
  if (!ck) continue; // only function-call signatures are replayable by identity
  ...
}

This provider also emits the signature on a standalone thought part that precedes the functionCall it belongs to:

[
  { "thought": true, "thought_signature": "<sig>" },
  { "functionCall": { "name": "get_x", "args": { "a": 1 } } }
]

For that shape, extractSignature(part) returns the signature on the first part, the continue on the missing functionCall throws it away, and the second part has no signature of its own — so nothing is cached. On the next turn applyAntigravityReplay() finds no entry and the functionCall goes back upstream with no thoughtSignature.

The interesting part is that the read side already handles both spellings (part.thoughtSignature ?? part.thought_signature, plus the nested extra_content.google.thought_signature), so the intent to accept several shapes is clearly there — it is only the part-to-call association that assumes they arrive together.

Expected behaviour

A signature carried on a thought part should be associated with the next functionCall in the same parts array, so it can be replayed on the following turn like any other. Signatures already on the call's own part must keep taking precedence.

Minimal redacted request or reproduction

Against the module directly:

observeAntigravityReplay(MODEL, SESSION, [
  { thought: true, thought_signature: SIG },
  { functionCall: { name: "get_x", args: { a: 1 } } },
]);

const contents = [{ role: "model", parts: [{ functionCall: { name: "get_x", args: { a: 1 } } }] }];
applyAntigravityReplay(MODEL, SESSION, contents);

// expected: SIG    actual: undefined
(contents[0].parts[0] as { thoughtSignature?: string }).thoughtSignature;

Actual response or error

error: expect(received).toBe(expected)
Expected: "<sig>"
Received: undefined

At the provider boundary the symptom is subtler than a hard failure: sequential tool loops simply stop replaying reasoning signatures for the turns where the provider used the separate-thought shape.

Upstream documentation

Gemini / Code Assist Part allows thought and thoughtSignature as independent fields, so a thought part carrying only the signature is a valid shape rather than a provider quirk: https://ai.google.dev/api/caching#Part

Suggested mapping or implementation notes

Carry a pending signature forward within the same parts scan. This keeps the existing precedence and does not change behaviour when the signature is already on the call's own part:

let pendingSignature: string | undefined;
for (const raw of parts) {
  if (!raw || typeof raw !== "object") continue;
  const part = raw as Record<string, unknown>;
  const own = extractSignature(part);
  const fc = part.functionCall as { name?: unknown; args?: unknown } | undefined;
  const ck = fc ? functionCallKey(fc.name, fc.args) : undefined;
  if (!ck) {
    if (own) pendingSignature = own;
    continue;
  }
  const sig = own ?? pendingSignature;
  pendingSignature = undefined;
  if (!sig) continue;
  // ... unchanged: byte accounting, eviction, insert
}

I have been running this locally against the 2.10.0 replay module — the byte accounting, LRU eviction and session limits added in this release are untouched by it, and the existing suite in tests/google-antigravity-replay.test.ts still passes (21 tests) with the case above added.

Happy to send it as a PR with that test if you want it.

Additional context and attachments

Only the association is missing — the read path, the both-spellings handling and the cache mechanics all work correctly.

Checks

  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on an upstream specification or a concrete client requirement.

Activity

  1. github-actions commented on Aug 2, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: unknown.

  2. added
    provider-compatibility
    provider
    on Aug 2, 2026
  3. Ingwannu commented on Aug 3, 2026

    @Ingwannu
    Owner

    Confirmed against current dev (3cd75ab0). This is a real replay-cache defect, not only a documentation mismatch.

    observeAntigravityReplay() currently extracts the signature from the standalone thought part, then discards it because that part has no functionCall; the immediately following call therefore has no cache entry, and applyAntigravityReplay() cannot restore the signature on the continuation. The safe boundary is narrow: pair only forward within the same observed parts array, let a signature already on the call win, never carry an unpaired signature across observations, and leave the existing call/byte/session bounds unchanged.

    PR #941 implements that exact boundary and adds focused coverage for forward pairing, precedence, observation isolation, and non-thought parts. I have also applied it cleanly on top of the latest dev; the focused suite is 39/39 and typecheck passes. I am finishing the full current-dev integration run and the external-contributor CI before approving or closing this issue.

  4. added a commit that references this issue on Aug 3, 2026
    230aea9
  5. Ingwannu commented on Aug 3, 2026

    @Ingwannu
    Owner

    Fixed on dev by PR #941, merged as 230aea9e. The landed change preserves standalone thought signatures for the next function call within the same observed parts array while keeping call-local precedence and all existing cache bounds.

    Validation completed before merge: focused replay suite 39/39, typecheck, Linux shards, macOS, package smoke on all three hosted platforms, and React Doctor. Closing as completed. If Antigravity still rejects a continuation on a released build, please reopen with the redacted parts ordering from the failing response.

  6. added 2 commits that reference this issue on Sep 17, 2026
    8835041
    104967c
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

    providerprovider-compatibility

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions