Repository navigation
fix(e2e): drop the pi-title spec's stale private Docker-SSH connect fork - #17017
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe Docker SSH relay helper now derives authority from current store state and waits for a connected authority when needed. Worktree hydration now retries authoritative fetches with live-authority validation and a 250 ms backoff for up to 60 seconds. The SSH-compatible agent title test now uses the shared Merge Risk: 🔵 Low · up to The E2E helper now waits for a live SSH authority, but worktree data from an older authority may still be accepted if the connection rotates during hydration, potentially causing stale test setup. The PR is mergeable with explicit owner awareness and follow-up on this bounded correctness risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Title checkExplanation The title accurately describes the removal of the stale private Docker-SSH connection helper, but it does not mention the shared-helper hydration and authority changes identified as the main PR objective. It remains clearly related to a real part of the changeset. Full details: Description checkExplanation The description gives detailed change, defect, scope, and validation information. However, it conflicts with the provided changeset summary and objectives about the shared helper retry loop, and it omits required template content such as the Linked Issue, Visual Proof or explicit N/A, Review, Notes, and Checklist sections.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c869497e-26be-4273-8576-ed78de0c00f0
📥 Commits
Reviewing files that changed from the base of the PR and between 65dd06a and b72b80eceb302808c79b93f4dad02be21353e9c0.
📒 Files selected for processing (2)
tests/e2e/helpers/docker-ssh-relay-connection.tstests/e2e/ssh-pi-compatible-agent-title.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
349b0dc to
50bb853
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c6b1aa2f-901a-4357-bb26-66ebc0d46871
📥 Commits
Reviewing files that changed from the base of the PR and between b72b80eceb302808c79b93f4dad02be21353e9c0 and 50bb853.
📒 Files selected for processing (1)
tests/e2e/helpers/docker-ssh-relay-connection.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Review loop — round 1 (adversarial pass + rebase)Reviewed at Did it pass by weakening the spec? No.The per-attempt acceptance check is byte-identical to the one it replaced — all seven conjuncts survive verbatim ( One fixture property was deliberately dropped: the old code pinned hydration to the authority returned by The deletion is also a strictness improvement: the deleted fork called Defect found and fixedThe load-bearing The mechanism the loop actually handles is different: a caller authority that rotates mid-flight makes Deletion safety — proven
Behavioural delta vs the deleted fork: Other findings
Gates
Not verified — stated plainlyThe e2e was never executed. There is no runtime evidence for or against this PR. Docker's Linux VM backend is dead on this host ( Also unverified: the cause of the transport bounce (unknown to the PR and to this review — not invented); whether 60s is the right deadline; the other 22 specs that share this helper. Framing noteThe Docker-SSH specs had no CI lane until #16746 — the commit immediately preceding this one on this file. A red here is very likely the first time the spec ever ran, not a regression. Nothing above should be read as describing one. |
Review loop follow-up — final head
|
There was a problem hiding this comment.
♻️ Duplicate comments (2)
tests/e2e/helpers/docker-ssh-relay-connection.ts (2)
185-206: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRe-check the live authority after
fetchWorktrees.
authorityis captured before theawait. Lines 190-197 compare the result only with that captured value. If the connection rotates before worktree selection, the old result can pass and a stale worktree can become active. DeriveliveAuthority()afterfetchWorktreesand require it to match the result before accepting the worktree.Suggested check
const worktreeResult = await store.getState().fetchWorktrees(result.repo.id, { executionHostId, directSshAuthority: authority, requireAuthoritative: true }) + const currentAuthority = liveAuthority() + const authorityIsCurrent = + currentAuthority?.targetId === authority.targetId && + currentAuthority?.providerEpoch === authority.providerEpoch && + currentAuthority?.connectionGeneration === authority.connectionGeneration if ( worktreeResult.status !== 'complete' || + !authorityIsCurrent || worktreeResult.repoId !== result.repo.id ||
176-200: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winKeep the hydration request inside
hydrationDeadline.The loop checks the deadline only before
fetchWorktrees. A request that starts near the deadline can remain pending after 60 seconds because this call has no visible remaining-time cancellation. The unconditional 250 ms backoff adds further overshoot. Pass the remaining timeout through the worktree-listing cancellation path and release its request lease when the deadline expires.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2da03e7f-001c-4e0d-8090-ec7268249487
📒 Files selected for processing (1)
tests/e2e/helpers/docker-ssh-relay-connection.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Review — the fork deletion is right; the retry loop should be split outReviewed at head The root cause holds upConfirmed independently: The mechanism is precise. The fork called The shared helper passes The four blocked PRs fail on exactly thisAll of #16336, #16901, #16915, #16926 fail the lane on The fork replacement is faithful: the helper defaults This half is correct and I recommend it lands. Why I'd split the 60s retry loop outTo be clear about what is not wrong with it: the loop does not weaken the fence — every attempt still requires a full authority match on all five fields — and its shape is idiomatic here ( The objections are evidentiary and blast-radius:
One minor defect in the loop, if it does stay
For the record, I looked hard for worse and did not find it: no missed wakeup (the Promise executor is synchronous, and zustand's Separately, and not introduced here: Recommendation: land the fork deletion now; take the retry loop separately, and if it is still wanted, give it a fast-fail arm and derive its deadline from the remaining test budget rather than a flat 60s. Brennan owns the call. Dispatch evidence
The pi-title spec passed in all four probe runs. The single probe red was So the lane's two failure modes separate cleanly: the pi-title fork (this PR) and the cold-hydration capture (#17031). Neither result depends on the retry loop. Gates
Note for whoever merges: this PR's own |
Correction to point 4 above, and a narrowing of point 3Point 4 was wrong as I stated it. I claimed six consumer specs run the 60s loop inside a 120s budget. They do not. All six call One case does survive, and it is the tightest in the set: Worth adding for fairness: the 60s is paid only on the failing path. Point 3 also narrows. The routing blind spot is real and I re-proved it, but it is bounded rather than permanent: The recommendation is unchanged. It never rested on the timeout argument. It rests on: the fork-deletion-only branch clearing the lane on its own (pi-title green in all 4 runs), the retry loop's in-code justification being a refuted hypothesis, the absence of a fast-fail arm, and the fact that the loop's own PR CI cannot exercise the 23 consumers it changes. Points 3 and 4 were supporting, and both are weaker than I first wrote them. |
`ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote` that predates #11003. Commit a401833 gave `fetchWorktrees` a host-qualified authority gate that short-circuits to `return false` for an SSH host with no complete `directSshAuthority`, and updated the shared `connectDockerSshRelayTarget` helper in the same commit -- but never touched this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)` -> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is empty, `[0]` is undefined, and setup throws `No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the spec reaches a single title assertion. Differential across 5 lane runs (~130 SSH connects): the shared helper's guard errors fired 0 times; `No remote worktree found` fired 3 times, always via the fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher isolation`. The spec now calls the shared helper. Every helper default matches what the fork passed (`relayGracePeriodSeconds: 1`, `remotePath` DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`); the helper additionally uses `target.host` rather than a hardcoded `127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`. No assertion changed; no retry, sleep, or timeout was added anywhere.
6223813 to
e8a9988
Compare
Split — the retry loop is out; the fork deletion stands aloneHead is now What changed
The spec half is byte-identical to what was already reviewed here; only the shared-helper half was Zero occurrences of No assertion changed. Diffing the entire All three Why the loop was removedIts stated justification — a "~0.5s post-deploy transport bounce" — was refuted in Log adjacency alone could not have settled this: teardown noise sits next to every test's last real The 4-run experiment that decided itRather than argue the two halves apart, a fork-deletion-only branch was built
Lane: 3 of 4 green. The pi-title spec: 4 of 4 green. Verified from the job logs directly, not The single lane red was So the fork deletion alone clears the lane, and the loop's contribution is not measurable. Blast radius the loop carried, and this PR does not
Gates at
|
Dispatch results at
|
| Run | Job | Lane | pi-title spec | Suite |
|---|---|---|---|---|
| 33197732254 | 98939852826 |
success | ✓ ssh-pi-compatible-agent-title.spec.ts:74:7 (24.8s) |
2 + 5 + 18 passed, 0 failed |
| 33197734527 | 98940128160 |
success | ✓ 74:7 (23.5s) |
2 + 5 + 18 passed, 0 failed |
| 33197737144 | 98940141029 |
success | ✓ 74:7 (24.8s) |
2 + 5 + 18 passed, 0 failed |
| 33197738900 | 98940331034 |
success | ✓ 74:7 (25.2s) |
2 + 5 + 18 passed, 0 failed |
All three lane steps green in every run — including Run remaining Docker SSH E2E, the step that
contains this spec and the step that was red on #16901.
Combined evidence
| Branch | Lane runs | Lane green | pi-title green |
|---|---|---|---|
fork-deletion-only probe (2c5a8c8cd1) |
4 | 3 | 4 / 4 |
this PR (e8a9988b6f) |
4 | 4 | 4 / 4 |
| total | 8 | 7 | 8 / 8 |
Against the pre-fix baseline of 22 pass / 7 fail (76%) across 29 decided runs since #16746 —
where the pi-title fork accounted for 6 of the 7 failures — 8/8 on the spec is not a lucky
green. The single red across all eight lane runs was ssh-cold-hydration-gap-tab-seeding.spec.ts:158
on the probe branch, which #17031 covers and which is untouched here.
Note the asymmetry that makes this meaningful: the retry loop was never the variable. The probe
branch had main's helper verbatim and still passed pi-title 4/4, so the loop's contribution
remains unmeasurable in either direction.
PR's own CI
Everything that runs is green — typecheck, static analysis, all 8 unit shards,
e2e / changed e2e specs, e2e / build e2e app, verify, test vs non-test LoC, both guards.
As documented in the body, e2e / ssh docker watcher isolation reports skipping on this PR:
ssh_source_changed is false for a test-only diff and the lane's if names only two specs by
hand, so the lane this fixes does not run on it. The eight dispatch runs above are the validation
of record. That gating gap is a separate defect and is not fixed here.
Nothing was papered over
Removing the 60s loop made nothing flaky: 0 failures across all four runs at this head, and 4/4 on
the spec across the probe runs that also lacked it. No retry, sleep, or timeout was added anywhere.
Head is e8a9988b6f254e405f7038416adc3c0547133c5f; git ls-remote re-confirmed it after the runs
settled, so nothing moved underneath this. Merging is Brennan's call.
…ai#17017) `ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote` that predates stablyai#11003. Commit a401833 gave `fetchWorktrees` a host-qualified authority gate that short-circuits to `return false` for an SSH host with no complete `directSshAuthority`, and updated the shared `connectDockerSshRelayTarget` helper in the same commit -- but never touched this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)` -> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is empty, `[0]` is undefined, and setup throws `No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the spec reaches a single title assertion. Differential across 5 lane runs (~130 SSH connects): the shared helper's guard errors fired 0 times; `No remote worktree found` fired 3 times, always via the fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher isolation`. The spec now calls the shared helper. Every helper default matches what the fork passed (`relayGracePeriodSeconds: 1`, `remotePath` DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`); the helper additionally uses `target.host` rather than a hardcoded `127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`. No assertion changed; no retry, sleep, or timeout was added anywhere. (cherry picked from commit 774ce22)
…ai#17017) `ssh-pi-compatible-agent-title.spec.ts` kept a private `connectDockerRemote` that predates stablyai#11003. Commit 57d3b79 gave `fetchWorktrees` a host-qualified authority gate that short-circuits to `return false` for an SSH host with no complete `directSshAuthority`, and updated the shared `connectDockerSshRelayTarget` helper in the same commit -- but never touched this spec. The fork still does `fetchRepos()` -> bare `fetchWorktrees(repoId)` -> `worktreesByRepo[repoId][0]`, so the fetch short-circuits, the listing is empty, `[0]` is undefined, and setup throws `No remote worktree found for /tmp/orca-docker-relay-perf-repo` before the spec reaches a single title assertion. Differential across 5 lane runs (~130 SSH connects): the shared helper's guard errors fired 0 times; `No remote worktree found` fired 3 times, always via the fork. The fork accounts for 6 of 7 failures on `e2e / ssh docker watcher isolation`. The spec now calls the shared helper. Every helper default matches what the fork passed (`relayGracePeriodSeconds: 1`, `remotePath` DOCKER_SSH_RELAY_REMOTE_REPO_PATH, `seedInitialTab` true, port `target.port`); the helper additionally uses `target.host` rather than a hardcoded `127.0.0.1`, which is the correct value under `ORCA_E2E_SSH_TARGET_HOST`. No assertion changed; no retry, sleep, or timeout was added anywhere.
What this does
Deletes a stale private
connectDockerRemotefork fromtests/e2e/ssh-pi-compatible-agent-title.spec.tsand calls the sharedconnectDockerSshRelayTargethelper instead. One test file, +2/-75. No production code, nohelper change, no new assertion, and nothing weakened.
The defect
ssh-pi-compatible-agent-title.spec.ts(last touched 2026-07-11) kept a private copy of the connectsequence:
a40183389b(#11003, 2026-07-28) gavefetchWorktreesa host-qualified authority gate. With nodirectSshAuthoritypassed, it depends ongetCurrentDirectSshAuthorityresolving at that instant(
direct-ssh-authority.ts:21-43returnsnullunlessstatus === 'connected'with a completeepoch/generation); when it returns
null,fetch-worktrees.ts:70-77short-circuits tofalseandwrites no authoritative rows. The listing is empty,
[0]isundefined, and setup throwsNo remote worktree found for /tmp/orca-docker-relay-perf-repobefore the spec reaches a singletitle assertion.
The same commit updated
tests/e2e/helpers/docker-ssh-relay-connection.ts(+80) to passdirectSshAuthorityexplicitly — making that short-circuit structurally unreachable there — buttouched this spec zero times. The fork rotted silently, and
the Docker-SSH specs had no CI lane at all until #16746,
so nothing caught it for four weeks.
Differential that pins it
Across 5 lane runs (~130 SSH connects):
connectDockerSshRelayTarget), 26 connects/runNo remote worktree foundThe fork's message has no
:suffix, so it is distinguishable from the shared helper's. It accountsfor 6 of 7 failures on the
e2e / ssh docker watcher isolationlane.The fix is a faithful swap
Every helper default matches what the fork passed explicitly:
relayGracePeriodSeconds: 1options.relayGracePeriodSeconds ?? 1remotePath: DOCKER_SSH_RELAY_REMOTE_REPO_PATHviaProxyJumpis falseseedInitialTab ?? trueport: target.portviaProxyJump ? 22 : target.porthost: '127.0.0.1'(hardcoded)target.host— correct underORCA_E2E_SSH_TARGET_HOSTworktreesByRepo[repoId][0].find(c => c.hostId === executionHostId)— host-qualifiedThe three OMP/Pi title assertions are byte-identical;
git diff -U0shows exactly two added lines(the import and the call).
Why the retry loop is gone
The removed half added a 60s
waitForLiveAuthorityretry loop to the shared helper, justifiedby a "~0.5s post-deploy transport bounce". That premise was refuted
(review, point 1): the
[ssh] Reconnecting … failed handshakes 0/9line is the spec's ownfinallycallingcleanupDockerSshRelayTarget→docker rm -f(docker-ssh-relay-target.ts:287), which deletes thecontainer the transport is connected to. In run
33175867485 the Playwright trace dates
the spec's throw ~0.1s earlier than the drop, and the gap is not fixed at 0.5s — across passing
runs it is 1.4s / 3.4s / 12s / 27s, tracking each spec's body length.
failed handshakes 0/9meansthe transport was healthy until it was deleted. There is no product-side drop.
Three further reasons it should not ride along:
lane four times; the pi-title spec passed in all four.
selectPrE2eSpecsseeds only from/^tests\/e2e\/.*\.spec\.ts$/and every route requires^src/, so atests/e2e/helpers/editroutes zero specs and skips the Docker-SSH lane. The helper has 24 consumer files; a
helper-only diff validates none of them.
tests/playwright.config.ts:22sets a 120sdefault;
ssh-startup-exec-readiness.spec.ts:32setstest.setTimeout(150_000)with notest.slow(). A full 60s burn there replaces the namedNo remote worktree found for X: <reason>with an opaque test timeout, andtests/playwright.config.ts:34setsretries: 0deliberately so first-failure traces stay theonly reliable artifact.
No retry, sleep, or timeout was added anywhere as compensation.
Validation
Docker is dead on the reviewing machine, so the lane was exercised only through
workflow_dispatch— the sole way to reach it (a PR diff of one Docker-gated spec routes to asharded lane that sets no
ORCA_E2E_SSH_DOCKERand self-skips).Fork-deletion-only branch,
e2e / ssh docker watcher isolation:74:7(24.1s) — 18 passed74:7(24.5s) — 18 passed74:7(24.5s) — 17 passed, 1 failed74:7(24.0s) — 18 passed3 of 4 lanes green; the pi-title spec passed 4 of 4. The single red was
ssh-cold-hydration-gap-tab-seeding.spec.ts:158(baseline=3 duringStall=3 afterHydration=0) — aseparate known issue that #17031 covers and that this branch deliberately does not include.
Baseline for comparison: the lane measured 22 pass / 7 fail (76%) across 29 decided runs since
#16746, with pi-title accounting for 6 of the 7 failures.
This PR's head
e8a9988b6f, same lane, four moreworkflow_dispatchruns:74:7(24.8s)74:7(23.5s)74:7(24.8s)74:7(25.2s)4 of 4 green. Combined with the probe branch: 8 lane runs, 7 green, pi-title 8 of 8 — against
a 76% pre-fix baseline where pi-title alone was 6 of 7 failures. The one red across all eight was
the cold-hydration spec #17031 covers.
Gates
pnpm tcexit 0 ·oxlint+ type-aware + React Doctor changed-code gate: 0 new findings ·oxfmt --checkclean ·git diff --checkclean ·typecheck:e2eerror count 208 → 208(red on
mainfor unrelated reasons; this file contributes none — measured in both directions).No suppressions, no
max-linesdisable or bump.Known gap this PR does NOT fix
ssh_source_changedis false for a test-only diff, and the Docker-SSH lane'sifnames onlyssh-startup-exec-readiness.spec.tsandpaired-startup-exec-readiness.spec.tsby hand. Sothis PR's own
e2e / ssh docker watcher isolationcheck will show as skipping — the lane itfixes does not run on it. Fixing the gate means a new
docker_ssh_spec_changedsignal throughpr-e2e-source-routing.mjs→pr.yml→e2e.ymlplus an update topr-e2e-gate-contract.test.mjs:a separate defect for a separate PR.
tests/e2e/ssh-localhost.spec.ts:213has the identical pre-#11003 fork shape — same latentdefect, different lane. Also out of scope here.
Unblocks
#16336, #16901, #16915 and #16926 are each red on this lane and nothing else. Once this lands they
each need
gh pr update-branch(or a new commit) — agh run rerunstays pinned to the originalmerge base and cannot pick this up.