Repository navigation
Conversation
… Needs input A Pi extension that runs Devin as a child (pi-devin-acp spawns `devin acp`) passes Pi's environment down, so Devin's managed hook posted /hook/devin on Pi's pane. Its PermissionRequest set the pane to waiting after the user had already approved in Pi's own dialog, and nothing corrected it until Devin finished. Pi's status extension already exports its PID as ORCA_PI_STATUS_OWNED (and Prime's as ORCA_PRIME_AGENT_STATUS_OWNED) to every descendant. The Devin hook now skips its post while that owner is alive: a numeric guard plus `kill -0` on POSIX, placed after the payload is read; a presence check that jumps to the existing stdin drain on Windows, placed after the pane guards. Fixes stablyai#22011
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughGenerated Devin hook scripts now include Pi status-owner environment values in their posts. The listener drops Devin hook payloads when a recorded owner PID is valid and alive. The shared owner-key tuple is used by the hook code and process-owner environment module. Tests cover owner liveness, captured Windows request bodies, and Windows test selection. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to A rare PID reuse can leave Devin status updates suppressed after the Pi owner exits. The remaining risk is bounded to status reporting; the other reviewed owner-handling paths are consistent. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change affects status reporting rather than permission decisions and preserves existing access checks. Unusual inherited values and process-identity recovery remain incompletely established. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 10 files. (2 skipped: 2 unsupported.)
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — initial review of the 7-file diff at 1a8ef69.
- New guard module (
pi-status-owner-hook-guard.ts) — builds POSIXcase/kill -0and Windowsgoto-drain guards from the sharedPI_STATUS_OWNER_ENV_KEYS, with the malformed-PID and process-group rationale captured inline. - Devin hook wiring (
hook-service.ts) — POSIX guard sits after payload capture and thespool_hook_eventdefinition, before both its call sites and the curl post; Windows guard sits after the Orca env guards and before the post. - Env-key split (
pi-process-owner-env.ts) —PI_STATUS_OWNER_ENV_KEYS(the two status keys) extracted as the source for the existingPI_PROCESS_OWNER_ENV_KEYSstrip list (which keeps the title marker). - Tests + CI lane — new
hook-script-pi-status-owner.test.tsruns the generated script against a real listener (and realcmd.exeon Windows), registered in both Windows-lane lists; the stdin-lifecycle rule is narrowed to forbid only missing-ORCA_*guards from routing to the drain.
ℹ️ Platform boundary notes
No change requested — recording these so they are known boundaries rather than surprises.
- Windows is presence-only. The guard tests that the owner variable is set, not that the PID is alive, so a stale value inherited by a long-lived descendant of an exited Pi keeps Devin quiet where POSIX would post. This matches the PR's own Notes and the deliberate no-
tasklisttrade-off. - POSIX
kill -0proves liveness, not identity. PID reuse could transiently suppress a Devin post. This is the same approximation the in-process extension already makes (isStatusOwnerAlive), so it is consistent, not a regression.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The Windows Devin hook skipped its post whenever the owner variable was set, because cmd has no builtin liveness probe. A process that outlived Pi kept that value, so its Devin events never reached the pane again. The Windows hook now posts as before and names the owner in two form fields. The shared hook listener drops a Devin event only while that PID is running on this host, using the same rules as the POSIX guard (no leading zero, fail open on any probe error). The owner keys move to src/shared so the hook builder and the listener share one list. With no drain jump left, the stdin-lifecycle test returns to its base form. The guard module is added to the CLI tsconfig, which lists main-process files explicitly.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — incremental review of 1a8ef69..c01f444 (one commit, 10 files).
- Moved the Windows skip from the hook script to the listener. The generated
devin-hook.cmdno longergoto-drains when an owner variable is merely set; it always posts, attachingORCA_PI_STATUS_OWNED/ORCA_PRIME_AGENT_STATUS_OWNEDas form fields. The shared listener now drops a Devin event only while that PID is actually running. - Added
hasLivePiStatusOwner(src/shared/agent-hook-listener/pi-status-owner-liveness.ts) to close the platform gap wherecmdcannot probe liveness: strictly-numeric PIDs only (0/leading-zero/negative are process-group forms),process.kill(pid, 0)with fail-open on EPERM, matching the POSIXkill -0guard. - Centralized
PI_STATUS_OWNER_ENV_KEYSinsrc/shared/pi-status-owner-env.ts, now consumed by the guard, the process-owner strip list, and the listener so the three stay in sync. - Tests updated to assert the new contract: the Windows integration run now feeds real hook posts through the real listener (dropped for a live owner, accepted once it exits or none is named), and a new shared listener test covers malformed owners and confirms non-Devin sources are untouched. The stdin-lifecycle rule was narrowed to just forbid ORCA guards routing to the drain.
- Lane/tsconfig registration updated for the new module.
I traced the listener drop through the relay and retry paths: the relay re-runs normalizeHookPayload on the raw body, but forwards the normalized envelope (which carries no owner fields), so there is no cross-host PID check; spool records omit the fields; and installRemote stays POSIX-only, so only the local Windows script ever sends them.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b0f476db-d5f5-45b4-9733-c4534cefe259
📒 Files selected for processing (9)
config/tsconfig.cli.jsonsrc/main/agent-hooks/pi-status-owner-hook-guard.tssrc/main/devin/hook-script-pi-status-owner.test.tssrc/main/devin/hook-service.tssrc/main/pty/pi-process-owner-env.tssrc/shared/agent-hook-listener-pi-status-owner.test.tssrc/shared/agent-hook-listener.tssrc/shared/agent-hook-listener/pi-status-owner-liveness.tssrc/shared/pi-status-owner-env.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
|
| '#!/bin/sh', | ||
| ...buildPosixHookPayloadCapture(), | ||
| ...buildPosixHookSpoolLines('devin'), | ||
| ...buildPosixPiStatusOwnerHookGuardLines(), |
There was a problem hiding this comment.
Permission prompt status disappears If Devin runs interactively inside a Pi terminal overlay, inherits Pi’s pane key and live status-owner PID, and does not route its permission prompt through Pi’s UI, this guard skips Devin’s
PermissionRequest. Pi then emits no replacement prompt event, so the sidebar never shows “Needs input” for a request the user must answer. The Windows listener drops the same event. Limit suppression to Devin runs whose prompts Pi actually reports.
There was a problem hiding this comment.
This scenario is real and is the trade-off documented in the PR’s Notes. I’m keeping the current behavior: an inherited live Pi/Prime owner PID establishes status ownership, not whether that particular Devin prompt goes through Pi’s UI. Interactive overlay prompts can therefore be absent from the sidebar.
Restoring all nested Devin permission events would reintroduce the ACP stuck-“Needs input” problem this PR fixes. Narrowing suppression reliably needs prompt-routing provenance that the current marker does not provide; I’m not inferring that distinction here.
At unchanged head d944d91da0, src/main/agent-hooks/pi-status-owner-hook-guard.ts:9–11 and src/shared/agent-hook-listener.ts:55–57 implement this policy. Existing real POSIX-hook and listener tests confirm ownerless permission events are reported and live-owner events suppressed: 71 tests pass, one Windows-only test is skipped; full typecheck passes. This is an accepted limitation, not a claim that interactive prompts are covered.

ELI5
Pi can run Devin as a model through the pi-devin-acp extension. When Devin needs permission to run a command, Pi shows its own dialog, and Orca already reports that dialog as "Needs input". But Devin's own Orca hook also fired, marking Pi's pane "Needs input" a second time. Pi reports nothing while Devin works on the approved command, so the pane stayed on "Needs input" after the user had already approved. With this change Devin's hook stays quiet while Pi is reporting the pane, and the status follows Pi.
What Changed
Before: in a Pi pane using a Devin model, approving a Devin permission request left the sidebar on "Needs input" until Devin finished its whole turn.
After: the sidebar shows "Needs input" while Pi's permission dialog is open, "Working" once it is approved, and "Done" at the end. Standalone Devin panes behave exactly as before.
Mechanism:
devin acpwith Pi's full environment, including the pane key. So Devin's managed hook (~/.orca/agent-hooks/devin-hook.sh/.cmd) posted/hook/devinevents onto Pi's pane.PermissionRequestoverwrote Pi's row with "waiting", and nothing from Pi corrected it while Devin worked.ORCA_PI_STATUS_OWNED(Prime usesORCA_PRIME_AGENT_STATUS_OWNED). The generated Devin hook now skips its post while that owner is alive:kill -0 <pid>. It sits after the payload is read from stdin, so Devin never sees a broken pipe. A PID left behind by an exited Pi does not silence anything.cmdhas no builtin way to check whether a process is alive. So the hook posts as before, adding the owner PIDs as two form fields. The shared hook listener (hasLivePiStatusOwner) drops a Devin event only while that PID is running, using the same rules as the POSIX guard. Hook and listener are on the same machine: the Windows script is only installed for local targets.PI_STATUS_OWNER_ENV_KEYS) now live insrc/shared/pi-status-owner-env.ts. The hook builders (src/main/agent-hooks/pi-status-owner-hook-guard.ts), the listener and the existingPI_PROCESS_OWNER_ENV_KEYSstrip list all read that one list.cmd.exescript on Windows, so it is registered in the Windows CI lane: both thepackage_windowsvitest list inpr.ymlandWINDOWS_PACKAGE_TESTS.win32-test-lane-registration.test.mjsrequires both. The guard module is also added toconfig/tsconfig.cli.json, which lists main-process files one by one.Why
ctx.ui.select, which Orca's Pi extension maps to "waiting" and back to "working". Devin's hook only duplicated that, too late to clear.taskliston every event would fix that fromcmd, but it adds time and EDR signal to every hook, so the listener checks instead.devin acpspawn. This would narrow the skip to exactly the ACP case. It needs a release of a third-party package, and until then there would be no fix. It is a reasonable follow-up (see Notes).Linked Issue
Fixes #22011
Visual Proof
N/A for a recording: this changes which status the sidebar shows, and I have no before/after capture. Verified end to end with real binaries instead (see Testing). To reproduce: in a Pi pane, run
/model devin/swe-2with Devin's yolo mode off and ask for a shell command. Approve Pi's permission dialog and watch the sidebar status.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Live run (Linux): real
pi -p --model devin/swe-2with pi-devin-acp 0.5.0 and Devin 3000.11.1, with Devin's hooks pointed at old and new generated scripts and a local listener./hook/devinSessionStart, UserPromptSubmit, PreToolUse, PermissionRequest, PostToolUse, Stop and SessionEnd all posted on Pi's pane./hook/pievents. The approved command still ran.hook-script-pi-status-owner.test.tsruns the generated script against a real HTTP listener:0,00,-1, non-numeric, empty).cmd.exescript posts the owner fields, and each post goes through the real listener. It is dropped while the owner is alive and accepted after the owner exits or when no owner is set.agent-hook-listener-pi-status-owner.test.ts: the listener drops Devin events while either owner is alive. It keeps them when the owner has exited or no owner is named. It never checks a malformed value (0,00,-1,1, non-numeric), and it leaves other agents' events alone.Mutation checks: each test fails when its target breaks:
0pattern (caught by the00case)Local runs, all passing:
pnpm tcsrc/shared/agent-hook-listener*,src/main/devin,src/main/pi,src/main/agent-hooks,src/relay, the child-process import boundary,pr-code-change-scope.test.mjsandwin32-test-lane-registration.test.mjs. The two WSL hook relay tests fail identically onmainon this host.oxlintandoxfmt --checkon the changed filespnpm run check:code-quality:changedagainstupstream/mainLinux live and automated. Windows is covered by the CI lane only. macOS has not been run yet.
AI Disclosure
AI-assisted implementation and review.
Review
caseandkill -0, both built intoshon macOS and Linux. On Windows the hook keeps its singlecurl.exepost, and the listener checks liveness with Node'sprocess.kill(pid, 0). Notasklistor PowerShell probe was added, so hook latency and EDR signal are unchanged.installRemote.kill -0runs on the execution host, where Pi and Devin both live. Only the local Windows script sends owner fields, so the listener never checks a PID from another machine. Older scripts send no owner fields and keep today's behavior.process.kill(pid, 0)in the listener for Windows Devin events that name an owner.Agent skill upstream boundary
Notes
devin acp. Devin gives its hooks no marker for ACP mode, only the parent process name.devin -prejects the tool call itself, so nothing waits on the user. Before this change that produced a "Needs input" nobody could answer.kill -0and the listener's check.Checklist
N/Awith reason (N/A; see Visual Proof)pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (typecheck, focused tests, and the changed-code gate pass locally; CI covers the full suite)