Preserve Pi resume identity across repeated restores - #9399
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe change adds canonical agent-session identity matching for raw UUIDs and ChangesAgent session identity
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (3 errors, 1 warning)
✅ Passed checks (21 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/RestorableAgentSession.swift`:
- Around line 928-933: Normalize agent kinds using their canonical raw value
throughout SessionKey, PanelKindKey, PanelIDKindKey, and matchingHookEntry so
.pi and .custom("pi") compare identically; remove the pre-check in the matching
path that rejects equivalent kinds before sessionIDsMatch. Add a regression
covering a .pi hook entry matching a .custom("pi") detected snapshot for the
same UUID/path session.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 00a1a8bc-ab56-417c-81ea-26f1a2131144
📒 Files selected for processing (7)
Sources/AgentResumeLiveness.swiftSources/DockSplitStore+SessionSnapshot.swiftSources/RestorableAgentSession.swiftSources/SurfaceResumeBindingSnapshot+ManagedSessionIdentity.swiftSources/Workspace+AgentLifecycle.swiftSources/Workspace.swiftcmuxTests/WorkspaceIsStaleAgentHookBindingTests.swift
3818ea3 to
fb08b7c
Compare
Summary
.piand.custom("pi").Confirmed cause
This is a third cause, not the fresh-discovery race or stale
CMUX_SURFACE_ID.After a Pi restore, the Pi hook publishes a UUID while
PiSessionLocatorresolves that same running session as its timestamp-prefixed JSONL path. Hook parsing also represents the kind as.pi, while registry scanning produces.custom("pi"). Exact ID and enum comparisons caused reconciliation to treat the live restored Pi process as a different session and discard its binding.Tagged polling observed the binding disappear after about 7 seconds while Pi remained alive, matching the reconciliation cadence. Claude, Codex, and Grok retain stable native session IDs and did not show this conversion.
Regression coverage
Validation
cmux-unitsuite passed 5 tests with 0 failures on the final PR HEAD.Closes #9380
Summary by CodeRabbit