Stop a Codex card binding to a rollout that predates it - #66
Merged
Merged
Conversation
When a Codex entry has no cached live id, both the resume path and the board refresh resolved one with `launchedAt: 0`, which disables the age bound in discoverCodexLiveId and matches on cwd alone. The newest rollout the directory has ever hosted wins, of any age, and the result is persisted — so a card could be bound permanently to a months-old conversation in a since-reused directory, and every later resume faithfully reopened it. Bound those two lookups by when the card was created. mtime can't carry that bound: resuming an old conversation rewrites its file, so a superseded rollout can hold a newer mtime than the session that replaced it. Take the minted time from the rollout's own filename instead, and skip anything minted before the card existed. Unparseable names are not excluded, and entries predating createdAt keep the old behaviour rather than becoming unresumable. `launchedAt` semantics are untouched, so the launch-time probe still works off mtime as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Codex card with no cached
liveSessionIdresolved one withlaunchedAt: 0, which disables the age bound indiscoverCodexLiveIdand matches on cwd alone — so the newest rollout a directory has ever hosted won, of any age. The result is persisted, so one bad guess bound the card to that conversation for good. The board-refresh path did it without any resume at all.Bounding by mtime doesn't work: resuming an old conversation rewrites its rollout, so a superseded one can carry a newer mtime than the session that replaced it. This takes the minted time from the rollout's filename instead and skips anything minted before the card existed.
launchedAtsemantics are untouched, so the launch-time probe is unchanged. Unparseable names aren't excluded, and entries predatingcreatedAtkeep the current behaviour rather than becoming unresumable.The regression test fails on
main.The shared-cwd collision noted in the issue is not addressed here — two cards launched from one directory can still resolve to each other's conversation.
Fixes #63.