Skip to content

test(e2e): wait for the host snapshot to hold the baseline before capturing it - #17138

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/docker-ssh-spec-gate-coverage-r1
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/docker-ssh-spec-gate-coverage-r1

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 29, 2026 •

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

Fixes the ssh-cold-hydration-gap-tab-seeding spec so it captures the host snapshot only once that snapshot actually holds the tabs it is about to replay.

ELI5

The test seeds three terminal tabs on a remote host, saves the copy of the workspace the host wrote down, quits, relaunches, and checks the three tabs come back. The catch: it only waited for the host's file to exist, never for the host to have finished writing the three tabs into it. When it grabbed the file too early it replayed a copy from before the tabs existed — an empty workspace — and the app then did exactly the right thing with an empty authoritative workspace: it replaced the tabs with none. The test reported afterHydration=0 and looked like the product had lost your tabs. It hadn't. The test handed it nothing.

Now the test waits until the host's file actually lists all three tabs before capturing it.

The mechanism

  • The remote upload is detached: use-app-session-persistence.ts fires it off the local session write as void localWrite.then(() => setForConnectedTargets(...)). Nothing the spec can await proves it landed.
  • The spec's pre-capture barrier, flushSessionBeforeQuit, waits on window.api.session.get() — the local write only.
  • waitForUploadedRemoteSnapshot polled ls, i.e. existence, never contents.
  • So closing the app could cut off the final upload, leaving the host file at a revision that predates the three-tab baseline.
  • The relay writes that file atomically (writeFileSync to .tmp + renameSync, workspace-session-handler.ts), so a short capture is always a stale revision, never a torn one. That rules out a partial-write race and leaves exactly one cause.
  • Replaying an empty session then places nothing, so nothing is reported unplaced, so the target hydrates cleanly and the replace-scoped apply writes zero tabs. That is correct behaviour for a genuinely empty host snapshot.

This is not a deadline extension

Nothing was stuck. The upload is a real in-flight operation the spec waited zero time for. The new wait reuses the existing 60 s expect.poll budget — no timeout was raised, no retry added, no assertion weakened. The afterHydration expectation is untouched.

Before / after

Who this affects: anyone whose pull request runs the e2e / ssh docker watcher isolation lane.

Before After
Host snapshot lands before quit Passes Passes, unchanged
Final upload cut off by the quit Fails late on afterHydration=0, reading as a product tab-loss regression, and costs a rerun Waits for the snapshot to hold the baseline, then proceeds
Snapshot never holds the baseline — Fails at the capture, naming the missing baseline

Both tests in the file used the existence-only barrier, so both get the content barrier.

Measured rate

e2e / ssh docker watcher isolation, all attempts enumerated via filter=all (not just the latest, which hides runs re-run to green), 2026-08-27T00:00Z → 2026-08-29T08:40Z, 388 job records / 32 failures:

spec failures
ssh-pi-compatible-agent-title 16
ssh-lost-kill-tab-resurrection 12
ssh-cold-hydration-gap-tab-seeding 5
ssh-startup-exec-readiness 2
ssh-port-forward-lifecycle 2

Four of the five cold-hydration failures are this signature (:158, baseline=3 duringStall=3 afterHydration=0, ~1.1 m each), the most recent at 2026-08-29T07:08Z. The fifth is an older revision of the spec.

The 30 s multiplexer-timeout lead is refuted

ssh-channel-multiplexer.ts does carry a 30 s REQUEST_TIMEOUT_MS, but it is not what happens here. A timed-out workspace.get resolves snapshot to null, which takes the phase: 'offline' early return in remote-workspace-target-sync.ts — no apply, no replace, tabs stay at 3. The observed failure requires a successful apply of an empty snapshot. The absent timeout log line is consistent with that: no timeout occurred.

Not verified locally

Docker is unavailable on the authoring machine, so neither Docker-SSH spec was run here; this rests on the CI record and on source reading. pnpm tc (all projects), oxlint, both focused plugin audits with --deny-warnings, node config/scripts/check-changed-code-quality.mjs (0 new findings across 1 file), the pr-e2e-gate-contract suite (37 passed), and git diff --check are all green. Local load average was 6–9 during those runs.

Supersedes

#17031 diagnosed the same mechanism but asserted the capture after taking it, which renames the failure without removing it. This waits for the precondition instead, so the run passes. #17031 can be closed.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR strengthens two Docker SSH hydration tests by waiting until the relay snapshot contains every seeded tab before continuing.

  • Adds a helper that reads tab IDs from the persisted remote snapshot.
  • Replaces the existence-only polling barrier in both test scenarios with a content-aware baseline check.
  • Retains the existing 60-second polling budget and downstream hydration assertions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
tests/e2e/ssh-cold-hydration-gap-tab-seeding.spec.ts The new polling helper matches the persisted remote-workspace schema and prevents stale snapshots from being captured before seeded tabs arrive.

Reviews (3): Last reviewed commit: "test(e2e): wait for the host snapshot to..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 29, 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: Pro Plus

Run ID: 3a2ff069-3ab9-4450-8190-75629d902816

📥 Commits

Reviewing files that changed from the base of the PR and between 8d3e32a and 8714e43.

📒 Files selected for processing (1)
  • tests/e2e/ssh-cold-hydration-gap-tab-seeding.spec.ts

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


📝 Walkthrough

Walkthrough

The SSH cold-hydration gap tab-seeding tests now parse persisted relay snapshots and extract tab IDs from session.tabsByWorktreePath. They poll until the snapshot contains every seeded tab ID. Both test scenarios use this content-based wait before flushing the session and continuing with relaunch or app closure.

Merge Risk: ⚪ Minimal · up to 8714e

This test-only change waits for the remote snapshot to contain the expected tabs before validating hydration, reducing false failures without changing product behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description gives a detailed technical explanation, testing status, failure analysis, and scope. However, it does not follow the required template structure and omits the required linked issue ent… Add the required template sections and headings. Provide a valid linked issue after "Fixes #". Add the Testing checklist and retain the stated local and CI verification details. Add visual attachments for the behavior change, or write exact…
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: waiting for the host snapshot to contain the baseline before capturing it.
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.
Full details: Description check

Explanation

The description gives a detailed technical explanation, testing status, failure analysis, and scope. However, it does not follow the required template structure and omits the required linked issue entry, explicit Testing section, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. It also provides a before/after table instead of the required visual proof or an explicit N/A statement.

Resolution

Add the required template sections and headings. Provide a valid linked issue after "Fixes #". Add the Testing checklist and retain the stated local and CI verification details. Add visual attachments for the behavior change, or write exactly "N/A" with a brief reason if no visual proof applies. Complete or explicitly mark the AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

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

@brennanb2025
brennanb2025 force-pushed the brennanb2025/docker-ssh-spec-gate-coverage-r1 branch from 0a33e17 to 5f08f81 Compare August 30, 2026 02:01
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing as obsolete: main no longer has the code this PR changes, or already behaves as it intended. The only file it changes, tests/e2e/ssh-cold-hydration-gap-tab-seeding.spec.ts, was deleted by #27214 (ff27338), which removed the relay client

(Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.)

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