Repository navigation
Conversation
…lute env values A PI_CODING_AGENT_DIR / OMP_CODING_AGENT_DIR value that is not an absolute path escaped normalizeAgentSessionsDir unchanged: a filesystem root strips to '', a Windows drive value strips to the drive-relative 'C:' (and 'C:foo' already is one), and bare relative paths pass through — all of which then resolve against the main-process cwd at scan time. The OMP roots module guards only its own downstream allowlist (session-scanner-roots.ts), so the Pi discovery path and remote-segment derivation kept the leak. Return the default <home>/<dir>/agent/sessions root for every non-absolute value instead, and pin the degenerate shapes for both agent homes in the unit test. Flagged during review of stablyai#12935 as out of scope there.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
|
Thanks for carrying this over from #12935 — the relative-path case is real and worth fixing. Reviewed against latest The description's headline example isn't the bug
So the genuine fix is the non-empty, non-absolute values ( It's also a bigger win than "an information-surface quirk"
The guard is syntactic, so
|
…ts in tests
Review follow-ups: isAbsolute('') is false on both platforms, so the
empty-string checks were implied — the guard is now the single head. The
comment no longer claims the guard covers absolute-but-root values
('/..'), which pass through as they do on main. Tests gain positive
controls: an absolute custom root survives, and untrimmed whitespace
around an absolute root must not demote it to the fallback.
|
Thanks for the thorough pass — reproductions confirmed on this end, and the actionable items are applied in 946647b. Point by point:
Validation on the new head: |
|
thanks for reporting. looking into it |
|
thanks for reporting. looking into it |
|
Cross-referencing for whoever picks this up: #13118 landed in the meantime, implementing the #13082 sweep (Codex, Copilot, OpenClaw, Devin, Kimi, Grok) with a shared I checked how the two interact so it doesn't have to be re-derived at review time:
Pre-empting the obvious follow-up — should Pi/OMP just use the shared helper too? Not as a drop-in, because the order of operations differs and the difference is load-bearing. |
Prime Agent (stablyai#12935) landed in main and added its own cases to session-scanner-values.test.ts at the same insertion point; both suites are kept side by side. The pi/OMP normalizer guard this PR adds is untouched by the merge.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Gentle status ping — no urgency intended, and no action needed if this is simply queued. This PR was split out of the #12935 review at the reviewer's request (the pi/OMP normalizer fix: non-absolute env values should fall back to the default root rather than being treated as a path). It has been green since 9 Aug — Two things have changed since it was opened that may be worth weighing:
If it is waiting on reviewer assignment rather than on the change itself, the cause looks structural: Happy to rebase or re-run verification if anything has gone stale in the meantime. |
|
@nwparker — a process question rather than a nudge on this PR specifically, since the pattern now spans five PRs and two different causes. This PR has no reviewer at all. Opened 7 Aug (34 days), green since 9 Aug, one substantive review from @Jinwoo-H on 7 Aug whose points were applied in 946647b, and no review decision since. The other four have a reviewer and are still waiting:
None of the five has a human review decision. All five are I am not asking anyone to prioritise these over their own work, and I realise a reviewer being busy is not a defect. Two concrete things would unblock the queue from my side:
Happy to split, rebase, or close any of them if they are not wanted; a "no" is a perfectly good answer and costs me nothing to act on. |
Summary
normalizeAgentSessionsDirreturned non-empty, non-absolute values unchanged, so a degeneratePI_CODING_AGENT_DIR/OMP_CODING_AGENT_DIR—rel/path,.,.., or the drive-relativeC:/C:fooa Windows drive value strips to — became a scan root that resolves against the main-process cwd.walkSessionFileshas no depth, entry, or time caps, so that walk recursively scans whatever the cwd happens to be, on every scan cycle (measured in review: ~5.8s on a repo checkout, >20s without finishing at/, where Finder/Dock-launched apps start).Filesystem-root values were already handled before this PR:
/strips to'', which the OMP allowlist filter insession-scanner-roots.tsdrops, and fs calls on''fail withENOENT— an empty scan, not a cwd walk. The genuine fix here is the non-empty, non-absolute forms; the empty-string forms now land on the same default root instead of relying on per-call-site filtering.This was flagged during review of #12935 as pre-existing and out of scope there ("One thing for a separate PR"); this is that PR.
/agents/.pi/agents/.pi/agent/sessionsrel/path,.,..~/.pi/agent/sessionsC:\,C:fooC:→ cwd-on-drive scan root/''— already dropped by the OMP allowlist filter; empty scan elsewhere/..,/a/../main, out of scope hereWhat changed
One syntactic guard after trim + trailing-separator strip: any non-absolute result returns the default
<home>/<agentHomeDirName>/agent/sessionsroot.isAbsolute('')is false on both posix and win32, so the guard is the single head of the function — the previous empty-string early returns were implied by it and are collapsed. Absolute prefix forms (…/.pi,…/agent,…/sessions) behave exactly as before, including absolute values that resolve to a filesystem root (/..) — rejecting those would be a behavior change beyond the flagged leak, and the code comment now says so explicitly.Screenshots
No visual change.
Testing
pnpm lintpnpm typecheck— the sole failure is the known pre-existingpslTS2307 module-resolution issue, reproducible on upstream/main; no errors in the changed files.pnpm buildstops at that same typecheck step on this machine (it passed on the original head before that environment issue).npx vitest runonsession-scanner-values.test.ts+session-scanner-roots.test.ts: 10/10 greenThe degenerate-shape test pins every non-absolute form (
/,//, whitespace,.,..,rel/path,C:\,C:/,C:foo) to the default fallback for both.piand.omp, and now carries positive controls: an absolute custom root survives the guard unchanged, and untrimmed whitespace around an absolute root must not demote it to the fallback (kills the drop-.trim()mutation, which previously passed the suite). The existing prefix-expansion cases pin the unchanged branches.AI Review Report
Reviewed the change against both
path.posixandpath.win32semantics: every listed degenerate value is non-absolute under both, so the guard behaves identically on macOS, Linux, and Windows; genuine absolute roots (POSIX, drive-qualifiedC:\Users\…, UNC\\server\share\…) passisAbsoluteand keep their previous behavior. The guard checks the normalized string and returns the original — it neverresolve()s the return value, sincepath.win32.resolvewould introduce backslashes andremotePiSessionsSegments()splits on/. The one intentional divergence: a pathological env value now lands on the default root instead of the cwd — same trade the #12935 review accepted for Prime Agent.Security Audit
/..) still passes the syntactic guard and reaches the renderer-path allowlist — identical onmain, surfaced in review, deliberately not addressed here (see Notes).Notes
isFilesystemRoot(resolve(normalized))) and emitting a scan notice when an override is rejected were both suggested in review; they are behavior additions beyond this PR's scope and overlap with the systemic sweep proposed in AI Vault: six env-derived scan roots accept relative values and walk the process cwd unbounded #13082, so they're left as separate decisions.