Skip to content

test(e2e): keep the descendant-kill stand-in's marker path out of argv - #39201

Merged
nwparker merged 1 commit into
mainfrom
nwparker/nightly-e2e-agent-descendant-process-kill
Nov 6, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/nightly-e2e-agent-descendant-process-kill

Conversation

@nwparker

@nwparker nwparker commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

A nightly end-to-end test that checks "closing an agent's terminal also kills the background processes it started" had been failing every night. The product still works; the test's fake agent was misreading its own arguments.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12

What Changed

  • Before: The test starts a fake claude script and passes it a file path as its first argument; the script writes the pid of a detached child into that file. Since Orca started adding its own Claude flags (--plugin-dir <dir>, from Claude subagent navigation in feat(claude): navigate and track subagent views from sidebar #33322), the first argument the script received was --plugin-dir. It wrote the pid to a file named --plugin-dir in its working directory, so the test waited 20 s for a file that never appeared and failed with "stand-in agent never spawned its detached child".
  • After: The marker path is written into the fake agent's script itself, so whatever flags Orca adds are ignored. The rest of the test is unchanged: it still checks that the detached child is alive, kills the agent PTY, and requires the detached descendant to die.
  • Routing: PR CI never picked this spec, which is how the drift landed unnoticed. A new feature.agent-descendant-kill route now selects it for changes to the descendant-kill code (pty-descendant-*, terminal-descendant-shutdown, terminal-session-teardown, local-pty-termination) and to src/main/claude/agent-view/, which owns the injected Claude flags. Unit tests cover the route.

Why

Adding --plugin-dir to Claude launches is intended product behavior, so the test needed fixing, not the product. Taking the marker path out of argv makes the fake agent behave like a real one, which also gets flags it didn't ask for. The other options were to parse $@ for the last argument or to turn off subagent navigation in the test. Both are more fragile, and turning off navigation would test a launch path that users don't get by default.

Linked Issue

N/A (nightly E2E failure; maintainer fix)

Visual Proof

N/A: test-only change, no UI or behavior change.

Testing

  • Reproduced the failure locally on macOS. While the test ran, ps showed the stand-in running as node spawn-detached.cjs --plugin-dir.

  • With the fix, tests/e2e/agent-descendant-process-kill.spec.ts passed 3 times in a row locally (headless, background launch), and no sleep 31337 was left running afterwards.

  • pnpm test config/scripts/workflow/source-routing config/scripts/ci/... passes, pnpm tc passes, and oxlint and the changed-code quality gate are clean.

  • 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

Risk

Test and CI-routing only. The new route adds this one spec (about 20 s) to PRs that touch the listed files. Revert is a plain revert.

Level: Low

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

The spec is still skipped on Windows (POSIX-only), as before.

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)

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 613aceee-486b-41c0-bcdf-d54a9fd03340
Commits

Reviewing files that changed from the base of the PR and between a2ad899 and d89cdde.

Files selected for processing: 3

  • config/scripts/workflow/source-routing/pr-e2e-gate-contract.test.mjs
  • config/scripts/workflow/source-routing/pr-feature-area-e2e-source-routes.mjs
  • tests/e2e/agent-descendant-process-kill.spec.ts
  • 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.

Share

Claude launches now get --plugin-dir prepended (subagent navigation, #33322),
so the stand-in read '--plugin-dir' as its marker path and the spec never saw
the detached child. Route the spec on descendant-kill and Claude launch-flag
sources.
@nwparker
nwparker force-pushed the nwparker/nightly-e2e-agent-descendant-process-kill branch from 1062acc to d89cdde Compare November 6, 2026 22:51
@nwparker
nwparker enabled auto-merge (squash) November 6, 2026 22:51
@nwparker
nwparker merged commit f1ab150 into main Nov 6, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant