Skip to content

fix(desktop): queue live-tail ratings until the journal remote id lands - #11529

Merged
Git-on-my-level merged 4 commits into
mainfrom
fix/chat-rating-until-sync
Aug 14, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
fix/chat-rating-until-sync

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Follow-up to fix(desktop): align chat tool calls and keep HTTP 402 honest through worker recycle #11522: thumbs stay visible on a just-finished reply, but the rating PATCH waits until journal sync so a 404 cannot wipe the optimistic rating.
  • Failed journal turns keep a local-only rating and never PATCH a missing backend row. Clearing thumbs before sync now still PATCHes after the remote id lands (a queued nil is not treated as a missing map entry).
  • Last write wins while sync is in flight; the queue flushes when the journal projection lands a remote id.

The dual-client quota stub repair from #11522 landed separately in #11535, so this PR is desktop-only.

Test plan

  • cd desktop/macos && ./scripts/dev-feedback.py --once swift 'ChatMessageRatingPersistenceTests' — 8 tests passed
  • Named-bundle check: send a chat, tap thumbs on the live tail before the backend id appears, confirm the rating sticks after sync

Product invariants

  • INV-CHAT-1
  • INV-AUTH-1

Failure-Class: none

@cubic-dev-ai cubic-dev-ai 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.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@Git-on-my-level
Git-on-my-level force-pushed the fix/chat-rating-until-sync branch from 04b3acd to 908e262 Compare August 14, 2026 00:49
Git-on-my-level and others added 3 commits August 14, 2026 10:25
Showing thumbs before sync was correct; PATCHing immediately 404'd and
reverted the optimistic rating. Keep the buttons, persist after isSynced.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
A queued nil was treated as a missing map entry, so clearing thumbs before the remote id landed never PATCHed.

Co-authored-by: Cursor <[email protected]>
Address Cubic review feedback:
- P2: drain() now matches queued ratings by clientTurnId when projection
  replaces a live-tail row (local id) with the kernel turnId (remote id),
  and PATCHes with the projected remote id so the backend row is found.
- P1: flushPendingMessageRatings captures the runtime owner and fences the
  spawned Task so a PATCH in flight during an account/owner transition is
  dropped instead of mutating the new session.
- P3: remove fake e2e covers: entries for rating files the hermetic flow
  never exercises.

Adds regression tests for the id-remap path and the owner fence.
@Git-on-my-level
Git-on-my-level force-pushed the fix/chat-rating-until-sync branch from 908e262 to b228a18 Compare August 14, 2026 04:04
The owner fence lived in a ChatProvider extension, so `runtimeOwnerId`
did not compile. Read `RuntimeOwnerIdentity.currentOwnerId()` instead,
restore hermetic covers, and give the remap test a clientTurnId.

Failure-Class: none
Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 886747b into main Aug 14, 2026
26 of 27 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/chat-rating-until-sync branch August 14, 2026 05:18
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