Skip to content

fix(antigravity): recover step timestamps via exact bot ID join - #3403

Merged
steipete merged 1 commit into
steipete:mainfrom
WeGoToMars:fix/antigravity-bot-id-timestamps
Sep 3, 2026
Merged

fix(antigravity): recover step timestamps via exact bot ID join#3403
steipete merged 1 commit into
steipete:mainfrom
WeGoToMars:fix/antigravity-bot-id-timestamps

Conversation

@WeGoToMars

@WeGoToMars WeGoToMars commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix Antigravity local token history being assigned to the wrong timestamp when auxiliary or reordered step rows share a generation's step UUID. The previous reader accepts an ordered step prefix; a count mismatch alone does not necessarily make it withhold history.

Use the generation usage bot_id and the matching step metadata bot_id to recover the standard seconds/nanos timestamp within the same UUID. This does not interpret opaque context-meter fields, use session creation time, or change token counts, pricing, credentials, discovery roots, or stored data.

The maintainer revision retains the contributor's exact-ID approach and strengthens its safety boundaries:

  • Count identities across every parsed generation, including embedded timestamps and rows without UUIDs. Repeated generation IDs retain the guarded legacy fallback.
  • Withhold contradictory, cross-UUID, or timestamp-less duplicate step evidence. Keep ambiguous positional slots in place instead of shifting later rows forward.
  • Check generation-unique exact matches against embedded timestamps in UUIDs needing recovery, without invalidating unrelated embedded-only UUIDs or requiring positional alignment for a clean exact join.
  • Treat malformed auxiliary IDs as unavailable, persist that invalidity across repeated envelopes, and preserve otherwise valid usage. Keep counter/framing validation strict and parser-state validity out of copied-row equality.
  • Update the local-history documentation and Unreleased changelog. Thanks @WeGoToMars!

Proof

Ran the shipped 0.56.4 CLI and the rebuilt CLI against three synthetic SQLite histories, with a temporary home, account-file/Keychain test isolation, network denied, and real home-directory reads denied. No real accounts or history were used.

Synthetic history 0.56.4 Repaired CLI
Auxiliary step before the exact turn 198 tokens assigned to August 26 Same 198 tokens correctly assigned to August 28
Duplicate ID with conflicting timestamps Incorrectly establishes complete history Withholds rows; coverage unavailable, not confirmed zero
Legacy history without per-turn IDs 198 tokens on August 28 Unchanged

The final CLI run left all three input database hashes unchanged. Assertions cover input, cache-read, output, and reasoning buckets as well as dates and coverage.

Focused regression tests first failed on the contributor proposal, including embedded-ID uniqueness, malformed repeated IDs, positional compression, cross-UUID fallback, and missing-time duplicates. Additional tests caught and repaired over-withholding of repeated generation IDs and false copied-row conflicts.

  • swift test --filter Antigravity: 401 tests across 34 suites passed (383 macOS tests and 18 portable tests).
  • make check: passed, zero violations in 2,098 files. A local Homebrew Bash here-document stall was isolated to a temporary system-Bash command path; no repository toolchain change.
  • Required Codex autoreview: no accepted/actionable findings at the configured priority.
  • Full make test: all 1,002 selections across 84 groups passed first try in 861.9 seconds, with zero failures, timeouts, or retries.
  • Exact-head CI 33790377020: all checks passed, including both macOS shards, Linux x64/ARM64/musl, lint, the aggregate check, and GitGuardian.

The original author's live-data observations are useful schema evidence but were not independently replayed against private history. This revision's executable proof is synthetic and uses the actual CLI entry point.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f114a9171

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift Outdated
Comment thread Sources/CodexBarCore/Providers/Antigravity/AntigravityProtoReader.swift Outdated
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex review: blocked before merge. Reviewed September 3, 2026, 2:43 PM ET / 18:43 UTC.

ClawSweeper review

What this changes

The PR uses validated Antigravity per-turn bot IDs to recover missing local-history timestamps without misdating reordered or conflicting step records.

Merge readiness

Blocked before merge - 1 item remains

Keep open: the rebased PR has a focused, fail-closed implementation with extensive regression coverage and credible production-CLI proof; no introduced correctness defect was found.

Priority: P2
Reviewed head: bda9352066562266c20ed883cdbf8a3d672ebc8e

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong production-entrypoint proof, focused safety checks, and regression coverage support a high-confidence merge review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied PR body and owner comment describe an actual rebuilt CLI run through the local-history reader against synthetic SQLite fixtures: the same 198 tokens move to the correct day, conflicting IDs withhold coverage, and legacy no-ID history remains unchanged. The evidence is terminal-based and was not independently rerun in this read-only review.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied PR body and owner comment describe an actual rebuilt CLI run through the local-history reader against synthetic SQLite fixtures: the same 198 tokens move to the correct day, conflicting IDs withhold coverage, and legacy no-ID history remains unchanged. The evidence is terminal-based and was not independently rerun in this read-only review.
Evidence reviewed 5 items Validated recovery path: The introduced reader scans step metadata, verifies embedded timestamp agreement, and only then recovers pending rows; conflicting or incomplete evidence returns partial coverage.
Focused regression coverage: The added tests cover reordered steps, duplicate and cross-UUID IDs, malformed optional IDs, positional-slot preservation, and legacy fallback behavior.
Documented fail-closed contract: The updated documentation specifies exact-ID matching, guarded positional fallback, and partial coverage for conflicting, cross-UUID, malformed, or ambiguous evidence.
Findings None None.
Security None None.

How this fits together

CodexBar reads Antigravity’s local SQLite history, decodes generation and step metadata, and aggregates valid events into daily token-usage reports. Those reports feed the CLI, dashboard, and cost displays.

flowchart LR
A[Local SQLite history] --> B[Generation rows]
B --> C{Timestamp present?}
C -->|No| D[Step metadata scan]
D --> E[Validated turn ID join]
C -->|Yes| F[Daily usage report]
E --> F
F --> G[CLI and dashboard]
Loading

Before merge

  • Resolve merge risk (P1) - Antigravity’s local protobuf layout is externally produced; unrepresented variants must continue to yield partial coverage rather than a guessed usage date.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and regression coverage runtime +185/-27, tests +560/-9, docs/changelog +12/-2 The focused test growth exercises the new identity-join safety boundaries more heavily than the production-path expansion.

Merge-risk options

Maintainer options:

  1. Accept fail-closed partial coverage (recommended)
    Retain the documented behavior that unknown or contradictory producer metadata withholds affected history instead of publishing a potentially wrong day.

Technical review

Best possible solution:

Merge the validated fail-closed recovery once the exact-head macOS checks complete, retaining partial coverage for ambiguous producer data.

Do we have a high-confidence way to reproduce the issue?

Yes. The PR supplies a concrete actual-CLI synthetic SQLite before/after scenario, and focused tests encode reordered, duplicate, malformed, and fallback cases; this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes. Validating a unique same-UUID bot-ID join while preserving the existing positional fallback is narrower and safer than inferring dates from unrelated metadata.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7e9c1e8a54af.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs incorrect local usage-date attribution with a bounded provider-specific blast radius.
  • merge-risk: 🚨 other: The change interprets externally produced local protobuf metadata, so unknown schema variants could affect history completeness or date attribution.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied PR body and owner comment describe an actual rebuilt CLI run through the local-history reader against synthetic SQLite fixtures: the same 198 tokens move to the correct day, conflicting IDs withhold coverage, and legacy no-ID history remains unchanged. The evidence is terminal-based and was not independently rerun in this read-only review.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied PR body and owner comment describe an actual rebuilt CLI run through the local-history reader against synthetic SQLite fixtures: the same 198 tokens move to the correct day, conflicting IDs withhold coverage, and legacy no-ID history remains unchanged. The evidence is terminal-based and was not independently rerun in this read-only review.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Charley Peng: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T17:13:07.266Z sha 9f114a9 :: blocked before merge. :: [P2] Count bot IDs across every generation row | [P2] Invalidate the join key after malformed bot-ID data
  • reviewed 2026-09-03T18:30:01.810Z sha bda9352 :: blocked before merge. :: none

Recover standard step timestamps using validated per-turn identities without shifting auxiliary steps into generation slots. Preserve legacy fallback, embedded timestamps, optional-ID tolerance, and copied-row accounting; withhold contradictory evidence.

Co-authored-by: WeGoToMars <profigor7@gmail.com>
@steipete
steipete force-pushed the fix/antigravity-bot-id-timestamps branch from 9f114a9 to bda9352 Compare September 3, 2026 18:25
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Repaired the existing branch at bda9352 and rebased it onto current main, retaining @WeGoToMars's contribution.

Both outstanding inline findings are now fixed: generation-side identity counts include embedded and UUID-less rows, and malformed auxiliary IDs stay invalid across repeated fields/envelopes. Regression tests reproduced both failures before the fix. The revision also preserves ambiguous positional slots, rejects missing-time and cross-UUID conflicts, checks embedded exact-ID agreement without blocking unrelated UUIDs, and keeps optional parser state out of copied-row equality.

The shipped 0.56.4 CLI reproduced the wrong-day assignment on a synthetic SQLite fixture. The rebuilt CLI assigns the same 198 tokens to the correct day, withholds conflicting evidence, and preserves legacy no-ID history. No private history or accounts were used, and the final CLI run left the fixture databases unchanged. The PR body has the proof matrix and scope limitations.

All 401 Antigravity-focused tests, lint, and the required autoreview have passed. The final full suite is running; the reviewed-head CI run has been approved. I will wait for both before merging.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 3, 2026
@steipete
steipete merged commit 0b181cc into steipete:main Sep 3, 2026
9 checks passed
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Merged as 0b181cc. The clean main checkout has the same file tree as reviewed/tested head bda9352. Thanks @WeGoToMars!

Final verification:

  • swift test --filter Antigravity: 401 tests across 34 suites passed.
  • make check: passed with zero violations in 2,098 files.
  • make test: all 1,002 selections across 84 groups passed first try in 861.9 seconds, with no failures, timeouts, or retries.
  • Required Codex autoreview: no accepted/actionable findings at the configured priority. Both previous inline review findings are resolved.
  • Exact-head CI 33790377020: all checks passed, including both macOS shards, Linux x64/ARM64/musl, lint, aggregate, and GitGuardian.

The actual shipped and rebuilt CLIs were exercised with cost --provider antigravity --format json --refresh against isolated synthetic SQLite histories. The fix moves the same 198 tokens from the incorrect day to the matching turn's day, withholds conflicting IDs, and leaves legacy no-ID recovery unchanged. Input database hashes remained unchanged. No real account, private history, network request, or Keychain probe was used.

Unknown or contradictory metadata intentionally remains partial coverage instead of acquiring a guessed date. This does not validate opaque relative-clock fields or fix unrelated Antigravity quota/auth reports. The docs and Unreleased changelog record that boundary.

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

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants