Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/adapters/google-antigravity-wire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,29 @@ function clientThreadAnchor(parsed: OcxParsedRequest): string | undefined {
return undefined;
}

/**
* Which class of anchor {@link antigravitySessionId} derives this request's session id from.
*
* The id itself identifies a live conversation and is a Google-visible wire value, so it is not
* something a user can paste into a public bug report. The class is: it distinguishes the four
* stability regimes above — a Codex parent/child pair, a parent-only client, the content-derived
* text anchor that compaction can move, and the random fallback that changes every turn — while
* carrying no identity at all.
*
* Deliberately a separate read rather than a return value of the id function: nothing about the
* session id changes because a diagnostic wants to describe it. The correspondence between the
* two is pinned behaviourally by tests rather than by sharing a branch.
*/
export type AntigravitySessionAnchor = "parent-and-own" | "parent-only" | "text" | "none";

export function antigravitySessionAnchor(parsed: OcxParsedRequest): AntigravitySessionAnchor {
const own = parsed._codexOwnThreadId?.trim();
const parent = parsed._clientThreadId?.trim();
if (own && parent) return "parent-and-own";
if (parent) return "parent-only";
return firstUserText(parsed) ? "text" : "none";
Comment on lines +149 to +152

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add focused tests for the new diagnostic

This commit adds the projection, error classifier, debug emission, and a duplicated session-anchor decision without adding any tests, even though the comment above this function says its correspondence with antigravitySessionId is pinned behaviorally. A later change to either branch can therefore make the diagnostic report the wrong anchor, and the privacy/bounding claims are also unverified; add focused adapter tests covering anchor correspondence, ordinal pairing, truncation, classification, and the debug gate.

AGENTS.md reference: src/AGENTS.md:L22-L26

Useful? React with 👍 / 👎.

}

/** A Gemini content part as it appears in an Antigravity request body. */
interface GeminiPart {
thought?: boolean;
Expand Down
Loading
Loading