Skip to content

fix(desktop): order inbox items by microsecond persistence time - #8693

Closed
TheodoreSpeaks wants to merge 2 commits into
stagingfrom
fix/desktop-inbox-order-flake
Closed

TheodoreSpeaks wants to merge 2 commits into
stagingfrom
fix/desktop-inbox-order-flake

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Desktop inbox merged its two row sets (waiting + cancelled) in JS by createdAt.getTime(), which truncates to milliseconds, so calls persisted within the same millisecond tied and fell through to the random toolCallId — inbox order was non-deterministic
  • Select created_at as epoch microseconds and merge on that, matching the SQL ORDER BY within each set
  • Fixes the flaky executor.integration.ts inbox ordering tests ("lists pending calls in persistence order…" and "lists new work however many calls the device is already running")

Type of Change

  • Bug fix

Testing

  • Reproduced deterministically by temporarily stamping pendingCall rows 1µs apart inside one millisecond: pre-fix the persistence-order test failed with calls in UUID order; post-fix 28/28 passed in 5 runs
  • Unmodified lib/desktop/application/executor.integration.ts via bun run test:integration: 28/28 passed in 6 consecutive runs
  • bun run lint, bun run check:audits (58 audits), docs-manifest:check, block-registry check pass; root bun run test green apart from 3 local-env-dependent rate-limit/execution-limit tests unrelated to this diff

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

https://claude.ai/code/session_017p4HBhAXFVJRPhrG9DDZU3

@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 6, 2026 7:58pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai 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 issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes inbox item ordering logic for desktop executor.

The PR appears safe to merge.

What we checked:

  • Same-millisecond ordering is tested: The test gives three calls timestamps within one millisecond and IDs ordered against those timestamps. Sorting by milliseconds would reverse the expected result.

Summary

The PR sorts desktop inbox rows by microsecond persistence time instead of millisecond Date values.

  • Adds a real-database regression test with three timestamps one microsecond apart and IDs ordered against those timestamps.
  • Addresses the previous unnumbered test-coverage finding. TheodoreSpeaks’s reply matches the added test.
  • No new actionable issues found. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "test(desktop): pin inbox order for calls..."

Comment thread apps/sim/lib/desktop/executor/repository.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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 issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

Superseded by #8685, which fixes the same inbox ordering with a persist_seq column and its own same-millisecond regression test.

@waleedlatif1
waleedlatif1 deleted the fix/desktop-inbox-order-flake branch October 6, 2026 22:29

This branch was previously deployed

1 inactive deployment
Preview — af278b79 Deployed Oct 6, 2026 by vercel[bot]
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