Skip to content

[codex] Restore thread recency with compatible migration history#28671

Merged
nornagon-openai merged 5 commits into
mainfrom
nornagon/codex/fix-duplicate-recency-migration
Jun 17, 2026
Merged

[codex] Restore thread recency with compatible migration history#28671
nornagon-openai merged 5 commits into
mainfrom
nornagon/codex/fix-duplicate-recency-migration

Conversation

@nornagon-openai

@nornagon-openai nornagon-openai commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Validation

  • just test -p codex-state migrations::tests::repairs_recency_migration_that_was_applied_as_version_38
  • just test -p codex-state -p codex-rollout -p codex-thread-store -p codex-app-server-protocol -p codex-tui: 3,439 passed; six TUI tests could not open the machine's existing read-only incident database at ~/.codex/sqlite/state_5.sqlite.
  • just fix -p codex-state
  • just fmt
  • Verified that state migration versions are unique.

@nornagon-openai nornagon-openai changed the title [codex] Fix duplicate state migration version [codex] Restore thread recency with compatible migration history Jun 17, 2026
@nornagon-openai
nornagon-openai marked this pull request as ready for review June 17, 2026 14:15
@nornagon-openai
nornagon-openai requested a review from a team as a code owner June 17, 2026 14:15

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ba569b4de

ℹ️ 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".

let timestamp = match sort_key {
StoreThreadSortKey::CreatedAt => thread.created_at,
StoreThreadSortKey::UpdatedAt => thread.updated_at,
StoreThreadSortKey::RecencyAt => thread.recency_at,

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.

P2 Badge Preserve recency tie-breakers in backwards cursors

When clients request sortKey: recency_at and use backwardsCursor for forward delta sync, this path collapses the cursor to a timestamp-only offset. Recency pagination now depends on the (recency_at, thread_id) tie-breaker; if two rows share a recency millisecond (for example rows inserted by an older binary), the subsequent ASC query seeded from this cursor includes same-timestamp threads that sort behind the watermark, so clients can see already-old threads as new. Build the recency backwards cursor with the thread id tie-breaker instead of using the timestamp-only offset.

AGENTS.md reference: AGENTS.md:L103-L107

Useful? React with 👍 / 👎.

@nornagon-openai
nornagon-openai enabled auto-merge (squash) June 17, 2026 18:31
@nornagon-openai
nornagon-openai merged commit 7dc7096 into main Jun 17, 2026
31 checks passed
@nornagon-openai
nornagon-openai deleted the nornagon/codex/fix-duplicate-recency-migration branch June 17, 2026 18:52
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants