GeezerVison is showing github.com — refactor(pi): flatten the retained-branch timestamp check · pingdotgg/t3code@56c01cc
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/provider-pi/src/server
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/provider-pi/src/server/adapter.ts +4-7Lines changed: 4 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4489,13 +4489,10 @@ function piLegacyRetainedBranch(listing: PiSessionListing, targetId: string, com |
4489 | 4489 | const entry = listing.entries.get(id); |
4490 | 4490 | if (entry?.timestamp == null) return undefined; |
4491 | 4491 | if (entry.isUserMessage && entry.timestamp >= completedAt) return { history, entryId: id }; |
4492 | | - if (entry.timestamp > completedAt) { |
4493 | | - // Pi only forks before user messages. Later settings can stay in the file, |
4494 | | - // but later conversation entries make this branch unsafe to recover. |
4495 | | - if (!entry.isSessionMetadata) return undefined; |
4496 | | - } else { |
4497 | | - history.push(id); |
4498 | | - } |
| 4492 | + if (entry.timestamp <= completedAt) history.push(id); |
| 4493 | + // Pi only forks before user messages. Later settings can stay in the file, |
| 4494 | + // but later conversation entries make this branch unsafe to recover. |
| 4495 | + else if (!entry.isSessionMetadata) return undefined; |
4499 | 4496 | } |
4500 | 4497 | return { history, entryId: undefined }; |
4501 | 4498 | } |
|