Repository navigation
[Bug]: nested pi inherits ORCA_PI_STATUS_OWNED and silently reports no status - #500
Merged
Merged
Conversation
Author
|
The gatekeeper did not merge (it never merges on a failed gate).
|
…the PID alone (#480) An inherited ORCA_PI_STATUS_OWNED naming a live PID muted the whole descendant tree, so a session that inherited the marker but reports for another pane sent nothing at all — no session_start, no turn events, no scheduled_work — while Orca showed the pane idle. Env only reaches descendants, so the bare PID could not separate the pane's own nested subagent (which must stay silent, stablyai#8545) from a different pane's reporter. A claim now records the claimant's ORCA_PANE_KEY beside its PID, and an inherited marker recorded for another pane is no claim on this one; a claim with no pane record of its own deletes the stale one, so a new owner never pairs with an old pane. Both lanes use the shared predicate, so the status and titlebar lanes cannot drift (#229). The three _PANE companion keys are stripped at every pane boundary beside the keys they belong to. The stand-down is no longer silent: it is recorded on globalThis keyed by lane, and warned once per process when stderr is a TTY or ORCA_PI_STATUS_DEBUG is set. A piped subagent nobody asked to debug stays quiet.
nplez1
force-pushed
the
nplez1/issue-480
branch
from
November 28, 2026 06:41
fa1ff7b to
52cae4d
Compare
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.
Fixes #480
Summary
A pi process reports status for its pane unless an inherited
ORCA_PI_STATUS_OWNEDmarker says another live PID already has it. That marker is plain env, so it reaches the whole descendant tree and could not tell the pane's own nested subagent — which must stay silent, or stablyai#8545's false "agent finished" notifications come back — from a session that inherited the marker but reports for a different pane. The second case was muted for as long as the owner lived, silently: nosession_start, no turn events, noscheduled_work, and Orca showed the pane idle while pi looked healthy.Both lanes now decide ownership from the PID and the pane that PID claimed:
src/main/pi/agent-status-owner-liveness-source.tsreplaces the bare liveness test withyieldsPaneOwnership/claimPaneOwnership/notePaneOwnerStandDown. A claim records the claimant'sORCA_PANE_KEYin<ownerKey>_PANE; a marker inherited from another pane is no claim on this one. A claim also drops the pane record when the process has none, so a stale pane can never pair with a new owner.agent-status-handler-source.tsandtitlebar-extension-source.tsboth use the shared predicate, so the two lanes cannot drift (the reason the shared generator exists, [Bug]: The titlebar marker owner check has no liveness test, so a pi with a dead inherited owner never paintsπ !and its ask card reads Working #229).pi-process-owner-env.tsstrips the three_PANEcompanion keys at every pane boundary, beside the keys they belong to, so a new pane, a daemon host and an older remote host cannot inherit a claim.globalThisunderSymbol.for('orca.pi.pane-owner.stand-down')keyed by lane (owner pid, its pane, our pane, our pid, a reason), and warned once per process when stderr is a TTY orORCA_PI_STATUS_DEBUGis set. A piped subagent that nobody asked to debug stays quiet.Deliberately not done: keying the marker on process ancestry. Env only ever flows down, so "alive but not an ancestor" means either PID reuse or an orphaned descendant (
nohup/setsidbehind a shell, a tmux server started from pi) — and claiming for an orphaned subagent runner puts a second reporter, and a false completion, on the lead's pane. The ppid chain cannot separate those two, and a CIM walk would block pi's synchronous factory on Windows.Verification
pnpm tc— pass (exit 0).pnpm check:changed(format, oxlint, typecheck, every path ratchet, and the unit tests that import the change) — 31/31 pass.node local/gate-lint.mjs --fast— PASS, 16/16 steps, includingcheck-upstream-file-commentsat the frozen total4843/4843.pnpm test src/main/pi/agent-status-owner-pane.test.ts --maxWorkers=2— 15/15 pass (3 lanes × 5 inherited states).agent-status-session-owner22,agent-status-scheduled-work19,agent-status-async-subagent23,agent-status-restart-reannounce11,agent-status-restart-watch-session11,agent-status-input-redaction20,omp-model-command-source4,agent-status-omp-autolearn-capture2,agent-hook-cancel-verdict-latch1.node tests/tools/pi-owner-runtime-smoke.mjswith real@earendil-works/[email protected]on darwin — 15/15 scenarios as expected for pi, omp and prime-agent: dead owner claims and posts once; a live owner recorded for this pane mutes with the marker kept; a live owner recorded for another pane claims, posts once and records its own pane; both baseline mutations mute. "Pi owner runtime verification" isdisabled_manuallyon this fork, so this was run locally, not in PR CI.orca-titlebar-spinner.tsin a VM with a stubbed process (no committed test — it has no existing suite to extend): kindpiwith no marker claims and recordspane-1; a live owner recorded forpane-1stands down and keeps the owner; a live owner recorded forpane-2claims and recordspane-1; an owner with no pane record stands down. Kindompcarries no marker block and leaves the env untouched.src/main/pi/**,src/main/pty/shell-startup/**andtests/tools/**, none of which is a global input.Decisions
pi -prun, which is diagnosed by re-running it withORCA_PI_STATUS_DEBUG=1rather than by unmuting it by default.ORCA_PANE_KEYposts nothing anyway; guessing "different pane" would un-mute subagents across every mixed-version host._PANEkey. It gates theπ !needs-input marker from the same inherited env, and a pane that loses its marker also loses the ask-card lane ([Bug]: The titlebar marker owner check has no liveness test, so a pi with a dead inherited owner never paintsπ !and its ask card reads Working #229). Separate keys mean neither lane's claim can rewrite the other's verdict by load order. It records no stand-down of its own, so a muted nested session still prints one line, not two.piin a live pane's shell is made diagnosable, not unmuted. It inherits the lead's pane key, so it has no pane of its own to report to, and clearing the marker would give that pane two reporters — which the warning now says out loud instead of recommending. A session that wants its own status belongs in its own pane, where the marker is already stripped.ps -o lstart=), not ancestry. Noted here rather than half-solved.One known NIT, left in the code deliberately rather than opening a third review round: if a process stands down and later claims (the owner died, then
/reload),claimPaneOwnershipdoes not delete the staleglobalThisstand-down record. Nothing reads that record except a person inspecting it.Review
Reviewed by claude/opus, high: R1 (2 blocking fixed), delta clean on R2.
R1 found two blocking items — the stand-down warning recommended clearing the marker, which would have re-broken stablyai#8545 by putting two reporters on one pane, and the diff added comment lines to
tests/tools/pi-owner-runtime-smoke.mjs, an upstream-owned file, pushing the fork'scheck-upstream-file-commentstotal past its frozen baseline. Both are fixed: the warning now states what happened and why clearing the marker is unsafe, and the smoke file's comments are gone (4843/4843). R1's three MINORs and one NIT were addressed in the same pass: the warning is once per process, piped runs are diagnosable behindORCA_PI_STATUS_DEBUG, the titlebar lane was verified by loading its generated source, and the record carries areason.