Repository navigation
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Pi forks can recover selected turns from a uniquely matching previous session, with lineage and history-boundary checks. Recovery remains limited to explicit forks and requires a separate destination session, preserving source history. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Find and recover prior-session targets packages/provider-pi/src/server/adapter.ts |
The adapter reads sibling session files when an uncaptured strong target is absent from the current session. It selects a source only when one matching root remains and recovers a boundary from the session tree. |
Fork from the recovered source packages/provider-pi/src/server/adapter.ts |
The fork process receives the selected source file. The adapter uses the recovered boundary when needed and rejects a missing result or one that matches either source file. |
Validate prior-session fork cases packages/provider-pi/src/server/adapter.test.ts |
Parameterized tests cover exact targets, later wakes, copied histories, duplicate matching sessions, and unrelated timestamps. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant PiAdapter
participant SessionFiles
participant PiForkProcess
PiAdapter->>SessionFiles: Search sibling files for the target
SessionFiles-->>PiAdapter: Return unique matching source and entries
PiAdapter->>PiAdapter: Recover fork boundary
PiAdapter->>PiForkProcess: Start fork with source and boundary
PiForkProcess-->>PiAdapter: Return fork session file
PiAdapter->>PiAdapter: Validate returned session file
Suggested reviewers: henrychu04, juliusmarminge
Merge Risk: 
Minimal · up to 99e07
-
The prior-session fork change is mergeable after normal checks; no concrete unresolved issue was established.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "fix(pi): recover fork targets from previous sessions" states the main change: the Pi adapter now recovers fork targets that live in earlier sessions. It follows the conventional commit format and matches the raw summary and PR objectives. It does not cover every detail, such as the lineage matching or the protocol-error fallback, which is acceptable.
Full details: Description check
-
Explanation
The description follows the template. It states the problem and the change, and it links issue
#28377. The Scope and approval section explains that the issue has no maintainer triage yet and that the PR does not claim the small-fix exception. The Verification section lists the checks run and their observed results, including before and after output. The template's trailing agent-attribution line is present, as the author wrote it. The description does not clearly establish maintainer approval of direction and scope, which the template requires, but the author states this openly. Because the rest of the template is substantially complete, the check passes.
Full details: Linked Issues check
-
Explanation
Issue [
#28377] requires a fork from a strong native turn in a previous Pi session and exclusion of later adopted wake turns.findForkSourcescans sibling V3.jsonlfiles when the current session lacks the target. It selects one root throughparentSessionlineage. The fork uses that source file, thenpiPreviousSessionForkBoundaryrecovers the target boundary and preserves only prior history. The added tests cover a previous session with and without later wakes, native fork copies, ambiguous matches, and timestamp mismatches. The rejection cases fail closed.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within the adapter-boundary fix for [
#28377]. ThePath.Pathdependency supports sibling session discovery.custom_messagerecognition supports correct history trimming. The distinct-session-file check protects native fork creation. The added tests validate the new recovery and safe-failure paths. No unrelated UI, provider, rollback, or broad history changes appear in the reviewed diff.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
|
Note Written by Verified in a real dev environmentpartial verification only. the original previous-session recovery is not proved. ran
read-only inspection confirmed the strong target still exists in the current native session. this is a neighboring custom-message-wake limitation, not the previous-session case or a demonstrated regression from this pr. no source changes made.
Not verifiedthe changed previous-session discovery and lineage selection. the original session-rotating memory/background extension is unavailable here; the installed file-trigger extension leaves the target in the same session. manufacturing session files or editing projections would not establish the requested real user path. the original bug was therefore not reproduced, and this run cannot establish that the pr fixes it. native desktop/mobile clients, macOS/Windows, and remote/relay modes were not exercised on this Linux web run. |



Pi forks fail when the selected turn's native entry lives in an earlier session and later background wakes carry uncaptured turn references. The adapter searches only the current session tree and reports that no captured entry was found.
Recover a unique previous native session containing the selected turn, using Pi's parent-session lineage to distinguish fork copies. Fork that session through Pi's native path and trim later wakes while preserving the selected turn's history. Missing or ambiguous matches retain the existing safe failure.
Fixes #28377.
Scope and approval
This is one adapter-boundary bug fix. The issue has not yet received maintainer triage, and this PR does not claim upstream approval or the small-fix exception. The author requested submission of the completed candidate for maintainer consideration despite that outstanding contribution-policy requirement.
Verification
vp run check:changedpassed formatting, lint, both knip passes, 9 affected-package typechecks, and 99 tests in 2 files.Limits: recovery covers completed, strongly referenced targets in V3 native session files beside the current session, with a unique matching lineage. Older native formats and ambiguous histories fail closed. Session discovery reads sibling files sequentially on this exceptional path. No UI, other-provider, rollback, or broad history-reconstruction changes.
Reviewed with review-loop: 2 rounds with Claude Opus 5.5 on xhigh. Reviewer verdict: approved. The lineage-selection blocker and an unnecessary-parse nit were fixed; optional performance, older-format compatibility, and rare safe-failure lineage improvements were deferred.
Created with GPT-6.1 Sol on xhigh in the Codex harness through T3 Code.