Skip to content

[thread store] separate thread names and repair ownership#29352

Open
anaiskillian wants to merge 11 commits into
mainfrom
anais/thread-storage-metadata-foundation
Open

[thread store] separate thread names and repair ownership#29352
anaiskillian wants to merge 11 commits into
mainfrom
anais/thread-storage-metadata-foundation

Conversation

@anaiskillian

Copy link
Copy Markdown
  • This pr separates explicit thread names from history-derived titles in SQLite and adds a lightweight list projection with canonical parent metadata. It supersedes the storage and indexing portion of [app-server] improve thread list and resume rpc paths #28801 while preserving existing RPC routing.

  • Rollout read-repair now updates only location-owned fields, preventing stale full-row snapshots from overwriting concurrent metadata changes. Existing state, rollout, and thread-store tests pass with the new migration and ownership contract.

@anaiskillian

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 40d5b16ebb

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

@anaiskillian

Copy link
Copy Markdown
Author

@codex review

@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: 6cfeadd4f0

ℹ️ 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 Outdated
@anaiskillian

Copy link
Copy Markdown
Author

@codex review

@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: f02d4d3cb7

ℹ️ 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 Outdated
Comment thread codex-rs/thread-store/src/local/list_threads.rs Outdated
@anaiskillian anaiskillian force-pushed the anais/thread-storage-metadata-foundation branch from 11cf96d to 7ddcf58 Compare June 21, 2026 22:25
@anaiskillian anaiskillian marked this pull request as ready for review June 22, 2026 18:52
@anaiskillian

Copy link
Copy Markdown
Author

@codex review

@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: 7ddcf58cd9

ℹ️ 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 Outdated
Comment thread codex-rs/state/src/runtime/threads.rs Outdated
Comment thread codex-rs/state/src/runtime/threads.rs Outdated
@anaiskillian anaiskillian force-pushed the anais/thread-storage-metadata-foundation branch from 3c3cc4b to 2d7edbc Compare June 22, 2026 22:42

@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: 2d7edbc5b9

ℹ️ 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 Outdated

@jif-oai jif-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The proposed name model still relies on NULL/empty-string sentinels and title-equality heuristics... so it cannot reconcile legacy writers or imported-title provenance reliably. This sounds not very strong to me

Comment thread codex-rs/state/src/runtime/threads.rs Outdated
Comment thread codex-rs/state/src/runtime/threads.rs
@anaiskillian

Copy link
Copy Markdown
Author

@jif-oai I reworked the name model in 639ee6b to address the provenance concern at the storage boundary. SQLite now stores an explicit name state plus a title snapshot: new writers represent unnamed and explicit names without NULL or empty-string sentinels, and title-only writes from older binaries are detected from snapshot drift before reconciliation, including when a prior explicit name exists. External imports now persist only actual source titles as explicit names; first-user fallback text remains preview and derived-title metadata. The affected state, rollout, thread-store, and external-session suites passed 329 tests, and the app-server session-import integration test passed.

@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: 639ee6ba24

ℹ️ 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 Outdated
Comment thread codex-rs/state/src/runtime/threads.rs Outdated
Comment thread codex-rs/thread-store/src/local/helpers.rs Outdated

@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: 463f8fdc23

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

@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: 3445438d98

ℹ️ 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 Outdated
Comment thread codex-rs/thread-store/src/local/helpers.rs
@anaiskillian

Copy link
Copy Markdown
Author

@codex review

@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: 24d662c41f

ℹ️ 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/migrations/0040_threads_name.sql
Comment thread codex-rs/state/src/runtime/threads.rs
@anaiskillian

Copy link
Copy Markdown
Author

@codex review

@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: 2eada6a0f2

ℹ️ 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 on lines +9 to +11
SET name = title,
name_state = 'explicit',
title_snapshot = title

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 Do not keep migrated names as derived titles

For pre-0040 rows whose title was a user-assigned name, this migration copies it into name but leaves the same value in title/title_snapshot. The incremental rollout path starts from existing metadata and only fills title when it is empty, so the next write records that old name as the derived title; if the user later clears the explicit name, exact-title resume/search can still match the old name. In the migration, move the history-derived value into title (for example from first_user_message) or clear title/title_snapshot for rows promoted to explicit names.

AGENTS.md reference: AGENTS.md:L103-L111

Useful? React with 👍 / 👎.

Comment on lines +25 to +27
UPDATE threads
SET title_snapshot = NEW.title
WHERE id = NEW.id;

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 Seed names for older-binary inserts

When an older Codex binary inserts a thread after this migration, it does not know about name, so the new columns take their defaults. This trigger only fills title_snapshot, leaving name_state='legacy_unknown'; the next new-binary upsert sees title == title_snapshot and converts the row to unnamed, dropping any user-assigned legacy title written by that older binary. The recency migration already supports this mixed-version flow, so this trigger should also classify distinct legacy titles into name/name_state.

AGENTS.md reference: AGENTS.md:L103-L111

Useful? React with 👍 / 👎.

match name {
ThreadMetadataName::Explicit(name) => thread.name = Some(name),
ThreadMetadataName::Legacy(name) => set_thread_name_from_title(thread, name),
ThreadMetadataName::Cleared => {}

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 Clear stale legacy names when metadata is cleared

When a thread has an old session_index name and SQLite now records ThreadName::Cleared, read_thread_by_rollout_path first loads the legacy name from the rollout/index and then calls this helper. The Cleared arm is a no-op, so direct reads by rollout path can still return the stale name after it was explicitly cleared; this arm should reset thread.name to None to make cleared state override legacy fallback data.

Useful? React with 👍 / 👎.

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.

2 participants