Skip to content

fix(e2e): fabricate runtime-host health through the snapshot that owns it - #20762

Merged
brennanb2025 merged 4 commits into
mainfrom
brennanb2025/Runtime-host-seed-snapshot
Sep 15, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
brennanb2025/Runtime-host-seed-snapshot

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 15, 2026 •

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

Two E2E specs have been red on main since #20003 landed. Both fail for the same reason, and neither is a product defect — the specs fabricate runtime-host health in a way that stopped working when #20003 moved ownership of that health.

Mechanism

Since #20003 the published snapshot owns runtime-host health. Two consequences the specs predate:

  • setRuntimeEnvironmentStatus (runtime-status.ts:171-173) no-ops a snapshot-less write once a snapshot exists.
  • applyRuntimeHostStatusSnapshot (runtime-status-snapshot.ts) drops any publication whose sequence is not higher than the stored one.

So a bare status seed either never lands, or is overwritten by the host's own status owner — which publishes checking for an unreachable synthetic host as soon as any runtime RPC touches it. The host then reads connecting, and the Add Project dialog falls back to Local.

The two fixes

onboarding.spec.ts:422 — seed a snapshot pinned at the top sequence, so the monotonic guard drops the host's later checking publications.

paired-web-add-project-unavailable-host.spec.ts — the disconnected leg wrote status: null while leaving a verified/ready snapshot in place. addRuntimeHost reads snapshot.transport === 'ready' before it consults status, so the host still rendered Connected. The fabrication now rewrites the snapshot coherently and pins it.

Two details in that second fix are load-bearing and verified in the product code rather than assumed:

  • transport: 'unknown', not 'disconnected' — with verification: 'unavailable', the shared registry falls through to the no-status path and renders Disconnected. An explicit 'disconnected' transport is treated as a reconnecting control channel and renders Connecting (execution-host-registry.ts:167-186).
  • remoteControl: null — runtimeControlHealth answers available on a ready control socket even with a null status (execution-host-registry.ts:91).

Validation

Both fixes ablated individually, each with a syntactically valid revert so the spec actually executes in both arms:

Spec without fix with fix
onboarding.spec.ts:422 fails (16.4s) passes (4.9s)
paired-web-add-project-unavailable-host fails (12.5s) passes (15.7s)

Re-proved at the current head after merging main, since the earlier evidence was against a base 99 commits old.

One trap worth recording: the paired-web file is test.skip'd behind ORCA_E2E_WEB_CLIENT !== '1', so a run without that flag reports 1 skipped and exits 0. My first run looked green and had verified nothing.

Not addressed here: the other specs currently red on main (quick-open-file-paths, terminal-attention, headless-paired-remote-terminal-retention-memory, native-chat-first-flush-race). Unrelated causes.

…rite

Since #20003 the published snapshot owns runtime-host health, so a bare status
seed no longer survives: main's status owner publishes `checking` for this
unreachable synthetic host as soon as any runtime RPC touches it, the host
reads `connecting`, and the Add Project dialog falls back to Local — so the
host-scoped copy the test asserts never renders.

Seed a snapshot pinned at the top sequence instead. applyRuntimeHostStatusSnapshot
drops any later publication whose sequence is not higher, and setRuntimeEnvironmentStatus
no-ops a snapshot-less write once a snapshot exists, so the bare seed could not
have worked either way.

Ablated: passes with the pinned snapshot, fails without it.
…owns it

Companion to the onboarding seed fix. Since #20003 the published snapshot owns
runtime-host health, so writing `status: null` alone leaves the paired-web
client's verified/ready snapshot in place: addRuntimeHost reads
snapshot.transport 'ready' before it ever consults status, and the host still
renders Connected while the test waits for Disconnected.

Rewrite the snapshot coherently instead, pinned at the top sequence so the live
status owner cannot restore the host mid-assertion. The disconnected leg uses
transport 'unknown' rather than 'disconnected', because a dropped transport is
unverifiable and renders as Connecting; only a never-reached host renders
Disconnected. remoteControl is nulled because runtimeControlHealth answers
'available' on a ready control socket even with a null status.

Ablated with ORCA_E2E_WEB_CLIENT=1 (the whole file is test.skip'd without it,
so a run without that flag reports a passing skip): fails without the change,
passes with it.

@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 critical issues — both fixes are correct and the ablation evidence is convincing. Two optional cleanups below.

Reviewed changes

  • onboarding.spec.ts runtime seed — seeds a snapshot pinned at Number.MAX_SAFE_INTEGER with verification: 'verified' / transport: 'ready', arming the monotonic guard in applyRuntimeHostStatusSnapshot against the status owner's later checking publications. I traced the guard (runtime-status-snapshot.ts:20) and the snapshot-less no-op (runtime-status.ts:171); both claims hold, and the pairing-revision check would reject a mismatched publication anyway, so the seed cannot be clobbered.
  • paired-web-add-project-unavailable-host.spec.ts fabrication — rewrites the snapshot coherently for both legs. Verified against execution-host-registry.ts: transport: 'unknown' reaches runtimeHealth(null, null, null) and yields disconnected (whereas 'disconnected' short-circuits to connecting at line 173), and remoteControl: null is load-bearing because a ready control socket would otherwise make runtimeHealth answer available. Both legs can fail without the fix.

️ Nitpicks

  • const verified = current?.status ?? current?.snapshot?.status ?? null is unreachable: the blocked branch throws when current.status is falsy, and the disconnected branch never reads verified. Dropping the fallback keeps the intent clear.
  • Both specs now hand-roll the same snapshot fabrication (pairing revision, MAX_SAFE_INTEGER, checkedAt). A small tests/e2e/helpers seed would keep the #20003 trap from being rediscovered by the next spec.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: 0c4670e6-d0d4-4d9e-8607-4eb29ed71bd2

📥 Commits

Reviewing files that changed from the base of the PR and between e6c7e3a and 52b9f73.

📒 Files selected for processing (1)
  • tests/e2e/paired-web-add-project-unavailable-host.spec.ts

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


📝 Walkthrough

Walkthrough

The onboarding E2E setup now seeds a verified ready snapshot with pairing metadata and Number.MAX_SAFE_INTEGER sequence data. The paired-web helper now writes complete blocked or disconnected snapshots, including verification, transport, sequence, and remoteControl fields. Both tests retain matching top-level runtime status data.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 52b9f

The changes correctly seed the runtime health states required by the affected E2E flows without introducing an identified production or test-suite risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, mechanism, fixes, validation, and scope. However, it omits required template sections, including the linked issue, visual proof or an explicit N/A statement, test… Add the missing template sections. Provide a linked issue after “Fixes #”, add visual proof or state N/A with a reason, complete the testing and checklist items, and address AI disclosure, review, boundary, and notes.
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 1 functions across 2 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 describes the main E2E fix: fabricating runtime-host health through the owning snapshot.
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 explains the problem, mechanism, fixes, validation, and scope. However, it omits required template sections, including the linked issue, visual proof or an explicit N/A statement, testing checklist status, AI disclosure, review, boundary, notes, and checklist.

  • 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

Copy link
Copy Markdown
Contributor Author

Electron UI validation (CDP, hidden renderer)

Attached to Orca: brennanb2025/Runtime-host-seed-snapshot (isDev: true, worktree /Users/brennanbenson/orca/workspaces/orca/Runtime-host-seed-snapshot). Launched with ORCA_BACKGROUND_LAUNCH=1 + CDP 127.0.0.1:9333; did not steal focus.

Replayed the two spec fabrications against the real Add Project dialog:

  1. Onboarding seed (sequence: MAX_SAFE_INTEGER, verified / ready / protocol 3) — host stays E2E Server / Connected, Browse folder is host-scoped (Existing Git repository or folder on this host). Snapshot pin survived the live status owner.

01-add-project-available-host.png

  1. Blocked rewrite (protocol 0 on a ready snapshot) — E2E Server is disabled in the host picker with Update Orca on the server (server protocol 0, client requires 2). Desktop falls back to Local Mac because a local host exists; paired-web has no such fallback.

02-add-project-blocked-host-picker.png

  1. Disconnected rewrite (status: null, verification: unavailable, transport: unknown, remoteControl: null) — E2E Server / Disconnected - Orca server, disabled.

03-add-project-disconnected-host-picker.png

  1. Counterfactual (transport: disconnected instead of unknown) — same host renders Connecting, which is why the spec must not use 'disconnected' for that leg.

04-add-project-connecting-transport-counterfactual.png

Console: 4 errors, all RuntimeRpcCallError: Invalid public key: expected 32 bytes, got 14 against the synthetic wss://e2e.invalid/ws host. No other renderer errors.

No proven visible regression in the two test-only fixes. Remaining gaps: paired-web client was not launched (ORCA_E2E_WEB_CLIENT=1); this profile showed landing Add Project rather than the first-run onboarding overlay; Browse folder was not clicked (native picker).

@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

  • Preserve paired runtime status metadata — setOnlyRuntimeHostHealth now spreads ...current before overriding snapshot, checkedAt, status, and remoteControl, so the fabricated entry keeps appVersion and connectionGeneration instead of dropping them. The override order keeps every faked field authoritative, and addRuntimeHost reads neither preserved field for health (execution-host-registry.ts:153-197), so both legs still render as asserted.
  • Comment correction on the 'unknown' transport — reworded to explain that an unavailable/unknown snapshot falls through runtimeControlHealth to runtimeHealth(null, null, null) → 'disconnected', whereas an explicit 'disconnected' transport short-circuits to 'connecting'. This matches the actual branches at execution-host-registry.ts:167-186.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready to merge

The review/fix loop is clean. Commit 52b9f7314b fixes the meaningful issue found during review: the paired-web fixture now preserves the existing runtime-status metadata when replacing the owning snapshot, so fields such as connection generation and app version cannot be dropped by test setup.

Validation completed:

  • Focused onboarding E2E passed.
  • Focused paired-web E2E passed with ORCA_E2E_WEB_CLIENT=1.
  • GitHub changed-E2E job passed, all eight Node 24 test shards passed, and static analysis, typecheck, E2E build, verify, and Pullfrog passed.
  • Focused runtime-host unit coverage passed (17 tests), pnpm tc passed, the changed-code quality gate passed with zero new findings, and git diff --check passed.
  • Hidden Electron CDP validation ran with ORCA_BACKGROUND_LAUNCH=1; the available, blocked, disconnected, and connecting host states were exercised. Screenshot evidence is attached in the preceding Electron validation comment.

The final diff remains limited to the two requested E2E specs. No production, mobile, RPC, dependency, or performance-sensitive code was changed.

@brennanb2025
brennanb2025 merged commit b5a9946 into main Sep 15, 2026
34 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…s it (stablyai#20762)

* fix(e2e): seed the runtime host with a snapshot the host cannot overwrite

Since stablyai#20003 the published snapshot owns runtime-host health, so a bare status
seed no longer survives: main's status owner publishes `checking` for this
unreachable synthetic host as soon as any runtime RPC touches it, the host
reads `connecting`, and the Add Project dialog falls back to Local — so the
host-scoped copy the test asserts never renders.

Seed a snapshot pinned at the top sequence instead. applyRuntimeHostStatusSnapshot
drops any later publication whose sequence is not higher, and setRuntimeEnvironmentStatus
no-ops a snapshot-less write once a snapshot exists, so the bare seed could not
have worked either way.

Ablated: passes with the pinned snapshot, fails without it.

* fix(e2e): fabricate paired-web host health through the snapshot that owns it

Companion to the onboarding seed fix. Since stablyai#20003 the published snapshot owns
runtime-host health, so writing `status: null` alone leaves the paired-web
client's verified/ready snapshot in place: addRuntimeHost reads
snapshot.transport 'ready' before it ever consults status, and the host still
renders Connected while the test waits for Disconnected.

Rewrite the snapshot coherently instead, pinned at the top sequence so the live
status owner cannot restore the host mid-assertion. The disconnected leg uses
transport 'unknown' rather than 'disconnected', because a dropped transport is
unverifiable and renders as Connecting; only a never-reached host renders
Disconnected. remoteControl is nulled because runtimeControlHealth answers
'available' on a ready control socket even with a null status.

Ablated with ORCA_E2E_WEB_CLIENT=1 (the whole file is test.skip'd without it,
so a run without that flag reports a passing skip): fails without the change,
passes with it.

* test(e2e): preserve paired runtime status metadata
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