fix(pi): harden resume target handling#224
Merged
vakovalskii merged 1 commit intoMay 26, 2026
Merged
Conversation
10 tasks
4e2f3e7 to
a4c435b
Compare
vakovalskii
approved these changes
May 26, 2026
Owner
vakovalskii
left a comment
There was a problem hiding this comment.
LGTM ✅ Right cleanup — these fall out cleanly because Pi was the only resumeTarget consumer at the time of #221.
Verified locally:
- Full suite 148/0/2 pass (3 new tests in
pi-session.test.js, 2 infrontend-escaping, 1 inagents-detect) - CI 5/6 green + 1 cancelled (re-running)
Squash-merging — will ride in 7.5.1.
vakovalskii
added a commit
that referenced
this pull request
May 26, 2026
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.
Summary
Follow-up to #221. The Pi / Oh My Pi support PR was merged while a later independent review comment was still being handled, so this PR carries the review hardening fixes as a focused patch instead of rewriting the merged history.
Why
The merged feature works, but the review found several places where the new Pi resume-target flow was broader than necessary or could be made safer:
/api/launchaccepted a client-providedresumeTargetand then forwarded it to terminal launch more broadly than neededheader.idwas trusted before validating it as a safe session idWhat changed
launchPiSessiontotool === 'pi'; all other agents use the regularlaunchSessionpath again.getValidatedPiResumeTarget(...), which returns only the server-discovered, resolved JSONL path after validation.projectintofindSessionFile(sessionId, project)during Pi resume-target validation to avoid cold-cache misses.openInTerminalonly when it is the validated Pi target; non-Pi tools get an empty target.~/.omp/agent -> ...still work because only entries insidesessions/are skipped.header.idwith the safe session id regex before indexing.Pi/OhMyPi.omp --resumevspi --sessionfromsession.agent_variantinstead of installed-binary detection.agent not installedlaunch error message.Test plan
node --check src/server.js && node --check src/frontend/detail.js && node --check src/data.js && node --check src/frontend/app.jsnode --test test/pi-session.test.js test/frontend-escaping.test.js test/agents-detect.test.js test/terminals-windows-launch.test.js→ 31 pass, 0 failnode --test→ 146 pass, 0 fail, 2 skipped