Repository navigation
fix(desktop): correct the preview loopback boundary and pin its boot wiring - #6037
Conversation
…wiring Two follow-ups from the apache#5254 review. The loopback_endpoint boundary said an answer did not prove "that the embedded browser shares this loopback namespace". It does: the embedded browser runs in the Desktop process. What a verified answer does not prove is that, with a remote (SSH) Runtime Host, the listener on the Desktop machine is the server the agent started. Say that instead, and assert it. Desktop boot publishing the preflight in the desktop_artifact_preview offer had no test, so boot could stop wiring it without any test failing. Pin it from source, as main-startup-lifetime.test.ts does for other boot contracts. Refs apache#5254. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Review of 49b68183 (+24/-1, 2 files). Follow-up to #5254; no runtime behavior changes.
Boundary copy (preview-preflight.ts:253). The new wording is more accurate. The embedded browser runs in the Desktop process, so it does share Desktop's loopback. The real gap is the remote Runtime Host case: a listener answering on the Desktop machine need not be the server the agent started there. The updated endpoint test asserts both new phrases.
Boot wiring test. It reads src/main/runtime-host-boot.ts relative to the compiled test (dist/main/__tests__/ → ../../../src/main/), so the path resolves to apps/desktop/src/main/runtime-host-boot.ts in both a local and a CI checkout. It slices out the desktop_artifact_preview offer and checks that it publishes buildArtifactPreviewOfferTools({ preflight: createPreviewPreflightAuthority(), …. This closes the remaining gap from our #5254 review: if boot stopped calling the helper, nothing failed. The author's mutation checks (swapping the authority, restoring the old copy) show both assertions can fail.
Findings: None at P0-P2. One optional P3: the source-text regex depends on the exact tools: buildArtifactPreviewOfferTools({ preflight: createPreviewPreflightAuthority(), layout. A harmless reformat or argument reorder in boot would fail it with a message about wiring rather than formatting. That matches the existing main-startup-lifetime.test.ts approach, so it is acceptable as is.
Status: CI label and test pass, and the PR is MERGEABLE. No protocol files, so there is no epoch impact.
Summary
Two small follow-ups from the #5254 review (preview capability preflight). Neither changes behaviour.
loopback_endpointboundary copy. It said averifiedanswer does not prove "that the embedded browser shares this loopback namespace". But the embedded browser runs in the Desktop process, so it does share Desktop's loopback. What averifiedanswer actually leaves unproven is the remote case: when the Runtime Host runs over SSH (runtime-host-managed-services.ts:54), the listener answering on the Desktop machine need not be the server the agent started. A local service on the same port would also answer. The boundary now says that, and the existing endpoint test asserts it. This matters for feat(harness): verify preview open and page load end to end #5235, which builds on this classification.runtime-host-boot.tspublishes the preflight in thedesktop_artifact_previewoffer viabuildArtifactPreviewOfferTools({ preflight: createPreviewPreflightAuthority(), … }), and no test covered that call. Boot can't be constructed in a unit test, so the new test pins the call from source, the same waymain-startup-lifetime.test.tspins other boot contracts.Refs #5254
Verification
node --test dist/main/__tests__/preview-preflight.test.js: 28/28 pass (the existing 27 plus the new wiring test).createPreviewPreflightAuthority()in boot fails the new wiring test (27/1).biome linton both files: clean.apps/desktop/**is outside Biome's formatter scope.build:mainemits. The remainingtscerrors come only from@maka/uiand@maka/computer-use, which I couldn't build on this host, and none are in the changed files. CI's full typecheck is the authority here.AI use
Select exactly one:
Tool(s) and scope: Claude Code wrote both changes and ran the mutation checks; I reviewed them.
Checklist
Does this PR entail a change in behavior?
🤖 Generated with Claude Code