Repository navigation
pane ownership: observe the ORCA_PANE_KEEP=1 keep marker (orca #44, stage 3 piece b) - #66
Merged
nachumi-a2zoperations merged 2 commits intoNov 16, 2026
Conversation
…tage 3 piece b) Observe only: no signal path (S1 holds; a test scans the new module). At close, the recorded processes still present are read once for ORCA_PANE_KEEP=1 in their start environment: /proc/<pid>/environ on Linux, `ps -wwE -o pid=,command= -p <pid>` once per pid on macOS (a pid list makes macOS ps read the whole process table: 0.8 s of CPU at ~1,900 processes). At most 64 per close. A marked process and its children get the verdict `kept: marker`; the entry line carries `marker` (true / false / null = not read); the daily line lists topMarked. A failed read leaves null and counts markerFailures. Only the answer is kept: no environment text reaches the log (a test pins it). No native code (S3): it replaces KERN_PROCARGS2 from the design note. Known limit, named: on macOS an ARGUMENT exactly ORCA_PANE_KEEP=1 reads as the marker (a label only, in observe). The CPU harness gains --no-markers for the comparison. Refs #44 Signed-off-by: Nachumi Eliyahu <[email protected]>
… piece b) M1 (secrets on the error path): two more MUST rows. A ps that exits 2 with the fake token in stdout AND stderr, and a read that throws Error(<token>): neither the logs nor status() may contain it. Both were red with Fable-3's mutation (error message carries ps output, and applyKeepMarkers re-throws so observeClose logs String(error)), green on the code. psEnvOutput keeps naming only the failure kind. S1 (the macOS parse matched any word): it is now anchored to the environment. Per pid, `ps -wwo command=` then `ps -wwE -o command=`; only what follows the plain line is searched, so no argument can match (exact, or inside sh -c). A command line that changed between the two reads is null. Remaining, named limit: a word inside an environment VALUE still matches (ps joins entries with spaces). Cap 32 pids per close (two reads each). Nit: MARKER_CLOSE_BUDGET_MS = 5 s in total per close; the pids left are null (not read). Refs #44 Signed-off-by: Nachumi Eliyahu <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #44: stage 3 piece (b), the keep marker, observe only. The design note was approved by the lane lead (
~/nacho-run/orca-44-observe-ab.md, md5 a6013a07).What it does
ORCA_PANE_KEEP=1in a process's start environment marks its recorded entrykept: marker. The existing kept walk covers its children.MARKER_CLOSE_BUDGET_MS), with the rest null. A verdict is needed only then, and the start environment does not change./proc/<pid>/environ.ps -wwo command= -p <pid>: the command line;ps -wwE -o command= -p <pid>: the command line, then the environment.KERN_PROCARGS2, so there is no native code (S3).marker(true / false / null = not read);kept: marker;topMarked(the 10 most common markedcomms);status().markerFailures.pane-ownership-marker.ts. Three MUST rows pin it with a fake token:psthat exits 2 with the token in stdout AND stderr;Error(<token>).psoutput, andapplyKeepMarkersre-throws, soobserveCloselogsString(error)). They are green on the code.psEnvOutputnames only the failure kind.Observe only (S1)
offin the mode file turns this off with the rest.Remaining limit (named, after S1)
echo ORCA_PANE_KEEP=1) or insidesh -c 'ORCA_PANE_KEEP=1 …'. Tests pin both.psstill joins the environment entries with spaces, so a word inside an environment VALUE (FOO='x ORCA_PANE_KEEP=1') reads as the marker. A test names it.CPU (S2), the stage-2 harness, 20 agent panes, 60 s, churn, MacBook in-process reader, helpers included (
/usr/bin/time)Three rounds, because the first two designs were too costly:
pspsper closepsper pid (this PR)The finding behind round 3: on macOS,
ps -pwith one pid reads only that process (~0 s CPU). With two or more pids (a comma list or repeated-p), it reads the whole process table: about 0.8 s of CPU at ~1,900 processes (measured; the same without-E).lsoffd helper, which also passes a pid list, is NOT affected:lsof -pwith 1, 2 and 30 pids costs 0.03–0.04 s each, measured today. Stage 2 needs no change.pstable read uses-Aon purpose, so it is also unaffected.Tests
pane-ownership-marker.test.ts:pstoken parse (exact token; the argument-collision case);psoutcome rules;topMarked;d18bbcf4the file failed at import.PATH=$HOME/.local/node/node-v24.22.1-darwin-arm64/bin:$PATH node config/scripts/test-runtime/execution-policy/run-vitest.mjs run src/main/pty/process-retirement/pane-ownership src/main/daemon/terminal-host --config config/vitest.config.ts.src/main/pty/process-retirement/refused-tree-kill-root-termination.test.ts(not touched here): 2/2 pass with the same command and PATH. Fable-3'schild.once is not a functionthere (on base too) looks like its borrowednode_modules/process-host resolution.Gates (MacBook, Node 24.22.1 first on PATH for the run, no override)
pnpm check:changed --base=origin/blowzer/fork-only: 24/24 at 468e4a0 and again 24/24 at af41fdc, including typecheck (node, web, cli) and the unit step.pane-ownership-marker.ts(applyKeepMarkers) to keep the observer under the 300-line limit.Docs
docs/decisions/issue-44-pane-process-ownership.md, section 6: "As built" for (b), including the per-pid rule and the limit.Next: piece (a), restart carry-over, as its own PR after this one.