fix(pi): keep archived sessions visible - #1297
Merged
tiann merged 1 commit intoAug 2, 2026
Merged
Conversation
KorenKrita
marked this pull request as ready for review
August 2, 2026 01:56
There was a problem hiding this comment.
Findings
- No findings.
Questions
- None.
Summary
- Review mode: initial
- No issues identified in the added or modified lines. Residual risk is limited to runtime integration behavior not exercised by this static pass; the changed paths have targeted Shared, Hub, and Web regression coverage.
Testing
- Not run (automation). GitHub test check passed.
HAPI Bot
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.
Fixes #1296.
Summary
piSessionId;piSessionIdacross sparse archive metadata replacements;User-visible behavior
Before this change, a Pi session could be visible while active and disappear immediately after archival. The Hub row, messages, and
piSessionIdwere still present, but the sidebar no longer exposed the session or its Reopen action.After this change, an archived Pi session with a valid native ID remains in the sidebar with the same inactive presentation and actions used by archived Codex and Claude sessions.
Root cause
The failure required two existing behaviors to interact:
toSessionSummary()flattened agent-specific native IDs intometadata.agentSessionId, but omittedpiSessionId.The resulting chain was:
Codex and Claude did not reproduce the issue because their native IDs were already included in the summary projection.
There was also a second Pi-specific gap in
SIMPLE_RESUME_TOKENS. The store protects native resume identifiers when a stale or null CLI metadata cache produces a sparse archive payload, butpiSessionIdwas absent from that carry-forward list. In that failure mode the token could be erased, turning a visibility bug into an actual Reopen failure.Changes
Flavor-aware summary identity
shared/src/sessionSummary.tsnow uses an exhaustiveAgentFlavor -> Metadata fieldmapping and the same exactisKnownFlavorsemantics used by the resume paths.For known flavors, only the matching native ID is accepted. This avoids representing a Pi or Cursor session with a stale ID left by another agent integration.
The legacy fixed-order fallback remains limited to missing or unknown flavors. It deliberately does not infer Pi identity in that branch because Hub resume routing treats missing/unknown flavor as Claude.
Pi resume-token preservation
piSessionIdis now included inSIMPLE_RESUME_TOKENS, retaining the existing semantics:null: clear the token;Regression coverage
flavor: 'pi'projectspiSessionIdinto summaryagentSessionId;prepareSidebarSessions();piSessionId.Related history
Validation
mise exec -- bun typecheckmise exec -- bun test shared/src/sessionSummary.test.ts hub/src/store/sessions.test.tsmise exec -- bun run --cwd web test src/components/SessionList.test.tsmise exec -- bun run testgit diff --checkFull-suite result before the final rebase:
After rebasing onto the latest
main, all affected tests and the full CLI/Web/Hub typecheck passed again.AI disclosure
Root-cause analysis, implementation, tests, and PR drafting were assisted by OpenAI Codex (GPT-5.6).