fix(claude): preserve OCX routing for spawned Claude CLIs - #53
fix(claude): preserve OCX routing for spawned Claude CLIs#53OnlineChef wants to merge 13 commits into
Conversation
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
✅ Target branch corrected This pull request now targets The |
📝 WalkthroughWalkthroughChangesRecursive Claude launch
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant cmdClaude
participant prepareRecursiveClaudeLaunch
participant recursiveClaudeShim
participant nativeClaude
cmdClaude->>prepareRecursiveClaudeLaunch: Prepare command and child environment
prepareRecursiveClaudeLaunch->>nativeClaude: Resolve pinned or PATH-based executable
nativeClaude-->>prepareRecursiveClaudeLaunch: Return native command
prepareRecursiveClaudeLaunch-->>cmdClaude: Return shim command and environment
cmdClaude->>recursiveClaudeShim: Spawn recursive Claude launch
recursiveClaudeShim->>nativeClaude: Invoke native Claude with forwarded arguments
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 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 |
4d8036c to
2f19c7a
Compare
2f19c7a to
1ed26cf
Compare
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 `@tests/claude-recursive-launch.test.ts`:
- Around line 1-111: Add a focused regression test for cmdClaude that stubs
commandInvocation/spawn and verifies recursiveLaunch.command and
recursiveLaunch.env are forwarded to the child-process invocation. Place it
alongside the existing recursive launcher tests, and assert the resolved command
and environment are preserved through the commandInvocation wiring.
🪄 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: 5dd47dbf-581a-4bbf-9cef-30e507156ad5
📒 Files selected for processing (3)
src/claude/recursive-launch.tssrc/cli/claude.tstests/claude-recursive-launch.test.ts
|
P1 fixed in The recursive launcher is now isolated by a stable SHA-256 installation identity derived from platform + native Claude executable + OCX runtime + entrypoint. Concurrent Added a regression test that creates two installations in the same config directory, verifies distinct launcher paths, and proves the first launcher's contents/PATH remain unchanged after the second launch. Current gates: React Doctor green; typecheck green on Linux, macOS and Windows; npm global/package smoke green on Linux, macOS and Windows. Full Bun test/GUI lanes are still executing. |
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
OnlineChef
left a comment
There was a problem hiding this comment.
Reviewed current head against the reported shared-shim race. The launcher directory is now keyed by a stable hash of platform, native Claude command, runtime path, and entry path, so concurrently active installations sharing OPENCODEX_HOME no longer overwrite each other. Secrets remain process-local and shim writes remain atomic. No blocking issue remains in this lane.
|
Expanded the fix for Claude Code Agent View/background sessions. The original PATH shim only covers descendants that execute New head behavior:
Typecheck is already green on macOS and Ubuntu for head |
|
Pickup status (cloud agent): Stale review threads resolved (Greptile P1 installation-hash fix + CodeRabbit Merge readiness: Ready to merge after #51 (CI sharding) or in parallel. Highest user-impact of the open train (Claude nested spawn / Agent View env loss). |
Problem
ocx claudecorrectly wires the top-level Claude Code process to the local OpenCodex gateway. A Claude/plugin/agent workflow that starts a freshclaudeCLI can lose Anthropic provider variables and open asNot logged in · Run /login, even though the parent remains on anclaude-ocx-*model.Fix
PATH.claudeshim under~/.opencodex/claude-launcheron everyocx claudelaunch.claudeinvocations back throughocx claude, rebuilding the current gateway URL, auth mode, model slots and discovery flags.Platforms
.cmdshim with native npm launcher resolution and argument forwarding for Windows.Tests
Added focused regression coverage for:
.CMDresolution and forwarding.Repository CI is the execution gate for typecheck and the Bun test suite.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.Summary by CodeRabbit
New Features
Bug Fixes
Greptile Summary
This change adds recursive Claude launcher shims so descendant Claude processes re-enter OpenCodex with gateway routing restored. A shared launcher file under
OPENCODEX_HOMEis overwritten when another session starts with a different OpenCodex or Claude installation. Execution confirmed that descendants from the first active session then run through the second session’s launcher paths. This change is not safe to merge until the generated shim is isolated per session or no longer embeds mutable installation-specific paths.Confidence Score: 4/5
What T-Rex did
Comments Outside Diff (1)
General comment
ocx claudesessions using the same OPENCODEX_HOME/config directory install to the sameclaude-launcher/claudefile. After the second installation, a descendant launched using the first session's PATH executes the second session's runtime and entry launcher, with the second session's pinned native Claude command.prepareRecursiveClaudeLaunchcreates a constant shim directory and filename from onlydeps.configDirat lines 146-147, then overwrites that file at lines 149-152 with content containing session-specificrealCommand,runtimePath, andentryPath. The first session retains that shared directory at the front of its PATH.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: 4d8036c | Re-trigger Greptile