You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(claude): show the conversation on mobile for Claude started with a custom CLAUDE_CONFIG_DIR - #49361
If you start Claude in an Orca terminal with your own settings folder, for example CLAUDE_CONFIG_DIR=~/.claude-work claude for a second account, the phone listed the tab but its chat view stayed on "Can't find this conversation yet". Orca's status hooks were only ever installed in ~/.claude and in the account folders Orca makes itself, so that Claude never told Orca which conversation it was running. Now Orca hands its hooks to that Claude at launch, and the phone shows the conversation.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$38
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$38
Prod
7
$\color{#1a7f37}{\Huge{\mathbf{+}}}$174
$\color{#cf222e}{\Huge{\mathbf{−}}}$32
$\color{#1a7f37}{\Huge{\mathbf{+}}}$142
What Changed
Before: a Claude whose CLAUDE_CONFIG_DIR points at a folder Orca didn't create loaded none of Orca's hooks. The pane never got a session id, so mobile chat waited forever. Desktop status (working/done) was missing for that pane too.
After: that Claude reports to Orca like any other, with no writes to the user's folder.
How it works:
When Orca installs its Claude hooks (ClaudeHookService.install(), default target), it also publishes the same hook entries as a small plugin in its own data folder (<userData>/claude-hook-plugin/orca-status-hooks). The entries are taken from the merged ~/.claude settings, so a user's async choice on an Orca hook carries over. Writes are async, compare-before-write, and coalesced (one running, latest one pending). Turning hooks off deletes the folder.
Every local pane gets ORCA_CLAUDE_HOOK_PLUGIN_DIR when status hooks are on and Claude isn't disabled (not WSL). It is stripped with the other hook coordinates, and an inherited copy from a parent Orca is removed from CLAUDE_CODE_PLUGIN_DIRS, the same way the agent-view plugin already does it.
The claude shell function (POSIX, fish, PowerShell) already detects a CLAUDE_CONFIG_DIR that Orca didn't inject. For those launches only (an alias like the one above, or the user's own login-shell folder on System default), it adds the plugin to CLAUDE_CODE_PLUGIN_DIRS for that one process. It skips the plugin when it is already listed, or when the folder's settings.json already contains an Orca hook in any form (script path, native .exe, encoded PowerShell). That avoids running Orca's hooks twice, which matters because PreToolUse/PermissionRequest hooks hold the prompt.
Plain claude, managed accounts and WSL behave exactly as before.
Why
The running process's CLAUDE_CONFIG_DIR is the only reliable answer to "which folder does this Claude read", and it is only known at launch, in the shell function that already runs before every claude in an Orca pane. #33751 learned folders from hook transcript paths, which can't help a folder that has no hooks.
Alternatives considered:
Write Orca's hooks into the user's folder (from a CLI preflight, like orca agent hooks prepare-codex). This edits a file Orca doesn't own. It would need records to clean up on uninstall, and it adds a ~0.3 s CLI start per launch.
Read the Claude process's environment from main. This needs native changes on macOS and isn't available on Windows.
Always put the plugin in every pane. Default ~/.claude panes would run every hook twice.
Add --settings in the wrapper. It conflicts with a user's own --settings and doubles hooks in folders that already have them.
Claude Code loads hooks from CLAUDE_CODE_PLUGIN_DIRS regardless of its config folder, with nothing to enable in that folder (checked on Claude 2.1.332). Orca already uses that variable for its agent-view plugin.
Same build, same alias (CLAUDE_CONFIG_DIR=<temp folder> claude), the same prompt answered by a local fake API, opened in the iOS app paired to the desktop.
Before (main's path)
After (this PR)
Testing
Live, hidden worktree build (orca serve) + local fake Anthropic API, no real ~/.claude folder used for the Claude runs:
A pane running CLAUDE_CONFIG_DIR=/tmp/…/cfg claude got CLAUDE_CODE_PLUGIN_DIRS=<agent-view plugin>:<hook plugin>. Its session.tabs.list entry carried providerSession.id with a transcript under the temp folder, right after SessionStart and before any prompt. nativeChat.readSession (the phone's read) returned the conversation.
The same alias with the plugin env unset (main's path) left providerSession empty, which is the bug.
The temp folder's settings.json hash was unchanged after the run, and the plugin carried only Orca's 16 entries (the user's own hooks in ~/.claude/settings.json were left out).
iOS simulator paired to that build: before/after above.
Shell functions run in bash 3.2, zsh (including warn_create_global, nounset, err_return), fish 4.9 and pwsh 7.7. Cases covered: foreign folder, foreign folder with the user's own plugin list, already-listed plugin, folder already holding Orca hooks (.sh / .cmd / .exe / encoded PowerShell), the user's own hooks only, plain claude, managed account, managed + alias, user's own folder on System default, no pointer, plugin env missing. CLAUDE_CODE_PLUGIN_DIRS is restored after the call in every shell.
src/main/claude/hooks/claude-hook-plugin.test.ts pins that the shell's duplicate-hook pattern recognizes every hook command form Orca's builders write and leaves user hooks alone. It fails if the encoded-PowerShell part is dropped (checked).
Platforms: macOS run live. Windows Git Bash / PowerShell separators and command forms checked by the tests above and by reading the paths, not on a Windows machine.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
Install: the plugin publish runs only when Orca installs its Claude hooks (startup reconcile, hooks on/repair). It takes Orca's appended entry per planned event (at most 16) and does two async compare reads, with zero writes when nothing changed. Bursts coalesce to one running and one pending write.
Panes: each pane spawn adds one string assignment and a split/filter of CLAUDE_CODE_PLUGIN_DIRS, with no file I/O.
Launches: in the shell, a launch with no custom folder, with Orca's own folder, or with the plugin already listed does zero file work. Only a launch into a folder Orca didn't set does one file test plus one grep of that folder's settings.json.
Idle: no timers, polling, store writes or per-status-event work.
Risk
Level: Medium
The riskiest part is the shell function change, which runs before every claude typed in an Orca pane. Its new branch only acts when CLAUDE_CONFIG_DIR is set to a folder Orca didn't inject, and it only adds one entry to CLAUDE_CODE_PLUGIN_DIRS for that process.
If an organization's managed settings forbid sideloaded plugin folders, that Claude treats this exactly like the agent-view plugin Orca already passes to default-folder panes.
The first claude started in the first moments after the very first startup, before the plugin is published, runs without it; the next launch has it.
WSL panes are unchanged: they get hooks from the guest's own install. SSH hosts run orcad, which builds pane env and installs hooks with this same code, so each host publishes its own plugin.
Back out with a plain revert. It leaves an unused <userData>/claude-hook-plugin folder that nothing reads.
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
No user-owned file is written. The shell only reads the chosen folder's settings.json.
No wire, RPC or persisted-state changes. An older daemon's panes keep today's rcfile and behave as before.
Follow-up, not in this PR: Codex started with a custom CODEX_HOME likely has the same gap (the ticket mentions it, unverified).
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
…m CLAUDE_CONFIG_DIR
A terminal running CLAUDE_CONFIG_DIR=~/.claude-work claude loaded none of
Orca's hooks, because Orca only writes them into ~/.claude and its own
account folders. The pane never got a session id, so the phone's chat view
stayed on "Can't find this conversation yet".
Orca now publishes the same hooks as a plugin in its own data folder, and
the claude shell function adds it to CLAUDE_CODE_PLUGIN_DIRS for a launch
whose config folder Orca did not set and that does not already carry Orca's
hooks. Nothing is written into the user's folder.
Check plugin membership before touching the config folder, recognise every
Orca hook form (including encoded PowerShell) so a hooked folder never gets
the plugin twice, coalesce plugin writes, keep the settings parse before any
script write, and strip an inherited plugin path in nested Orca panes.
Claude hook installation now publishes managed hooks to a plugin for default-config installs. PTY environment setup configures the plugin directory for enabled Claude launches outside WSL. POSIX, fish, and PowerShell wrappers conditionally add the plugin directory to Claude's plugin path. Tests cover managed-hook command detection.
Severity of issue fixed: Medium
Merge Risk: Low · up to 6c558
Custom-config Claude sessions now get Orca hooks through a plugin without any change to the user's config folder. In an unusual case, a custom config containing only an Orca statusLine entry skips the plugin and the session stays invisible to mobile chat. This is a narrow gap, so merging is low risk.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main user-facing fix: Claude sessions started with a custom CLAUDE_CONFIG_DIR now show their conversation on mobile. The changeset adds a plugin publish path, shell-function plugin…
Description check
The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #41449), Visual Proof with before/after images, Testing with checkboxes, Performance, Risk with level …
Linked Issues check
Linked issue #41449 requires that Claude launched with a user-chosen CLAUDE_CONFIG_DIR (a folder Orca did not create) gets Orca's status hooks, so the pane receives a session id and the mobile chat sh…
Out of Scope Changes check
Every changed area supports the #41449 objective or its tests: - hook-service.ts, claude-hook-plugin.ts: publish and remove the plugin with Orca's hook install lifecycle. - host-env/assembly.ts, claud…
Full details: Title check
Explanation
The title names the main user-facing fix: Claude sessions started with a custom CLAUDE_CONFIG_DIR now show their conversation on mobile. The changeset adds a plugin publish path, shell-function plugin injection, and env handling that serve that goal. The title is specific and accurate. It uses the conventional 'fix(claude):' prefix. It is longer than ideal, at 95 characters, but it stays readable.
Full details: Description check
Explanation
The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #41449), Visual Proof with before/after images, Testing with checkboxes, Performance, Risk with level Medium and a back-out plan, Agent skill upstream boundary, Notes, and Checklist. The AI Disclosure and Review sections are empty. The template says to leave AI Disclosure blank for StablyAI team members, so that gap may be acceptable. The Review section is empty and has no content. The description is detailed and specific about the mechanism, alternatives, and test coverage.
Resolution
Optional: fill in or remove the empty 'Review' heading, and confirm whether the 'AI Disclosure' section needs content for this contributor.
Full details: Linked Issues check
Explanation
Linked issue #41449 requires that Claude launched with a user-chosen CLAUDE_CONFIG_DIR (a folder Orca did not create) gets Orca's status hooks, so the pane receives a session id and the mobile chat shows the conversation. The PR addresses this with these changes:
src/main/claude/hook-service.ts publishes Orca's managed Claude hook entries as a plugin after default-target hook install, and removes it on hook removal.
src/main/claude/hooks/claude-hook-plugin.ts writes the plugin manifest and hooks config to <userData>/claude-hook-plugin/orca-status-hooks, with compare-before-write and coalesced writes.
src/main/ipc/pty/host-env/assembly.ts sets ORCA_CLAUDE_HOOK_PLUGIN_DIR for local non-WSL panes when status hooks are enabled.
src/shared/shell/launch/agents/claude-shell-function.ts adds the plugin to CLAUDE_CODE_PLUGIN_DIRS for the process only when CLAUDE_CONFIG_DIR is a folder Orca did not inject and the folder does not already contain Orca hooks.
The author reports a live test on macOS. Before the change, providerSession stayed empty. After the change, providerSession.id was set after SessionStart, and nativeChat.readSession returned the conversation. The author also reports before/after mobile screenshots. These results were not re-run in this review. Based on the code evidence, the mechanism covers the reported case. Known limits: the first launch right after first startup may run without the plugin, and Android and Codex are not covered. The issue does not require Android. Codex is an explicit follow-up.
Full details: Out of Scope Changes check
Explanation
Every changed area supports the #41449 objective or its tests:
hook-service.ts, claude-hook-plugin.ts: publish and remove the plugin with Orca's hook install lifecycle.
host-env/assembly.ts, claude-agent-view.ts, spawn-env-keys.ts: set, strip, and clear the plugin directory variable for panes. The stripping logic extracts the existing agent-view handling into a shared helper.
shared/agent-hook-listener/providers/claude/claude-hook-plugin.ts: constants and the managed-hook command pattern used for duplicate-hook detection.
claude-shell-function.ts: the POSIX, fish, and PowerShell wrappers that load the plugin for custom config folders.
claude-hook-plugin.test.ts: tests for the managed-hook pattern used by the shell function.
The PR does not change mobile code, Codex handling, or WSL behavior. The Codex gap is documented as a follow-up. No unrelated change was found in the summary.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
25-25: Minor · Functional Correctness · Poor tradeoff
Limit duplicate-hook detection to lifecycle hook entries in all three wrappers.
The POSIX, fish, and PowerShell wrappers match CLAUDE_MANAGED_HOOK_COMMAND_PATTERN against the entire settings.json. The Orca statusLine command uses the same .orca/agent-hooks script path, so a config that contains only that statusLine matches. The wrapper then skips plugin injection. The session starts without the Orca SessionStart hook, so Orca gets no session ID for the pane.
Detection should check only commands under settings.hooks, and it should ignore statusLine. Keep the skip for configs that contain Orca lifecycle hooks. Add a test case in which settings.json contains only an Orca statusLine command, and confirm that plugin injection still occurs.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 73e8d1f2-a02f-41f0-b492-669b22abb7fe
Commits
Reviewing files that changed from the base of the PR and between 18bb4d5 and 6c55816.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
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
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.
ELI5
If you start Claude in an Orca terminal with your own settings folder, for example
CLAUDE_CONFIG_DIR=~/.claude-work claudefor a second account, the phone listed the tab but its chat view stayed on "Can't find this conversation yet". Orca's status hooks were only ever installed in~/.claudeand in the account folders Orca makes itself, so that Claude never told Orca which conversation it was running. Now Orca hands its hooks to that Claude at launch, and the phone shows the conversation.What Changed
Before: a Claude whose
CLAUDE_CONFIG_DIRpoints at a folder Orca didn't create loaded none of Orca's hooks. The pane never got a session id, so mobile chat waited forever. Desktop status (working/done) was missing for that pane too.After: that Claude reports to Orca like any other, with no writes to the user's folder.
How it works:
ClaudeHookService.install(), default target), it also publishes the same hook entries as a small plugin in its own data folder (<userData>/claude-hook-plugin/orca-status-hooks). The entries are taken from the merged~/.claudesettings, so a user'sasyncchoice on an Orca hook carries over. Writes are async, compare-before-write, and coalesced (one running, latest one pending). Turning hooks off deletes the folder.ORCA_CLAUDE_HOOK_PLUGIN_DIRwhen status hooks are on and Claude isn't disabled (not WSL). It is stripped with the other hook coordinates, and an inherited copy from a parent Orca is removed fromCLAUDE_CODE_PLUGIN_DIRS, the same way the agent-view plugin already does it.claudeshell function (POSIX, fish, PowerShell) already detects aCLAUDE_CONFIG_DIRthat Orca didn't inject. For those launches only (an alias like the one above, or the user's own login-shell folder on System default), it adds the plugin toCLAUDE_CODE_PLUGIN_DIRSfor that one process. It skips the plugin when it is already listed, or when the folder'ssettings.jsonalready contains an Orca hook in any form (script path, native.exe, encoded PowerShell). That avoids running Orca's hooks twice, which matters because PreToolUse/PermissionRequest hooks hold the prompt.claude, managed accounts and WSL behave exactly as before.Why
The running process's
CLAUDE_CONFIG_DIRis the only reliable answer to "which folder does this Claude read", and it is only known at launch, in the shell function that already runs before everyclaudein an Orca pane. #33751 learned folders from hook transcript paths, which can't help a folder that has no hooks.Alternatives considered:
orca agent hooks prepare-codex). This edits a file Orca doesn't own. It would need records to clean up on uninstall, and it adds a ~0.3 s CLI start per launch.~/.claudepanes would run every hook twice.--settingsin the wrapper. It conflicts with a user's own--settingsand doubles hooks in folders that already have them.Claude Code loads hooks from
CLAUDE_CODE_PLUGIN_DIRSregardless of its config folder, with nothing to enable in that folder (checked on Claude 2.1.332). Orca already uses that variable for its agent-view plugin.Linked Issue
Fixes #41449
Linear: STA-14983
Visual Proof
Same build, same alias (
CLAUDE_CONFIG_DIR=<temp folder> claude), the same prompt answered by a local fake API, opened in the iOS app paired to the desktop.Testing
Live, hidden worktree build (
orca serve) + local fake Anthropic API, no real~/.claudefolder used for the Claude runs:CLAUDE_CONFIG_DIR=/tmp/…/cfg claudegotCLAUDE_CODE_PLUGIN_DIRS=<agent-view plugin>:<hook plugin>. Itssession.tabs.listentry carriedproviderSession.idwith a transcript under the temp folder, right after SessionStart and before any prompt.nativeChat.readSession(the phone's read) returned the conversation.providerSessionempty, which is the bug.settings.jsonhash was unchanged after the run, and the plugin carried only Orca's 16 entries (the user's own hooks in~/.claude/settings.jsonwere left out).Shell functions run in bash 3.2, zsh (including
warn_create_global,nounset,err_return), fish 4.9 and pwsh 7.7. Cases covered: foreign folder, foreign folder with the user's own plugin list, already-listed plugin, folder already holding Orca hooks (.sh / .cmd / .exe / encoded PowerShell), the user's own hooks only, plainclaude, managed account, managed + alias, user's own folder on System default, no pointer, plugin env missing.CLAUDE_CODE_PLUGIN_DIRSis restored after the call in every shell.src/main/claude/hooks/claude-hook-plugin.test.tspins that the shell's duplicate-hook pattern recognizes every hook command form Orca's builders write and leaves user hooks alone. It fails if the encoded-PowerShell part is dropped (checked).Platforms: macOS run live. Windows Git Bash / PowerShell separators and command forms checked by the tests above and by reading the paths, not on a Windows machine.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
CLAUDE_CODE_PLUGIN_DIRS, with no file I/O.settings.json.Risk
Level: Medium
The riskiest part is the shell function change, which runs before every
claudetyped in an Orca pane. Its new branch only acts whenCLAUDE_CONFIG_DIRis set to a folder Orca didn't inject, and it only adds one entry toCLAUDE_CODE_PLUGIN_DIRSfor that process.If an organization's managed settings forbid sideloaded plugin folders, that Claude treats this exactly like the agent-view plugin Orca already passes to default-folder panes.
The first
claudestarted in the first moments after the very first startup, before the plugin is published, runs without it; the next launch has it.WSL panes are unchanged: they get hooks from the guest's own install. SSH hosts run orcad, which builds pane env and installs hooks with this same code, so each host publishes its own plugin.
Back out with a plain revert. It leaves an unused
<userData>/claude-hook-pluginfolder that nothing reads.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
settings.json.CODEX_HOMElikely has the same gap (the ticket mentions it, unverified).Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)