Skip to content

Moving updated-at timestamps to unique millisecond times#17489

Merged
ddr-oai merged 6 commits intomainfrom
ddr/millisecond-unique-timestamps
Apr 14, 2026
Merged

Moving updated-at timestamps to unique millisecond times#17489
ddr-oai merged 6 commits intomainfrom
ddr/millisecond-unique-timestamps

Conversation

@ddr-oai
Copy link
Copy Markdown
Contributor

@ddr-oai ddr-oai commented Apr 11, 2026

To allow the ability to have guaranteed-unique cursors, we make two important updates:

  • Add new updated_at_ms and created_at_ms columns that are in millisecond precision
  • Guarantee uniqueness -- if multiple items are inserted at the same millisecond, bump the new one by one millisecond until it becomes unique

This lets us use single-number cursors for forwards and backwards paging through resultsets and guarantee that the cursor is a fixed point to do (timestamp > cursor) and get new items only.

This updated implementation is backwards-compatible since multiple appservers can be running and won't handle the previous method well.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

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

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: 570c19eb46

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/state/src/runtime/threads.rs
@ddr-oai ddr-oai requested a review from jif-oai April 11, 2026 22:48
@ddr-oai ddr-oai added the oai PRs contributed by OpenAI employees label Apr 11, 2026
@ddr-oai
Copy link
Copy Markdown
Contributor Author

ddr-oai commented Apr 12, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 12, 2026
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Going to ms feels a bit like a hack to me (as it's still not a perfect guarantee) but I guess in this case this is more than enough
Also, this won't fix the backward compatibility case

@ddr-oai ddr-oai force-pushed the ddr/millisecond-unique-timestamps branch 5 times, most recently from ca63d3a to b21b0bd Compare April 14, 2026 06:35
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Can you revert all the unrelated changes or move them to a dedicated PR?

Comment thread codex-rs/state/migrations/0025_thread_timestamps_millis.sql
Comment thread codex-rs/app-server/src/codex_message_processor.rs Outdated
Comment thread codex-rs/app-server/BUILD.bazel Outdated
Comment thread codex-rs/core/src/plugins/discoverable_tests.rs Outdated
Comment thread codex-rs/exec-server/tests/common/exec_server.rs Outdated
Comment thread codex-rs/exec-server/tests/exec_process.rs Outdated
ddr-oai added 4 commits April 14, 2026 11:14
To allow the ability to have guaranteed-unique cursors, we make two important updates:
* Move updated-at timestamps from second to millisecond
* Guarantee uniqueness -- if multiple items are inserted at the same millisecond, bump the new one by one millisecond until it becomes unique

This lets us use single-number cursors for forwards and backwards paging through resultsets and guarantee that the cursor is a fixed point to do (timestamp > cursor) and get new items only
@ddr-oai ddr-oai force-pushed the ddr/millisecond-unique-timestamps branch from b21b0bd to 93a1d5f Compare April 14, 2026 15:14
@ddr-oai ddr-oai merged commit 4f2fc3e into main Apr 14, 2026
21 of 22 checks passed
@ddr-oai ddr-oai deleted the ddr/millisecond-unique-timestamps branch April 14, 2026 15:55
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants