Repository navigation
Conversation
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughCodex hook normalization now checks the payload’s Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Codex hooks from another workspace are rejected in the inspected cases, while hooks from the stamped worktree continue to work. The change is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change prevents the demonstrated cross-workspace status update without changing the hook format. It is a partial safeguard, not proof that every hook belongs to its claimed workspace. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4d9b40e4-7a2a-4862-909f-491b0acfa67f
📒 Files selected for processing (2)
src/shared/agent-hook-listener-hermes-codex-droid.test.tssrc/shared/agent-hook-listener.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Caution
On a Windows WSL pane this gate rejects the pane's own Codex hooks, so Codex status stops updating for every WSL workspace. The stamped worktree path is a UNC path (repo::\\wsl.localhost\Ubuntu\..., forwarded untranslated through WSLENV as /u), while Codex runs inside the distro and reports a Linux cwd; isPathInsideOrEqual folds the UNC root to //wsl/<distro>/... and never bridges it to the Linux spelling, so the containment test is always false.
Reviewed changes
- Codex cwd/worktree containment gate —
normalizeHookPayloadnow reads the Codex hook payload'scwd, derives the stamped worktree path withsplitWorktreeIdForFilesystem, and returnsnullwhencwdis not inside it; hooks lacking either value keep prior behavior. - Regression test — rejects a
FusionRF-stamped hook carrying anAlbedocwdand accepts a same-worktree hook from a nested directory.
ℹ️ This mitigates attribution, not the daemon-lifecycle half of #22873
The linked issue reports two symptoms: hooks misattributed to the wrong pane, and releasing the first worker killing the sibling because the shared daemon is its child. This change only addresses the first. The PR body already notes hooks cannot distinguish panes within one worktree, but the sibling-death symptom is also untouched; worth confirming it is tracked separately (upstream openai/codex#37537) so the issue is not closed as fully resolved.
Technical details
# Scope of the fix
## Affected sites
- `src/shared/agent-hook-listener.ts:48-55` — rejects on a `cwd` outside the stamped worktree path.
## Open questions for the human
- Is the daemon-lifecycle symptom (releasing worker A terminates worker B) intended to be fixed here, or tracked upstream only?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const stampedWorktreePath = stampedWorktreeId | ||
| ? splitWorktreeIdForFilesystem(stampedWorktreeId)?.worktreePath | ||
| : undefined | ||
| // Codex's shared app-server can inherit another pane's Orca env; reject a mismatched session. | ||
| if (codexCwd && stampedWorktreePath && !isPathInsideOrEqual(stampedWorktreePath, codexCwd)) { | ||
| return null |
There was a problem hiding this comment.
This rejects valid Codex hooks on Windows WSL workspaces. For a WSL pane, ORCA_WORKTREE_ID is repo::\\wsl.localhost\Ubuntu\... (crossed via WSLENV as /u, so the UNC string is imported verbatim), while the Codex process runs inside the distro and reports cwd as /home/...; isPathInsideOrEqual maps the UNC root to //wsl/<distro>/... and never bridges it to the Linux spelling, so the test is always false and every Codex hook is dropped.
Technical details
# WSL UNC worktree path vs Linux Codex cwd
## Affected sites
- `src/shared/agent-hook-listener.ts:49-54` — compares the stamped UNC worktree path against a Linux cwd.
- `src/shared/cross-platform-path.ts:190-194` — `isPathInsideOrEqual` normalizes the UNC root to `//wsl/<distro>/...` but leaves `/home/...` unchanged; the alias helpers (`isWslUncPathForCallerLinuxPath`, `toWindowsWslPath`) are not applied here.
- `src/main/pty/wsl-orca-env.ts:87` — `ORCA_WORKTREE_ID/u` imports the UNC string untranslated into the distro.
## Required outcome
- A WSL Codex hook whose `cwd` is the distro-side spelling of the stamped worktree must still be accepted.
- Add coverage for the UNC-root + Linux-cwd case; the added test only exercises Linux-vs-Linux paths.
## Suggested approach
- When the stamped path parses as a WSL UNC path (`parseWslUncPath`), compare `cwd` against the parsed `linuxPath`, or fold both sides through the WSL alias handling already used elsewhere.
## Open questions for the human
- Should a canonicalized/symlinked workspace root also be tolerated? Codex `getcwd` resolves symlinks while Orca stores the chosen spelling, so the same pure-string containment can reject a local workspace.There was a problem hiding this comment.
Important
The new WSL handling closes the UNC-root case but not a Windows-drive repo opened in a WSL terminal: the stamped path is C:\repo while Codex reports a /mnt/c/repo cwd, and the containment test rejects it, dropping the pane's own hooks.
Reviewed changes (incremental since d382710)
- WSL UNC root vs Linux cwd — when the Codex
cwdis a Linux path and the stamped worktree parses as a WSL UNC path,comparisonRootnow usesparseWslUncPath(...).linuxPath; both sides pass throughresolveRuntimePath(..., '.')soa/../btraversal is resolved before the containment test. - Tests — added a WSL case (Linux cwd against a UNC root, a UNC-form cwd, and a
..escape that must be rejected) plus a..-traversal rejection in the original test.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const wslRoot = parseWslUncPath(stampedWorktreePath) | ||
| const comparisonRoot = | ||
| wslRoot && codexCwd.startsWith('/') && !codexCwd.startsWith('//') | ||
| ? wslRoot.linuxPath | ||
| : stampedWorktreePath |
There was a problem hiding this comment.
This covers a distro-internal workspace but not a Windows-drive repo opened in a WSL terminal. There the stamped path is C:\repo (ORCA_WORKTREE_ID/u imports it verbatim) while Codex runs in the distro with cwd /mnt/c/repo; parseWslUncPath returns null for a drive path, so comparisonRoot stays C:\repo and isPathInsideOrEqual('C:\repo', '/mnt/c/repo') is false — every hook from that pane is dropped.
Technical details
# Windows drive-rooted worktree in a WSL terminal
## Affected sites
- `src/shared/agent-hook-listener.ts:54-58` — a drive-rooted stamped path falls through to the raw string, so it is never translated to the drvfs spelling Codex reports.
- `src/shared/wsl-paths.ts:47-63` — `toLinuxPath` maps `C:\...` to `/mnt/c/...` (platform-independent drive branch); its UNC branch is `win32`-guarded, which is why `parseWslUncPath` is needed for the distro-internal case.
- `src/main/providers/windows-shell-args.ts:241-244` — a drive-rooted repo's WSL shell starts at the `/mnt/<drive>` spelling, and `src/main/pty/wsl-orca-env.ts:87` forwards `ORCA_WORKTREE_ID/u` untranslated.
## Required outcome
- A Codex hook whose stamped worktree is a Windows drive path and whose Linux `cwd` is that path's `/mnt/<drive>` spelling must still be accepted.
## Suggested approach
- When `codexCwd` is a Linux path, normalize a drive-rooted `stampedWorktreePath` through `toLinuxPath` before comparing; keep the `parseWslUncPath().linuxPath` branch for UNC roots. Add a regression case mirroring the UNC one.
## Open questions for the human
- Is a Windows-path repo launched in a WSL terminal in scope for Codex status? The docs describe that configuration as supported.
ELI5
When Codex reuses a background process started from workspace A, a prompt typed in workspace B can appear in workspace A's status card. A hook that says it ran in B will no longer update A's status.
What Changed
The Codex hook listener checks the hook's working directory against the worktree path stamped on the hook. It resolves path traversal and WSL UNC/Linux path spellings before checking containment, and discards a cross-workspace mismatch before changing status state. Hooks from that worktree and its nested directories still work. Focused regression tests cover these cases.
Why
The shared Codex app-server can inherit the Orca pane environment of the first terminal that started it. The hook includes a working directory, so Orca can reject a provably wrong worktree attribution at the existing status ingestion point. The hook does not include the originating terminal identity, so this change cannot distinguish multiple panes in one worktree; see openai/codex#37537.
Linked Issue
Related: #22873; openai/codex#37537.
Visual Proof
Automated before/after: the new regression presents a FusionRF-stamped hook with an Albedo working directory. Before this change the listener accepts it; after this change it returns
nulland leaves the pane status untouched. A same-worktree hook in a nested directory still updates the pane. A screenshot from a running build is pending; this is a draft PR.Testing
Linux source checks:
AI Disclosure
GPT-6 Codex assisted with diagnosis, implementation, and the focused regression test. The reporter reviewed the diff and local checks.
Review
Agent skill upstream boundary
Notes
The check uses Orca's existing worktree ID parser and cross-platform path containment helper. It changes neither the hook wire format nor a client/server RPC. Hooks without a usable working directory or worktree path retain their current behavior. No installed Orca service or active session was changed to test this patch.
Checklist