tui: use thread_id for resume/fork cwd resolution#12727
Conversation
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b012c108e0
ℹ️ 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".
62c68e8 to
a24b8db
Compare
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a24b8dba8c
ℹ️ 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".
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6e478aa51
ℹ️ 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".
| Ok(Some(path)) => match resolve_session_thread_id(path.as_path(), None).await { | ||
| Some(thread_id) => { | ||
| resume_picker::SessionSelection::Resume(resume_picker::SessionTarget { | ||
| path, | ||
| thread_id, | ||
| }) | ||
| } | ||
| None => { | ||
| let rollout_path = path.display(); |
There was a problem hiding this comment.
Keep resume/fork working when SessionMeta is missing
--resume-last now hard-fails when resolve_session_thread_id(...) returns None. That resolver depends on read_session_meta_line, which errors if a rollout does not start with SessionMeta (legacy or malformed files). These sessions can still be resumed/forked by path, and cwd can still be derived from rollout fallback, so this introduces a regression that blocks session recovery.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@jif-oai do we want to support rollout files without a session meta?
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d70f433d32
ℹ️ 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".
| None => read_session_meta_line(path) | ||
| .await | ||
| .ok() | ||
| .map(|meta_line| meta_line.meta.id), |
There was a problem hiding this comment.
Resolve thread id from full rollout scan, not head-only parse
resolve_session_thread_id(..., None) relies on read_session_meta_line, which requires SessionMeta at the very first rollout line. Resume/fork loading accepts the first SessionMeta anywhere in the file, so path-based flows (--resume-last, --fork-last, name-based resume/fork) can now reject sessions that are still resumable when head lines are malformed or reordered.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think this is not worth worrying about
|
@codex review this |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
jif-oai
left a comment
There was a problem hiding this comment.
I'm not sure this is a good idea as it let users resuming sessions outside of ~/.config/sessions
What was the rational behind doing this?
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf6ac10a76
ℹ️ 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".
Summary
SessionTarget { path, thread_id }(non-optionalthread_id)thread_idcentrally viaresolve_session_thread_id(...):--resume <uuid>/--fork <uuid>)thread_idfrom rolloutSessionMetafor path-based selections (picker,--resume-last, name-based resume/fork)thread_idto read cwd from SQLite first during resume/fork cwd resolutionTurnContexttail, thenSessionMeta)Why
This removes ad-hoc rollout filename parsing and makes resume/fork target identity explicit. The resume/fork cwd check can use indexed SQLite lookup by
thread_idin the common path, while preserving rollout-based fallback behavior. It also keeps malformed legacy rows recoverable in the picker instead of letting a selection failure unwind the app.Notes
thread_idis availableCodex author
codex resume 019c9205-7f8b-7173-a2a2-f082d4df3de3