Skip to content

test(e2e): the shared-home spec tells a host's own server from a PID that only collides - #30147

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/shared-home-pid-identity
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/shared-home-pid-identity

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6
Prod 0 0 0 0

ELI5

One end-to-end test checks that two SSH machines sharing a home folder each run their own Orca server. It sometimes failed when nothing was actually wrong, because two separate machines can hand out the same process number. The test now checks that a number really belongs to the server it is looking for.

What Changed

Before: tests/e2e/ssh-orcad-shared-home-machines.spec.ts:47 could fail at its "B never launched into A's slots" check, as it did on main (Received ["229"], run 39083874854, Docker 2/2). This was not a product failure.

After: the spec counts a PID from a server slot's .orcad-pid as running only if that process's command line names that slot directory.

Mechanism. The two Docker SSH hosts share /root but each has its own PID namespace, and both boot the same image through the same deploy steps. So the PID that host A records in the login-home slot (/root/.orca-remote/orcad-*/.orcad-pid) can be a live process on host B: B's own server or one of its children. kill -0 alone then reports that B runs from A's slot. A managed server is started as nohup <runtime> <slot dir>/<launcher> ..., so its command line always carries its own slot's absolute path. B's server, which runs under /root/.orca-remote/hosts/<id>/..., never matches the login-home slot path.

Why

This is a test-only flake, not a regression in the code. None of the PRs that merged between the passing and failing commits touch the managed deploy or slot selection: after 299dcb86fc8a they are #30035, #30125, #30131, #30120, #30129 and #30132. The spec also passed on both bisect probes, #30139 at 27cfee6f7ea2 and #30138 at 299dcb86fc8a. The assertion keeps its intent: if B really launched into a login-home slot, its process would name that slot and the check would still fail. Alternatives I considered:

  • Excluding B's own recorded PIDs would still miss collisions with B's other processes.
  • Comparing start times is not portable across the busybox and coreutils hosts this harness supports.

Linked Issue

Fixes the flaky ssh-orcad-shared-home-machines.spec.ts:47 failure on main. I found no product regression. The suspect was #30120, and it is not involved.

Visual Proof

N/A: test harness only.

Testing

  • Checked the shell predicate on a real Linux host (omarchy), isolated under /tmp. A slot PID file holding a live PID whose process runs from a different slot is now excluded. The process's own slot is still matched.

  • The managed-orcad Docker lane on this PR runs the spec against real Docker SSH hosts.

  • No unit test: the change is to an e2e spec's own shell probe, and a unit test cannot reproduce a cross-container PID collision.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Codex review (gpt-6.1-sol, high): no findings.

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

Test only. The spec is Docker-only.

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)
  • 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)

…that only collides

Each Docker host has its own PID namespace, so the PID host A records in the
login-home slot can belong to an unrelated live process on host B; kill -0
alone then read it as B running from A's slot. Count a recorded PID only when
its process runs from that slot.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3d5e1c6-efa1-4c4a-b1ee-72cfff675cba
📥 Commits

Reviewing files that changed from the base of the PR and between 0c6e496 and b486f88.

📒 Files selected for processing: 1
  • tests/e2e/ssh-orcad-shared-home-machines.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📝 Walkthrough

runningPids now reports a recorded PID only when the process is live in the container and its command line contains the record’s slot directory. Previously, it included any live process with the recorded PID.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b486f

No concrete merge-blocking issue is established by the available evidence.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly describes the main change: updating the shared-home SSH end-to-end test to distinguish a host's own server from a colliding PID.
Description check Passed The description is complete and focused. It explains the failure, the mechanism, the reason for the change, testing, scope, and checklist status. The Linked Issue section describes the flaky failure b…
Full details: Description check

Explanation

The description is complete and focused. It explains the failure, the mechanism, the reason for the change, testing, scope, and checklist status. The Linked Issue section describes the flaky failure but does not include a specific issue number or link.

✨ Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor Author

Folded into #30146: the managed-orcad Docker 2/2 lane runs both specs, so each fix needs the other for a green lane on its own head. On this PR the shared-home spec passed and journeys:119 failed, which #30146 fixes.

@nwparker nwparker closed this Oct 18, 2026
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