Skip to content

fix(antigravity): align replay identities and fork checkpoints with native inputs - #996

Merged
BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
bwndlct:codex/pr-antigravity-native-history
Nov 21, 2026
Merged

BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
bwndlct:codex/pr-antigravity-native-history

Conversation

@bwndlct

@bwndlct bwndlct commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cold replay previously reused stored turn references by the display-group position. Missing mappings or adjacent native user inputs grouped together could therefore assign an existing identity to the wrong turn, duplicate a key, or fork at the wrong native boundary.

  • Carry the native user-input index through history replay and use the final native input of each display group for its fork checkpoint. For example, 15 native inputs displayed as 14 groups still retain all 15 inputs when forking at the last group.
  • Preserve valid stored identities while aligning sparse numeric and legacy references without consuming a later group's mapping. Generate unmapped identities from native boundaries so cold reads and subsequent mapped reads agree.
  • Preserve the existing display grouping and document the distinction between identity and checkpoint.

Related issues

Relates to #905 (history recovery and mapping alignment). This PR does not change the live readNativeTurnCount() lag/failure path or claim to resolve every part of that issue.

Test plan

Reviewed independently with GPT-6.1 Sol at max reasoning, against upstream 80d4926a4; no blocking findings.

  • node node_modules/typescript/bin/tsc -b --pretty false --force — passed.
  • node node_modules/vitest/vitest.mjs run --config tests/vitest.config.js packages/adapters/antigravity/test/acp-projection.test.ts packages/adapters/antigravity/test/native-history.test.ts packages/adapters/antigravity/test/fork.test.ts packages/adapters/antigravity/test/rollback.test.ts packages/adapters/antigravity/test/adversarial-fork-rollback.test.ts packages/host-runtime/test/antigravity-history.test.ts packages/host-runtime/test/external-thread-history.test.ts packages/host-runtime/test/external-thread-fork.test.ts — 8 files, 104 tests passed.
  • Changed-file ESLint, Prettier, node tools/check-boundaries.mjs, and git diff --check — passed.
  • node node_modules/typescript/bin/tsc -p tests/tsconfig.json --noEmit --pretty false — reports 9 errors in unchanged desktop-extension and local-shared-host test files. Repeated the same command on detached, unmodified upstream 80d4926a4 in the same worktree: exactly the same 9 diagnostics; no new diagnostics in this PR.

Local environment: macOS arm64, Node 24.22.0. Real Antigravity/Desktop fork UI, Windows, and the full repository test suite were not run. The tests use isolated fixtures and do not invoke a real model.

Remote CI note: the PR's Static checks job passes formatting and lint, then reports the same 12 test-type diagnostics as current upstream main 810f46e0b (upstream CI run 44740366913, PR run 44742539238). They are in unchanged desktop-extension/local-shared-host tests; subsequent upstream icon changes account for the difference from the 9 diagnostics on the local review baseline.

The completed Windows job also reproduces upstream's desktop-extension-data.test.ts EPERM rename failure (same test and source location as upstream run 44740366913). Vitest, Web Host, Ubuntu, macOS, Linux ARM64, and CodeRabbit checks passed for this PR. The two remaining failures are documented rather than changing unrelated extension code in this history fix.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 修复
    • 修正 Antigravity 历史回放中的轮次身份与检查点匹配方式,使合并轮次、稀疏编号及非数字身份都能正确保留。
    • 提升首次读取与再次加载时轮次身份的一致性。

Antigravity 历史回放现在为用户文本事件保留原生输入索引。轮次投影使用该索引匹配已有身份或生成轮次键,并据此设置检查点。

Changes: Antigravity 回放身份对齐

Layer / File(s) Summary
传递原生输入边界
packages/adapters/antigravity/src/acp-types.ts, packages/adapters/antigravity/src/native-replay.ts
user.text 事件新增可选的 nativeTurnIndex。历史读取为每条 USER_INPUT 分配索引,并将其附加到非空用户文本事件。
按原生边界投影轮次身份
packages/adapters/antigravity/src/acp-projection.ts, packages/adapters/antigravity/test/acp-projection.test.ts, packages/adapters/antigravity/test/native-history.test.ts, docs/harnesses/capability-boundaries.md
投影逻辑根据原生边界匹配已知轮次身份或生成不冲突的 turn-N 键,并用边界索引设置检查点。测试覆盖合并轮次、冷回放重读、稀疏编号及非数字身份;文档说明相应规则。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

  • Issue 905:涉及冷加载回放中按数组下标匹配已知身份所导致的错位;本次改动处理了身份与原生输入边界的对齐,但未涉及该问题描述中的 readNativeTurnCount() 行为。

Possibly related PRs

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · previous review 3bdf1

The change aligns Antigravity replay turn identities and fork checkpoints with native user inputs, and tests cover the merged and sparse-ref cases. No concrete defect was found, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题描述了 PR 的主要变更:将历史回放的身份映射和分叉检查点与原生用户输入对齐。变更摘要中的 acp-projection.ts、native-replay.ts、acp-types.ts 及测试文件均与该标题一致。标题较长(81 个字符),但与变更集直接相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed PR 描述与变更集高度相关。描述说明了冷回放中展示分组位置导致身份错配的问题,并列出了 native-replay、acp-projection、acp-types 等文件对应的改动,包括原生用户输入序号、分叉检查点、稀疏与旧版引用对齐以及未映射身份的生成。测试计划也说明了具体运行的命令与结果。描述不是离题内容,也不是空泛的通用文字。
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ross upgrade

When merged native user inputs had been saved with contiguous zero-based keys (turn-0, turn-1, ...), re-identifying groups by native boundary shifted the first group onto the second group's stored Turn ID. Restore the saved identities while keeping the corrected native fork checkpoints.
@BytePioneer-AI
BytePioneer-AI merged commit 5d22eea into BytePioneer-AI:main Nov 21, 2026
5 of 7 checks passed
@BytePioneer-AI

Copy link
Copy Markdown
Owner

Merged, thanks @bwndlct! Verified against real agy 1.5.13 (gemini-3.8-flash): sparse mappings no longer drift Turn identities, and forking turn-0 isolates the first turn cleanly and continues chatting without disturbing the source session. Added one follow-up commit to preserve contiguous legacy display-position identities (turn-0, turn-1, …) across upgrades on merged user inputs while keeping the corrected native fork checkpoints.

BytePioneer-AI added a commit that referenced this pull request Nov 21, 2026
Keep both #944's live-fork test and #942's late-transcript metering test in antigravity-adapter.test.ts.
BytePioneer-AI added a commit that referenced this pull request Nov 21, 2026
…eview findings

Resolve conflicts with main (preserving dfe3d82 trailing background promotion alongside independent autonomous wake Turns, #944 live WAL fork, #996 legacy merged Turn identities, #976 Turn-ID plan replay, and #942 request-level TTFT); validate turn.autonomous.completed strictly in harness-broker; isolate autonomous Turn recording/projection failures from foreground Turns and retry stale history reads; keep wake-observer polling until the window deadline so a notified-but-uncommitted wake is not dropped after publishing an earlier wake.
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.

2 participants