Skip to content

fix(antigravity): join IDE cache history metadata - #21794

Merged
nwparker merged 3 commits into
nwparker/agy-native-accountsfrom
nwparker/agy-ide-history-cache
Sep 21, 2026
Merged

nwparker merged 3 commits into
nwparker/agy-native-accountsfrom
nwparker/agy-ide-history-cache

Conversation

@nwparker

@nwparker nwparker commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​100 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84

What changed

Antigravity CLI/IDE builds that use the newer cache format can have conversation metadata without the legacy history.jsonl. Orca now falls back to cache/conversation_metadata.json plus cache/projects.json to recover a workspace for an already discovered transcript.

ELI5: agy moved the index card that says “this conversation belongs to this folder.” Orca now reads that index card when the old history file is missing, without opening opaque conversation databases or copying prompt contents.

Verification

  • ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/ai-vault/session-scanner-antigravity-source.test.ts
  • pnpm tc:node
  • pnpm run check:code-quality:changed origin/main
  • Added a sanitized metadata/projects fixture; no account identifiers, tokens, or conversation blobs are committed.

This PR is stacked on #21784.

@nwparker

Copy link
Copy Markdown
Contributor Author

Live follow-up evidence for the cache fallback:

  • On the installed agy profile, the legacy history path was absent/unenriched while cache/conversation_metadata.json contained conversation metadata.
  • The real cache uses projects.json as workspace → project ID and also has last_conversations.json as workspace → conversation ID. The fallback now supports both project-map orientations and uses the latter when project IDs are stale.
  • A redacted local read produced 125 metadata rows with only conversation IDs, timestamps, and workspace paths; no prompt text, conversation database, credential, or account data was read or published.
  • Local regression coverage is 9/9 scanner tests, pnpm tc:node, and changed-code quality all passing.

ELI5: agy moved the folder lookup card and sometimes lets the old project list go stale. Orca now checks the newer card and the “last conversation in this folder” list, while still leaving the conversation contents alone.

@nwparker

Copy link
Copy Markdown
Contributor Author

Additional live agy verification from the installed macOS CLI (no credentials or raw response published):

  • agy --print 'Reply with exactly AGY_LIVE_OK and nothing else.' --output-format text exited 0 and returned AGY_LIVE_OK.
  • agy --print /usage --output-format json exited 0, parsed two quota groups with one bucket each.

This confirms the installed agy profile is healthy for the CLI path; the PR itself remains scanner-only and does not depend on quota output.

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent verification (2026-09-20):

  • Antigravity history/cache scanner and ingest tests: 21/21 passed.
  • pnpm tc:node passed.
  • pnpm run check:code-quality:changed origin/main passed with 0 new findings across 197 changed files.
  • Installed agy 1.2.7 authenticated exact sentinel returned AGY_HISTORY_OK.
  • Full CI 35513262552 is green across all test shards, typecheck, static analysis, macOS/Windows packages, and verify. The PR includes sanitized cache fixtures and live redacted cache evidence.

Verdict: approve scoped to cache metadata workspace joins. Dedicated IDE sign-in and broader history/resume behavior remain follow-ups; no raw transcript or account data is published. No merge performed.

@nwparker

Copy link
Copy Markdown
Contributor Author

Fresh verification update (2026-09-20):

  • Current PR head fetched unchanged.
  • Focused cache/history scanner suite: 10 passed.
  • pnpm tc:node: passed.
  • Changed-code quality gate: 0 new findings across 197 changed files.
  • Installed agy authenticated sentinel returned AGY_IDE_CACHE_OK.
  • Created and exercised a sanitized IDE-cache sample with synthetic conversation/project IDs, a synthetic workspace path, conversation_metadata.json, projects.json, and last_conversations.json; no account IDs, OAuth URLs, prompts, or raw cache contents were used.

Merge verdict: Approve scoped to newer IDE cache metadata workspace joins. The cache-only path is now directly covered by a sanitized sample and the focused scanner tests. Dedicated IDE sign-in, broader history/resume behavior, and remote/SSH/WSL cache locations remain follow-ups.

@nwparker

Copy link
Copy Markdown
Contributor Author

ELI5: agy's IDE keeps the conversation label and workspace mapping in small metadata files. This change joins those labels to the cached history so Orca can show the right project/session. The sanitized fixture and focused tests pass; this does not claim full IDE transcript replay or remote cache support.

@nwparker
nwparker marked this pull request as ready for review September 21, 2026 01:04
@nwparker
nwparker merged commit a96b371 into nwparker/agy-native-accounts Sep 21, 2026
28 checks passed

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — minor test-coverage and reuse suggestions inline.

Reviewed changes

  • Cache-metadata fallback: readLocalAntigravityHistory now falls back to cache/conversation_metadata.json (plus optional projects.json / last_conversations.json) when history.jsonl can't be read, synthesizing {conversationId, timestamp, workspace} JSONL rows for the existing resolver. Gate refusals still rethrow, preserving the documented WSL contract.
  • Projects/last_conversations join: project paths are recovered from either orientation of projects.json, with last_conversations.json used when ProjectID is stale.
  • New fixtures: three tests covering the projects join, the last_conversations fallback, and Windows-style workspace paths.

ℹ️ Remote/SSH Antigravity hosts don't get the cache fallback

The fallback is wired only for the local scan. remote-session-scanner.ts:71 injects a readHistory that reads just history.jsonl, so a remote or SSH host running a newer agy build still leaves cwd null — the same symptom this PR fixes locally. Since the repo treats SSH as a first-class execution host, it's worth deciding explicitly whether that's a follow-up or in scope here.

Technical details
# Remote scan lacks the cache-history fallback

## Affected sites
- src/main/ai-vault/remote-session-scanner.ts:71 — injected `readHistory` reads only `provider.readFile(historyPath)`
- src/main/ai-vault/remote-session-scanner-sources.ts:138 — `historyPath` is the only Antigravity metadata file addressed

## Required outcome
- Decide whether newer-cache Antigravity installs on remote/SSH hosts should also recover `cwd`, or whether `cwd: null` is acceptable there.

## Open questions for the human
- Is the remote Antigravity cache readable through the existing provider abstraction, or does it need its own transport?

ℹ️ Nitpicks

  • projects.json is guarded for both {workspace: projectId} and {projectId: workspace} (session-scanner-antigravity-history.ts:57-61), but the {projectId: workspace} branch has no test. Given the code comment says agy has emitted both shapes, a fixture for it would pin the behavior.
  • last_conversations.json is assumed to be {workspace: conversationId}; if agy ever flips that too, the fallback degrades silently to no rows. Not asking for defensive symmetry, just flagging the asymmetry with the guarded projects.json.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +46 to +51
await expect(readLocalAntigravityHistory(join(cliRoot, 'history.jsonl'))).resolves.toContain(
'"conversationId":"aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee"'
)
await expect(readLocalAntigravityHistory(join(cliRoot, 'history.jsonl'))).resolves.toContain(
'"workspace":"/tmp/sanitized-antigravity-workspace"'
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These assertions only inspect the serialized string, so the test would still pass if a synthesized row couldn't actually be indexed. For example, renaming the timestamp key would make indexAntigravityHistory skip every row (timestampMs(undefined) is NaN, session-scanner-antigravity-history.ts:167-168)) and cwd would stay null anyway. The sibling tests below drive scanAiVaultSessions end to end — asserting cwd for the cache-only layout there would cover the integration seam this PR adds.

Technical details
# Cache-path tests don't assert the enrichment outcome

## Affected sites
- src/main/ai-vault/session-scanner-antigravity-source.test.ts:46-51 — `toContain` on the raw returned string
- src/main/ai-vault/session-scanner-antigravity-history.ts:167 — parser drops entries without a finite timestamp

## Required outcome
- A cache-only layout (no `history.jsonl`; `conversation_metadata.json` + `projects.json`) must yield a session with `cwd` set, asserted through `scanAiVaultSessions`.

## Suggested approach (optional)
- Reuse `isolatedScanRoots(root)` + `writeAntigravityTranscript(...)`, write the cache files under `join(root, 'cache')`, then `expect(result.sessions[0]?.cwd).toBe(workspace)`.

}
}

function isRecord(value: unknown): value is Record<string, unknown> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

asRecord in ./session-scanner-record-value (already re-exported from ./session-scanner-values, which this file imports) is the established guard for exactly this shape. This local isRecord is a second implementation of the same predicate; since asRecord returns a nullable record rather than a boolean, the call sites would become const x = asRecord(v); if (!x) ... — a small change that keeps one record guard in the module.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant