Skip to content

fix(native-chat): show the first Chat message of an Antigravity session once - #25117

Closed
sojiro-o wants to merge 1 commit into
stablyai:mainfrom
sojiro-o:sojiro-o/chat-first-send-second-precision
Closed

sojiro-o wants to merge 1 commit into
stablyai:mainfrom
sojiro-o:sojiro-o/chat-first-send-second-precision

Conversation

@sojiro-o

@sojiro-o sojiro-o commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

ELI5

When you send the first message of a new Antigravity conversation from Chat, Orca shows it twice. Orca shows your message right away and is supposed to hide that copy once Antigravity records the real one. For the first message, it never recognized the real one, so the copy stayed.

What Changed

Before: the first message sent from Chat in a new Antigravity session appears twice. The extra copy, with an empty "completed" turn under it, stays pinned at the bottom of the conversation as later turns arrive.
After: the first message appears once, like every later message.

Mechanism: Chat shows a sent message immediately, then hides it once the transcript contains the matching user row. Later sends anchor on the last message visible when they were sent. The first send has nothing to anchor on, so it only matches rows stamped at or after the send time. Antigravity stamps rows in whole seconds (…00:44:36Z) while the send time is in milliseconds (…00:44:36.3), so the real row reads as before the send and never matches.

In messageIsAfterPendingTimestamp, a row stamped on an exact second is now compared against the send time rounded down to its second. Rows with millisecond precision (Claude, Codex) keep the exact comparison.

Why

The time check exists so a new send can't be matched by an older message with the same text. Rounding only for whole-second rows keeps that protection: a whole-second row from any earlier second still doesn't match, and millisecond rows behave exactly as before.

Alternatives considered:

Linked Issue

Fixes #25116

Visual Proof

Before, on #24627 with Windows + WSL2, agy 1.2.16:

Before: first send rendered twice Before: duplicate pinned below later turns

After: not captured. Antigravity Chat isn't on main yet (#24627), so the app can't show the fixed state on this branch alone. The regression test below covers the exact timestamps from this session.

Testing

AI Disclosure

Investigation, fix, and tests were written with Claude Code (Claude Opus 5.5) and reviewed by me.

Review

Single function change in src/renderer/src/components/native-chat/native-chat-pending.ts, plus two tests.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Renderer-only comparison logic: no platform, SSH, mobile, or wire-format impact. Related: #24627 (Antigravity Chat), #24141.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

…nscript rows

A first send has no message boundary, so its echo is retired only by a
user row stamped at or after the millisecond send time. Antigravity
stamps whole seconds, so the send's own row reads up to 999ms earlier,
never matches, and the echo stays pinned below every later turn.

Whole-second rows now compare against the send time floored to its
second; millisecond rows keep the exact comparison.

@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 new issues found.

Reviewed changes

  • Whole-second transcript rows match a first send — messageIsAfterPendingTimestamp now floors the comparison boundary to the row's second when the row is itself whole-second, so an Antigravity-style row stamped up to 999ms before the millisecond send time is recognized. Non-whole-second rows and the transcript-boundary path keep the exact comparison.
  • Two tests — one that fails without the fix (whole-second row preceding sentAt retires the first send), one guarding that an earlier-second identical row still does not match.

The change is a private helper with a contained blast radius (messagesAfterPendingBoundary → prunePendingSends / pendingSendsAsMessages), and it only widens matching on the no-boundary (first-send) path, so it cannot introduce duplicates. The only nuance is that the whole-second detection is value-based, not agent-based, so a millisecond-precision row landing exactly on a second boundary is also floor-compared; the resulting worst case (an older identical prompt in the same second) is a narrow window the PR body explicitly weighs against a fixed tolerance.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ac254f9c-e83b-4826-bf3f-45a3aacb1e34
📥 Commits

Reviewing files that changed from the base of the PR and between 5df67ef and 45fa5f9.

📒 Files selected for processing (2)
  • src/renderer/src/components/native-chat/native-chat-pending.test.ts
  • src/renderer/src/components/native-chat/native-chat-pending.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The pending-send matching logic now accepts a whole-second transcript timestamp from the start of the send’s second when no transcript-clock boundary exists. It continues to exclude ties when a boundary exists. Regression tests cover a matching transcript row in the same second, which causes the pending send to be hidden and pruned, and a completed transcript row from the preceding second, which leaves it pending.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 45fa5

The first-message fix is mergeable after normal checks. A narrow timing edge case may briefly hide an optimistic message, but no material disruption is established.

Architecture Summary

Architecture risk: 🔵 Low · up to 45fa5

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (ui) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in src/renderer/src/components/native-chat/native-chat-pending.test.ts: Adds a test expecting a first send with no recorded message boundary to be hidden and pruned when its matching user turn has a whole-second timestamp in the same second as the send’s millisecond timestamp.
  • observed — Modified behavior in src/renderer/src/components/native-chat/native-chat-pending.test.ts: Adds a test expecting a first send to remain pending when its matching completed transcript turn has a whole-second timestamp from the preceding second.
  • observed — Modified behavior in src/renderer/src/components/native-chat/native-chat-pending.ts: messageIsAfterPendingTimestamp continues to exclude ties when afterMessageTimestamp is set. Without that transcript-clock boundary, it now includes whole-second timestamps from the start of the send’s second, while other timestamps must be at least the send-time boundary.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix: show the first Chat message of an Antigravity session only once.
Description check ✅ Passed The description explains the user-visible problem, the timestamp comparison change, the rationale, and the linked issue. It also reports regression tests and other checks. The after-state visual proof…
Linked Issues check ✅ Passed [#25116] requires the first optimistic Chat message to match Antigravity’s transcript row when the row timestamp has whole-second precision. messageIsAfterPendingTimestamp now compares whole-second …
Out of Scope Changes check ✅ Passed The diff changes only pending-message timestamp matching and adds focused regression tests for [#25116]. No unrelated changes are present.
  • Fix all pre-merge checks with AI
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

nwparker added a commit that referenced this pull request Oct 4, 2026
Antigravity records first turns at whole seconds, leaving a millisecond
composer echo visible below later turns. Publish optional source precision
and use it when matching local sends and seeded launch prompts; retain strict
transcript boundaries and exact matching when precision is absent.

Credits @sojiro-o/#25117 for the first-send diagnosis and proposed regression.
Retains the Antigravity Chat contributions from @haoliangli/#15773 and
@sojiro-o/#24141 without changing accepted readiness or capture assets.

Co-authored-by: sojiro-o <[email protected]>
nwparker added a commit that referenced this pull request Oct 4, 2026
Compose main 2b3b692 with the
complete Chat feature and ed05 source-clock repair. Preserve provider step
order and incoming split-reasoning order; remove a duplicated import
introduced by the automatic merge and test the combined ordering contract.

Retains credits for @sojiro-o/#25117 and #24141 and @haoliangli/#15773;
original author objects and measured coauthor trailers remain unchanged.
@sojiro-o

sojiro-o commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of ed05fdb in #24627, which fixes this more precisely: the Antigravity decoder now marks its rows as second-precision, so only those rows get the rounded comparison, and launch prompts are covered too. This PR guessed precision from the value itself, and Antigravity Chat isn't on main yet anyway. Thanks for picking it up and for the credit!

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.

Chat shows the first message of a new Antigravity session twice

1 participant