fix(daemon): read a native install's version label as claude with an OS executable witness #1345
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.57) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1345"
general
weight: 0.35
mvschwarz
What a user gets
A Claude seat installed with Claude's native installer on macOS, whose process is named by its version (for example
2.1.300), is no longer marked as needing attention after a restore that resumed it, andrig reconcile-sessionno longer reports that its pane command doesn't confirmclaude-code.Refs #86
What changed
The native installer makes
~/.local/bin/claudea symlink into~/.local/share/claude/versions/<version>. macOS names a process after the file it ran, so tmux's pane label is the version, neverclaude. Aclaudelabel reads as Claude by name. A version label had to prove the exact conversation instead, which also needs Claude's prompt on screen and every command-line argument parsed.A version label now stands for
claudeonly when all of these hold:/proc/<pid>/exeon Linux;proc_pidpathon macOS, read as #724 already does) inside the installer'sversionsfolder, with a basename equal to its process name, and its command line namesclaudeas the program;The label alone never counts. A path read that fails or times out is no witness. What the witness shows is that the pane's one foreground process runs from a file in the installer's
versionslayout and was started asclaude; it doesn't prove the file is Anthropic's Claude or who owns that home directory. That's the same name-level trust aclaudelabel already gets, plus the OS path.It applies in three places:
reconcile-session's runtime drift line.The changed result: a native-installer Claude seat whose process is named by its version is treated as resumed on the same evidence a
claude-named seat already gets by name, plus the OS executable witness. Like that name check, it claims nothing about which conversation is running.Which seats are unmanaged: a launch binding carries the seat's permission mode, but readiness checks that build their own binding (the context monitor's recovery, the transport's startup readiness, continue-fresh) don't. So the adapter reads the seat's saved permission selection through
NativePermissionStore.resolve, the source the launch uses. A seat is unmanaged only when its binding and that selection both say so; a missing or unreadable selection counts as managed.What stays the same: managed seats keep their exact launch proof at every readiness check. Exact conversation proof and its argument parser, strict restore lineage, and the attention reconciler's token rule are unchanged. A shell label, aliases and functions, and the launch command are unchanged.
Where it takes effect: where the pane reports the launched process. That's a direct launch, an unmanaged launch once its staging subshell runs the executable in place (#1200), or a user's own
exec. While a pane reports the staging shell, nothing here changes.Timing
The witness runs at most once per observation, only when the pane label is a version and reading it as
claudewould change the result, and only for unmanaged seats. Each run takes two process samples. Each sample is onepsand, when a version-named process is present, one OS path read (on macOS a boundedosascriptcall with a 2 s timeout).main. The reader reports only its own timeout kill (Node killsosascriptwith the kill signal); a denied, overflowing or unparsable read is not a timeout and changes nothing. So one wait pays for at most one timed-out sample pair, not one per observation: in the tests, the launch wait reads once instead of 17 times and the legacy restore once instead of 27. The next wait, a separate launch or restore, tries the witness again; nothing is cached between waits.psand the tmux reads have no timeout of their own, as onmain. Linux reads/proc/<pid>/exewith no timeout and reports none. The managed launch's exact proof is unchanged and keeps its own reads once Claude's prompt is visible.Tests (
claude-version-label-witness.test.ts)These are stubbed pane labels and process rows, through the existing adapter, resume and reconcile entry points, so the same file runs on
main.- the unmanaged launch wait resumes, both with OpenRig's own resume arguments and with an argument from the user's own
claudethat exact proof can't parse;- the readiness check is ready;
- the legacy restore resume is verified;
-
reconcile-sessionreports no runtime drift, and continuity stays unverified.- a path outside the installer layout;
- a basename that isn't the process name;
- a program name that isn't
claude;- a version as the program name;
- two candidates;
- a failed or timed-out path read;
- the native path as the program name, with no OS path read;
- the native path as the program name, with an unrelated OS path;
- a background process;
- a label naming a different version;
- a pane process change after the samples;
- a process that changes between samples;
- an unwitnessed label in the resume and in reconcile.
claudelabel (no process read).main's result. A missing path without a timeout still lets every observation try. A later, independent wait uses a healthy witness. The path reader reports only an actual timeout, and the process listing forwards it only to a caller that asks.ContextMonitor.pollOnce, real SQLite andNativePermissionStore): a managed seat with a version label and the wrong conversation, or with no OS path, staysattention_required; the ordinaryclaudelabel still reads ready, as does an unmanaged witnessed label.The tests were also run without the fix on a separate branch; that run is linked below.
Not yet run on a real Mac. These tests stub the pane labels and process rows. A run on macOS with Claude's native installer is still pending, so this doesn't yet show a native-installer restore working on a real machine.
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Improved recognition of unmanaged Claude sessions when a pane displays a version label instead of the usual command name. Recognition requires confirmation that the running Claude executable matches the label.
Prevented incorrect runtime-drift warnings when that version label is confirmed; other mismatches retain existing behavior.
Unmanaged resumes can be recognized under the same verified conditions. Managed resumes and cases without matching executable evidence retain their existing behavior.
* Improved reliability when executable verification times out by preventing repeated checks during the same readiness or resume attempt.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->