Skip to content

test(e2e): un-rot the SSH freeze repro and probe two failure modes nothing covered - #17940

Merged
nwparker merged 1 commit into
mainfrom
test/ssh-docker-e2e-repair-and-probes
Sep 2, 2026
Merged

nwparker merged 1 commit into
mainfrom
test/ssh-docker-e2e-repair-and-probes

Conversation

@nwparker

@nwparker nwparker commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Test-only. No production code. Rebased onto current main and squashed into one commit.

The freeze repro was rotted in three ways, not one

#16764 tracks four stale call sites. There were three separate problems, and the third is the interesting one:

  1. Stale call sites — execInTerminal gained a ptyId, splitActiveTerminalPane gained a direction. (startDockerSshRelayTarget's missing testInfo was the third; test(e2e): pass testInfo to startDockerSshRelayTarget in the freeze repro #18257 has since landed that on main, and this branch is rebased past it.)
  2. It connected before session restore settled, so the seeded tab never bound to a remote PTY and the terminal sat on "Connecting…" forever.
  3. It could never have passed, even once. It waited for a one-shot READY: line through a 4000-char terminal window while its own 2 KB-every-8 ms flood buries that line within ~16 ms. The sibling perf spec avoids this by gating its flood on stdin; this one floods immediately. Readiness is now keyed on the repeating BG: marker, which is strictly stronger — it proves the pane is actually streaming rather than merely started.

It now runs end to end against current main instead of dying on a call site:

✓ ssh-docker-bulk-open-freeze-repro.spec.ts › bulk-open many flooding SSH terminals (40.4s)
[freeze-repro R2] hiddenFloodMaxLagMs 2.1  bulkOpenMaxLagMs 41.5
                  interactionProbeMs 53.6  softFreeze false  hardFreeze false

That is what the un-rotting bought. What it does not buy is a gate — see below.

It is still not CI-gateable — so it is now test.fixme

An earlier revision of the runner comment claimed the spec was "repaired and passing", while its own CI lane failed. That contradiction is resolved by making the gating match the comment rather than by softening the comment: the freeze-oracle case is marked test.fixme with a reference to #16764, matching what ssh-docker-transport-drop-recovery.spec.ts already does for two cases. It stays compiled and executable — flipping test.fixme back to test is how every number below was taken.

Three runs of the same measurement path:

host hiddenFlood bulkOpen interaction
developer workstation 2.1 ms 41.5 ms 53.6 ms
GitHub ubuntu runner A 1.5 ms 2575.6 ms 3464.2 ms
GitHub ubuntu runner B 0.2 ms 397.4 ms 3386.7 ms

Two separate problems, and neither is the product.

  • interactionProbeMs is not a freeze measurement at all. It times two setActiveView round trips through a double requestAnimationFrame — a view remount cost. It shares SOFT_FREEZE_LAG_MS with the renderer lag probe only because both are milliseconds, and it sits ~64x over the workstation figure on both runners.
  • bulkOpenMaxLagMs is the test(e2e): ssh-docker-bulk-open-freeze-repro has rotted four call sites out of date and cannot compile #16764 symptom, and on runner B it came in at 397 ms against a 2500 ms budget — the renderer is fine. But it was 2575.6 ms on runner A with the same measurement path, a 6.5x swing between two CI runs. So the good reading is real but not yet load-bearing: one sample does not establish that the renderer is fine on CI hardware, it establishes that it can be.

hardFreeze has never tripped on any host; every failure is the soft budget, and remoteHostStillStreaming was true every time.

Why not a host-relative oracle instead (the other option considered). A ratio against a calibration run is the right shape, but with a 6.5x within-host swing on the very quantity that would be normalized, a threshold picked from three samples is the same arbitrary constant in dimensionless clothing. Gating needs a distribution first. Both the spec comment and run-ssh-docker-e2e.mjs now say this, and the runner file records the resulting coverage gap explicitly — 5 simultaneously flooding SSH panes exercise writer saturation, ACK/credit accounting and per-pane polling together, and nothing else covers that combination.

New: a half-open link is judged, not wedged

The fixture image has no iptables and the container has no NET_ADMIN, so iptables -j DROP was unavailable. docker pause is used instead, which is a harder case: the container's TCP stack keeps ACKing, so there is no FIN and no RST and the socket looks perfectly healthy — only an application-level probe can detect it.

✓ ssh-docker-half-open-link.spec.ts › declares a frozen host lost instead of wedging, and recovers (49.7s)
[half-open] {"verdict":"reconnecting","verdictMs":25135,"budgetMs":90000}

25.1 s to leave connected, then full recovery after unpause. Until now nothing in the suite covered the failure mode behind the "SSH hangs until I restart Orca" reports.

New: resource accumulation measured on the remote host

6 terminals, then 5 reconnect cycles, counted on the container itself:

✓ ssh-docker-resource-accumulation.spec.ts › does not accumulate pts devices, relay fds, or relay processes (27.1s)
open:       pts 1→6 (exactly 1/terminal), relay fds 25→30 (exactly 1/terminal), relay procs 1
reconnect:  pts flat at 6, relay procs flat at 1, node procs flat at 3

leakedMasterFdCount is now asserted, not merely recorded — the CodeRabbit/pullfrog review is addressed rather than deferred. It counts PTY master fds held by non-relay processes: without FD_CLOEXEC a master is inherited by every later child, so terminal k adds k of them. That triangular signature was measured at 15 across 5 terminals when this PR opened, which is why asserting it then would have failed on main.

#17914 and #17920 have both since merged, and #17920 is the half that matters here — it ships the same pty_cloexec() patch to the relay host, which installs node-pty from npm and so was untouched by #17914's pnpm patch. Re-measured against current main:

baseline     leakedMasterFdCount 0
6 terminals  leakedMasterFdCount 0   (master-fd holders: only relay.js, n=6 — no bash child holds one)
reconnects   leakedMasterFdCount 0   across all 5 cycles

So the header's #17914 claim now holds, with #17920 named alongside it. <= rather than slack is deliberate: #17920's relay-side rebuild is non-fatal by construction, so a host where it silently did not take is a real finding this probe should surface.

Routing

Both new probes are now claimed in two places, not one:

  • config/scripts/run-ssh-docker-e2e.mjs — a Docker-gated spec no runner names self-skips everywhere and still reports green.
  • config/scripts/pr-e2e-source-routing.mjs, ssh-terminal-source — so they run when the relay and SSH source they guard changes, rather than only on a scheduled lane.

The runner-list conflict against main was resolved as a union: taking either side alone would have silently dropped ssh-docker-transport-drop-recovery.spec.ts (already on main) or ssh-docker-quick-open-large-listing.spec.ts (added by #17954 today) from the lane, with no conflict marker on the second one.

Verification

$ pnpm tc                                                  # clean
$ pnpm run check:code-quality:changed                      # 0 new findings
$ pnpm test config/scripts/pr-e2e-gate-contract.test.mjs   # 42 passed
$ ORCA_E2E_SSH_DOCKER=1 pnpm exec playwright test \
    tests/e2e/ssh-docker-bulk-open-freeze-repro.spec.ts \
    tests/e2e/ssh-docker-half-open-link.spec.ts \
    tests/e2e/ssh-docker-resource-accumulation.spec.ts     # 3 passed

Refs #16764, #17914, #17920, #18257


ELI5

Three Docker-SSH tests. One was broken in a way that meant it had literally never run; it runs now, and the comment saying why it still can't gate CI is now accurate instead of optimistic. The other two are new: one freezes the remote host to prove Orca notices instead of hanging, and one counts file descriptors and terminals on the remote host to prove reconnecting doesn't leak them.

User-facing regression risk

None. Test-only; no production code changed.

Visual Proof

N/A — test-only change, no UI surface.

Testing

  • Typecheck (pnpm tc)
  • Changed-code quality gate
  • E2E gate contract (pr-e2e-gate-contract.test.mjs, 42 passed)
  • Both new Docker SSH probes pass locally and on CI; the freeze repro runs end to end when its test.fixme is lifted (output above)
  • Platforms: macOS host, node:22-bookworm + openssh-server container (linux/arm64).

@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: aa70e3bc-4dd7-4b5e-a0da-fdf55f154afd

📥 Commits

Reviewing files that changed from the base of the PR and between 59303c7e4a9714b067a1e3bb8043faf4b762ce43 and a632c3d.

📒 Files selected for processing (2)
  • config/scripts/run-ssh-docker-e2e.mjs
  • tests/e2e/ssh-docker-bulk-open-freeze-repro.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/scripts/run-ssh-docker-e2e.mjs

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


📝 Walkthrough

Walkthrough

The Docker SSH E2E suite now waits for restored session and terminal readiness before running the bulk-open freeze test. Its flood-readiness check uses the repeating BG: marker. The test is marked test.fixme because its wall-clock oracle varies across CI runs. A new test detects half-open SSH links after pausing a Docker container, then verifies recovery. Another test measures resource counts across terminal creation and reconnect cycles. The E2E runner and source-routing configuration include both new tests.

Merge Risk: 🔵 Low · up to a632c

This test-only PR adds and repairs Docker SSH coverage without changing product behavior. A recovery test may fail to complete on slow runs because its timeout is shorter than its sequential wait budget; the PR is otherwise mergeable with explicit owner awareness and follow-up.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 summarizes the main changes: repairing the SSH freeze reproduction and adding probes for previously uncovered failure modes.
Description check ✅ Passed The description is detailed and on-topic. It explains the changes, rationale, linked issues, test behavior, visual-proof status, verification results, and regression risk. Some template headings and c…
Full details: Description check

Explanation

The description is detailed and on-topic. It explains the changes, rationale, linked issues, test behavior, visual-proof status, verification results, and regression risk. Some template headings and checklist items are omitted, but the required information is substantially present.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 017a0950-ad60-444d-8275-5f89eccaf1bc

📥 Commits

Reviewing files that changed from the base of the PR and between 26dfa46 and da69854.

📒 Files selected for processing (4)
  • config/scripts/run-ssh-docker-e2e.mjs
  • tests/e2e/ssh-docker-bulk-open-freeze-repro.spec.ts
  • tests/e2e/ssh-docker-half-open-link.spec.ts
  • tests/e2e/ssh-docker-resource-accumulation.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Test-only Docker-SSH E2E work: repairs the rotted bulk-open freeze repro and adds two new probes — one for half-open link detection, one for remote-host resource accumulation.

  • run-ssh-docker-e2e.mjs — claims the two new specs in the Docker SSH lane and rewrites the freeze-repro exclusion comment to reflect that only its perf-oracle nature keeps it out of CI.
  • ssh-docker-bulk-open-freeze-repro.spec.ts — fixes the four stale call sites, connects after session restore settles, and keys readiness on the repeating BG: flood marker through an 80k-char read window.
  • ssh-docker-half-open-link.spec.ts (new) — freezes the relay container with docker pause and asserts the client leaves connected within 90s, then recovers and echoes after thaw.
  • ssh-docker-resource-accumulation.spec.ts (new) — samples remote pts devices, relay fds, and process counts across six terminals and five reconnect cycles, asserting no accumulation.

ℹ️ FD_CLOEXEC leak is made visible but not gated

leakedMasterFdCount is computed and included in every logged sample, but no assertion reads it, so a regression in the close-on-exec fix would leave this spec green and surface only in console output. This reads as intentional — #17914 is not landed yet and asserting 0 would fail on main — but the describe header's "Covers … #17914" slightly overstates what is actually gated.

Technical details
# FD_CLOEXEC leak: measurement vs gate

## Affected sites
- tests/e2e/ssh-docker-resource-accumulation.spec.ts:87 — `leakedMasterFdCount` sampled into every `RemoteResourceSample` and logged, never asserted
- tests/e2e/ssh-docker-resource-accumulation.spec.ts:5-7 — describe header claims the spec "covers" #17914

## Required outcome
- None required to merge. Optional follow-up once #17914 lands: add an assertion (e.g. `expect(withTerminals.leakedMasterFdCount).toBe(0)`), or soften the header wording from "covers" to "measures" until then.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker

nwparker commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Both new specs pass locally — and the resource-accumulation one reproduces the fd leak deterministically

Ran against a combined branch carrying this sweep's fixes, with a real node:22-bookworm + openssh-server container:

✓ ssh-docker-half-open-link.spec.ts › declares a frozen host lost instead of wedging, and recovers (45.3s)
   [half-open] {"verdict":"reconnecting","verdictMs":25125,"budgetMs":90000}
✓ ssh-docker-resource-accumulation.spec.ts › does not accumulate pts devices, relay fds, or relay processes (25.4s)
  2 passed (1.3m)

So the e2e / changed e2e specs failure on this PR looks environmental rather than a real spec failure. Worth a re-run.

The resource-accumulation spec is more valuable than its title suggests

Its own output is a clean, deterministic reproduction of the pty-master fd leak that #17920 fixes — in 25 seconds, in a container, instead of on a production host:

baseline    : leakedMasterFdCount = 0
5 terminals : leakedMasterFdCount = 15

master-fd holders:
  937  n=1   /bin/bash --rcfile …/shell-ready/bash/rcfile
  1058 n=2   /bin/bash …
  1180 n=3   /bin/bash …
  1306 n=4   /bin/bash …
  1438 n=5   /bin/bash …
  310  n=6   node relay.js --detached …

1+2+3+4+5 = 15. That is exactly the triangular-growth signature: child k inherits the k masters that were open at its spawn instant. It matches the live openclaw measurement (355 masters, with identical fd numbers appearing across separate processes) — but here it is reproducible on demand.

And the reconnect series stays flat at 21 across five reconnects, which pins down where the leak comes from: it accumulates on spawn, not on reconnect.

Suggested follow-up

This gives #17920 a deterministic validation vehicle that the production census cannot: with the cloexec patch applied, leakedMasterFdCount should drop to ~0 while relayFdCount stays put. Worth adding that assertion here once #17920 lands, so the fix is guarded rather than just measured.

Note the spec currently records leakedMasterFdCount without asserting a bound on it — the assertions are on pts devices, relay fds and relay processes. That is the right call today (it would fail on main), but it means the most diagnostic number in the output is unguarded.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@nwparker nwparker changed the title test(e2e): un-rot the freeze repro, and probe half-open links and resource accumulation test(e2e): un-rot the SSH freeze repro and probe two failure modes nothing covered Sep 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: c7bee99a-3081-40ed-a2cf-aa123c729430

📥 Commits

Reviewing files that changed from the base of the PR and between 7f8eb90 and 59303c7e4a9714b067a1e3bb8043faf4b762ce43.

📒 Files selected for processing (5)
  • config/scripts/pr-e2e-source-routing.mjs
  • config/scripts/run-ssh-docker-e2e.mjs
  • tests/e2e/ssh-docker-bulk-open-freeze-repro.spec.ts
  • tests/e2e/ssh-docker-half-open-link.spec.ts
  • tests/e2e/ssh-docker-resource-accumulation.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • config/scripts/run-ssh-docker-e2e.mjs
  • tests/e2e/ssh-docker-resource-accumulation.spec.ts
  • tests/e2e/ssh-docker-bulk-open-freeze-repro.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

orcaPage,
registerPostElectronShutdownCleanup
}, testInfo) => {
test.setTimeout(420_000)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

printf '%s\n' '--- repository conventions ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- target file outline ---'
ast-grep outline tests/e2e/ssh-docker-half-open-link.spec.ts
printf '%s\n' '--- target file ---'
cat -n tests/e2e/ssh-docker-half-open-link.spec.ts

Repository: stablyai/orca

Length of output: 8784


🏁 Script executed:

printf '%s\n' '--- applicable convention and learning headers ---'
for f in /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/*/*.md; do
  case "$f" in
    */learnings/*|*/architecture/*) ;;
    *) printf '\n### %s\n' "$f"; head -40 "$f" ;;
  esac
done
printf '%s\n' '--- relevant changes ---'
git diff -- tests/e2e/ssh-docker-half-open-link.spec.ts
printf '%s\n' '--- timeout and wait bindings ---'
rg -n -C 3 'setTimeout|waitForTimeout|expect\\.|test\\.' tests/e2e/ssh-docker-half-open-link.spec.ts

Repository: stablyai/orca

Length of output: 4477


🏁 Script executed:

printf '%s\n' '--- directly bound helper implementations ---'
rg -n -C 8 'function (ensureTerminalVisible|waitForActiveTerminalManager|waitForActivePanePtyId|waitForTerminalOutput|waitForSessionReady|waitForActiveWorktree)|const (ensureTerminalVisible|waitForActiveTerminalManager|waitForActivePanePtyId|waitForTerminalOutput|waitForSessionReady|waitForActiveWorktree)|async function (ensureTerminalVisible|waitForActiveTerminalManager|waitForActivePanePtyId|waitForTerminalOutput|waitForSessionReady|waitForActiveWorktree)' tests/e2e/helpers
printf '%s\n' '--- Playwright timeout configuration ---'
rg -n -C 5 'timeout:|setTimeout\\(|expect:|testDir|defineConfig' playwright.config.* package.json tests/e2e

Repository: stablyai/orca

Length of output: 9444


🏁 Script executed:

printf '%s\n' '--- helper timeout contracts ---'
sed -n '140,185p' tests/e2e/helpers/store.ts
sed -n '260,292p' tests/e2e/helpers/store.ts
sed -n '60,96p' tests/e2e/helpers/terminal.ts
sed -n '64,90p' tests/e2e/helpers/terminal-pane-operations.ts
sed -n '195,216p' tests/e2e/helpers/terminal-pane-operations.ts
printf '%s\n' '--- test runner version and timeout settings ---'
rg -n -C 4 'playwright|setTimeout|timeout:' package.json package-lock.json pnpm-lock.yaml yarn.lock playwright.config.ts playwright.config.js tests/e2e 2>/dev/null || true

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

printf '%s\n' '--- runner configuration files ---'
git ls-files | grep -E '(^|/)(package(-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|playwright\.config\.(ts|js))$'
printf '%s\n' '--- relevant timeout settings ---'
for f in package.json tests/playwright.config.ts tests/playwright.config.js playwright.config.ts playwright.config.js; do
  if [ -f "$f" ]; then
    printf '\n### %s\n' "$f"
    rg -n -C 3 'playwright|timeout|defineConfig|testDir' "$f"
  fi
done
printf '%s\n' '--- exact helper declarations and timeout bodies ---'
sed -n '145,182p' tests/e2e/helpers/store.ts
sed -n '266,289p' tests/e2e/helpers/store.ts
sed -n '64,92p' tests/e2e/helpers/terminal.ts
sed -n '64,88p' tests/e2e/helpers/terminal-pane-operations.ts
sed -n '201,213p' tests/e2e/helpers/terminal-pane-operations.ts

Repository: stablyai/orca

Length of output: 12838


Align the test timeout with the nested wait budgets.

The 420,000 ms timeout applies to the whole test, but its sequential explicit waits total 585,000 ms. A slow run can time out before recovery completes. Increase the timeout to cover these waits plus setup, connection, and Docker command time, or reduce the wait budgets.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the increment since the prior review (da69854 → 59303c7), a squashed rebase that closes the one open concern and wires the new specs into routing.

  • Gated the FD_CLOEXEC leak — leakedMasterFdCount went from measured-only to asserted in two places: withTerminals <= baseline after the six-terminal open, and last <= first across reconnect cycles. The growth-vs-baseline shape is now sound because both #17914 and #17920 have landed, so post-fix both sides are 0 while a missing relay rebuild fails loudly.
  • Claimed the specs in pr-e2e-source-routing.mjs — added ssh-docker-half-open-link and ssh-docker-resource-accumulation to the ssh-terminal-source route, matching the existing Docker-gated entries in that list.
  • Rewrote the freeze-repro exclusion comment — now excludes it purely on wall-clock-oracle non-portability (workstation vs GitHub-runner lag spanning orders of magnitude), with the stale rot rationale removed.

The prior review's ~ℹ️~ "measured but not gated" note and the header-wording suggestion are both resolved: the assertions gate the leak and the header now reads #17914 / #17920 with accurate "covers" wording.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

…thing covered

Test-only. No production code.

## The freeze repro was rotted in three ways, not one

#16764 tracks four stale call sites. There were three separate problems:

1. **Stale call sites** — `execInTerminal` gained a `ptyId` and
   `splitActiveTerminalPane` gained a direction. (`startDockerSshRelayTarget`'s
   missing `testInfo` was the third; #18257 has since landed it on main.)
2. **It connected before session restore settled**, so the seeded tab never bound
   to a remote PTY and the terminal sat on "Connecting…" forever.
3. **It could never have passed, even once.** It waited for a one-shot `READY:`
   line through a 4000-char terminal window while its own 2 KB-every-8 ms flood
   buries that line within ~16 ms. Readiness is now keyed on the repeating `BG:`
   flood marker, which is strictly stronger — it proves the pane is streaming
   rather than merely started.

It now runs end to end and prints a measurement instead of dying on a call site:

```
[freeze-repro R2] hiddenFloodMaxLagMs 2.1  bulkOpenMaxLagMs 41.5
                  interactionProbeMs 53.6  softFreeze false  hardFreeze false
```

**It is still not CI-gateable, and the exclusion comment now says so.** The same
spec on the same commit measured `bulkOpen 2575.6ms / interaction 3464.2ms` on a
GitHub ubuntu runner against a 2500 ms soft budget — a ~60x spread on the number
the budget reads, with the relay still streaming. That is the budget failing, not
the product. The earlier draft of this comment claimed "repaired and passing",
which was true only of the host it was measured on; gating this needs a
host-relative oracle, not a bigger constant.

## New: a half-open link is judged, not wedged

The fixture image has no `iptables` and the container has no `NET_ADMIN`, so
`docker pause` is used instead — a harder case, because the container's TCP stack
keeps ACKing: no FIN, no RST, and the socket looks perfectly healthy. Only an
application-level probe can detect it.

```
[half-open] {"verdict":"reconnecting","verdictMs":25135,"budgetMs":90000}
```

Nothing in the suite covered the failure mode behind the "SSH hangs until I
restart Orca" reports.

## New: resource accumulation measured on the remote host

6 terminals, then 5 reconnect cycles, counted on the container itself:

```
open:       pts 1->6 (exactly 1/terminal), relay fds 25->30 (exactly 1/terminal)
reconnect:  pts flat at 6, relay procs flat at 1, node procs flat at 3
```

`leakedMasterFdCount` is now **asserted**, not merely recorded. It counts PTY
master fds held by non-relay processes: without `FD_CLOEXEC` a master is inherited
by every later child, so terminal k adds k of them — the triangular signature
measured as 15 across 5 terminals before the fix. #17914 patched the app and
daemon and #17920 shipped the same patch to the relay host, and both are now on
main, so the correct value is 0 and the probe holds it there:

```
baseline    leakedMasterFdCount 0
6 terminals leakedMasterFdCount 0    (holders: only relay.js, n=6)
reconnects  leakedMasterFdCount 0 across all 5 cycles
```

Any growth here means the relay's node-pty rebuild did not take on that host,
which is exactly what a remote-host probe exists to catch — and it is the half of
#17914's claim that no unit test can reach.

## Routing

Both new probes are claimed by `run-ssh-docker-e2e.mjs` (a Docker-gated spec no
runner names self-skips everywhere and still reports green) **and** by the
`ssh-terminal-source` route in `pr-e2e-source-routing.mjs`, so they run when the
relay and SSH code they guard changes rather than only on a scheduled lane.
@nwparker
nwparker force-pushed the test/ssh-docker-e2e-repair-and-probes branch from 59303c7 to a632c3d Compare September 2, 2026 22:51
@nwparker

nwparker commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Gating now matches the comment: the freeze-oracle case is test.fixme

Took option (1). Option (2) is cheap to write and not cheap to justify — detail below.

test.fixme with a reference to #16764, matching the two existing cases in ssh-docker-transport-drop-recovery.spec.ts. Verified it no longer gates:

-  1 [electron-headless] › ssh-docker-bulk-open-freeze-repro.spec.ts:81:8 › bulk-open many flooding SSH terminals
   1 skipped

The un-rotting is untouched and the body still compiles; flipping test.fixme back to test runs it, which is how every number below was taken.

One correction to the reading, and it matters

renderer lag is 397ms — well inside the 2500ms budget … the product looks fine; the interaction probe is what isn't portable.

Half right, and the half that isn't is the more important one. I pulled the measurement from both CI runs:

host hiddenFlood bulkOpen interaction
developer workstation 2.1 ms 41.5 ms 53.6 ms
GitHub ubuntu runner A 1.5 ms 2575.6 ms 3464.2 ms
GitHub ubuntu runner B 0.2 ms 397.4 ms 3386.7 ms

interactionProbeMs is not a freeze measurement at all — that part is confirmed and is worse than "unportable". It times two setActiveView round trips through a double rAF, i.e. a view remount cost, and it shares SOFT_FREEZE_LAG_MS with the renderer lag probe only because both happen to be milliseconds. It is stably ~64x the workstation figure on both runners. It was never the #16764 symptom.

But bulkOpenMaxLagMs swings 6.5x between the two CI runs of the same measurement path — 2575.6 ms on runner A, 397.4 ms on runner B. So "the renderer is fine on CI hardware" is true of runner B and false of runner A. One sample establishes that the renderer can be fine, not that it is. I've written it that way in the PR body rather than the stronger claim, because the stronger claim is exactly the kind of thing that gets a spec re-enabled and then rots again.

hardFreeze has never tripped on any host; every failure is the soft budget, with remoteHostStillStreaming: true each time.

Why not (2)

A ratio against a calibration run is the right shape. But the quantity you would normalize is bulkOpenMaxLagMs, and it moves 6.5x within the same host class — so a ratio threshold picked from three samples is the same arbitrary constant in dimensionless clothing, and it would fail on runner A exactly as the fixed one did. Gating needs a distribution first. Both the spec comment and run-ssh-docker-e2e.mjs now say that, so the next person does not re-derive it.

Recorded, not hidden

run-ssh-docker-e2e.mjs now marks this a COVERAGE GAP in the same style the file already uses for ssh-docker-relay-perf — 5 simultaneously flooding SSH panes exercise writer saturation, ACK/credit accounting and per-pane polling together, and nothing else covers that combination. The comment also notes the spec is both absent from the lane list and skipped, so the changed-specs lane cannot re-introduce the contradiction by selecting it on edit.

Preserved as asked

  • leakedMasterFdCount asserted in both phases (withTerminals <= baseline, last <= first) — unchanged.
  • Both probes still registered in pr-e2e-source-routing.mjs under ssh-terminal-source — unchanged.

Both new probes pass on CI hardware (half-open 50.7s, resource-accumulation 34.2s), so the two specs this PR adds are portable; only the pre-existing oracle is not.

Rebase note

main moved again mid-change — #17870 landed while I was editing. Rebased onto 510305e5743 before pushing; without it this branch would have reverted #17870 wholesale. Re-verified after the rebase that the runner list gained only the two new probes and dropped nothing (ssh-docker-transport-drop-recovery and ssh-docker-quick-open-large-listing both still present). pnpm tc clean, gate contract 42 passed, changed-code gate 0 findings.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the increment since the prior Pullfrog review (59303c7 → a632c3d), which turns the un-rotted freeze repro into a test.fixme case so its non-portable wall-clock oracle cannot gate CI.

  • Marked the freeze repro test.fixme — ssh-docker-bulk-open-freeze-repro.spec.ts declares the bulk-open case with test.fixme and an inline // Fixme: rationale, matching the existing pattern in ssh-docker-transport-drop-recovery.spec.ts. It stays compiled and flip-back-runnable, but is skipped rather than failing CI on host speed.
  • Aligned the runner exclusion with the skip — the run-ssh-docker-e2e.mjs comment now documents both that the spec is absent from the Docker lane and skipped, records the 6.5x bulkOpen swing across two CI runs and the view-remount nature of interactionProbeMs, and names the resulting coverage gap (5 simultaneous flooding SSH panes).

The skip-claim the comment makes is accurate: pr-e2e-source-routing.mjs still selects the spec directly whenever its own file is edited, and test.fixme skips it there too, so the exclusion in the runner list and the skip cannot drift apart.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 6cd477a into main Sep 2, 2026
32 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…thing covered (stablyai#17940)

Test-only. No production code.

## The freeze repro was rotted in three ways, not one

stablyai#16764 tracks four stale call sites. There were three separate problems:

1. **Stale call sites** — `execInTerminal` gained a `ptyId` and
   `splitActiveTerminalPane` gained a direction. (`startDockerSshRelayTarget`'s
   missing `testInfo` was the third; stablyai#18257 has since landed it on main.)
2. **It connected before session restore settled**, so the seeded tab never bound
   to a remote PTY and the terminal sat on "Connecting…" forever.
3. **It could never have passed, even once.** It waited for a one-shot `READY:`
   line through a 4000-char terminal window while its own 2 KB-every-8 ms flood
   buries that line within ~16 ms. Readiness is now keyed on the repeating `BG:`
   flood marker, which is strictly stronger — it proves the pane is streaming
   rather than merely started.

It now runs end to end and prints a measurement instead of dying on a call site:

```
[freeze-repro R2] hiddenFloodMaxLagMs 2.1  bulkOpenMaxLagMs 41.5
                  interactionProbeMs 53.6  softFreeze false  hardFreeze false
```

**It is still not CI-gateable, and the exclusion comment now says so.** The same
spec on the same commit measured `bulkOpen 2575.6ms / interaction 3464.2ms` on a
GitHub ubuntu runner against a 2500 ms soft budget — a ~60x spread on the number
the budget reads, with the relay still streaming. That is the budget failing, not
the product. The earlier draft of this comment claimed "repaired and passing",
which was true only of the host it was measured on; gating this needs a
host-relative oracle, not a bigger constant.

## New: a half-open link is judged, not wedged

The fixture image has no `iptables` and the container has no `NET_ADMIN`, so
`docker pause` is used instead — a harder case, because the container's TCP stack
keeps ACKing: no FIN, no RST, and the socket looks perfectly healthy. Only an
application-level probe can detect it.

```
[half-open] {"verdict":"reconnecting","verdictMs":25135,"budgetMs":90000}
```

Nothing in the suite covered the failure mode behind the "SSH hangs until I
restart Orca" reports.

## New: resource accumulation measured on the remote host

6 terminals, then 5 reconnect cycles, counted on the container itself:

```
open:       pts 1->6 (exactly 1/terminal), relay fds 25->30 (exactly 1/terminal)
reconnect:  pts flat at 6, relay procs flat at 1, node procs flat at 3
```

`leakedMasterFdCount` is now **asserted**, not merely recorded. It counts PTY
master fds held by non-relay processes: without `FD_CLOEXEC` a master is inherited
by every later child, so terminal k adds k of them — the triangular signature
measured as 15 across 5 terminals before the fix. stablyai#17914 patched the app and
daemon and stablyai#17920 shipped the same patch to the relay host, and both are now on
main, so the correct value is 0 and the probe holds it there:

```
baseline    leakedMasterFdCount 0
6 terminals leakedMasterFdCount 0    (holders: only relay.js, n=6)
reconnects  leakedMasterFdCount 0 across all 5 cycles
```

Any growth here means the relay's node-pty rebuild did not take on that host,
which is exactly what a remote-host probe exists to catch — and it is the half of
stablyai#17914's claim that no unit test can reach.

## Routing

Both new probes are claimed by `run-ssh-docker-e2e.mjs` (a Docker-gated spec no
runner names self-skips everywhere and still reports green) **and** by the
`ssh-terminal-source` route in `pr-e2e-source-routing.mjs`, so they run when the
relay and SSH code they guard changes rather than only on a scheduled lane.
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