Repository navigation
fix: make in-app UI control work in web and desktop through the server - #4459
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Verification on PR head 553289aPassed — three journey tests, zero failures or skips. Server-boundary tests ran locally; desktop placement was Test evidence — the-in-app-agent-reads-renderer-context-through-openwork-server-and-gets-an-expl — ✅ passed✅ passed · 3 expectations passed · 0 failed · 0 pending [probe] eventually(completed openwork_context tool without a window) · eventually(completed openwork_context tool with a connected window) ℹ️ ASSERTION — 1. Without a polling OpenWork window, the agent receives the server's explicit no-window result and still completes its turnopenwork_context returned context=null and ui.error="No OpenWork window is connected to this server. Open the OpenWork app or its web tab and try again."; the model's reply was "MOCK OK".
ℹ️ ASSERTION — 2. A renderer window's split layout crosses openwork-server into the agent tool result and the model's follow-up requestThe fake window handled one context request; the transcript and provider tool result both contained secondarySessionId=ses_right, and the turn replied "MOCK OK".
ℹ️ ASSERTION — 3. Viewer tokens cannot control the UI, claim pending requests, or forge repliesUnauthenticated calls returned 401, viewer control requests returned 403, viewer poll and forged replies returned 403, invalid kinds returned 400, collaborator replies survived the relay, a second poll was empty, and duplicate replies returned 404.
Test run created 2026-09-04T22:52:04.208Z · Source: Test evidence — new-split-creates-fresh-same-workspace-secondary-sessions-without-moving-the-pri — ✅ passed✅ 0/2 screenshots passed · 2 assertions · 2 expectations passed · 0 failed · 0 pending [world] desktop(daytona) · workspace(/tmp/openwork-new-split-session-1788562454883) · session("New split primary") ℹ️ ASSERTION — 1. Desktop split context reaches the agent through the server mailboxThe server returned ok=true with kind=split, primarySessionId=ses_f915e5845ffe1V5vrBadcIu5SQ, secondarySessionId=ses_f915e4180ffexmIMgU7jdTmPzC, and focused=secondary, all matching the rendered split.
ℹ️ ASSERTION — 2. New splits preserve the primary, and New session replaces only the focused paneContext-menu and command-palette splits each created one distinct same-workspace secondary session. The focused-secondary and focused-primary New session actions each preserved the opposite pane and created exactly one session.
⚪ UNVALIDATED — 3. new-split-creates-fresh-same-workspace-secondary-sessions-without-moving-the-pri artifact 1
⚪ UNVALIDATED — 4. new-split-creates-fresh-same-workspace-secondary-sessions-without-moving-the-pri artifact 2
Test run created 2026-09-04T22:52:46.880Z · Source: Test evidence — each-model-receives-an-attached-pdf-in-the-form-it-can-take-and-the-transcript-k — ✅ passed✅ passed · 3 expectations passed · 0 failed · 0 pending steps 1 ✅ attach report.pdf for the vision model (1.6s) · 2 ✅ attach report.pdf for the text model (0.1s) · 3 ✅ attach report.pdf for the native model (0.1s) · 4 ✅ a text-only model reads on-disk.pdf from disk through the Read tool (0.1s) ℹ️ ASSERTION — 1. Inside the real engine, an image-capable model received page images plus text, a text-only model received text, and a PDF-capable model received the PDF itselfOpenCode 1.18.27 behind openwork-server with its shipped plugins; the provider saw vision=image_url:data:image/png,image_url:data:image/png,image_url:data:image/png,text:note,text:Summarize this. text=text:note,text:Summarize this. native=file:report.pdf,text:Summarize this.; every reply completed and every persisted user message kept its application/pdf part.
ℹ️ ASSERTION — 2. A text-only model that reads a PDF from disk through the Read tool receives its text instead of a PDF it cannot take, and the persisted tool result keeps the original attachmentThe mock model asked the engine to read on-disk.pdf; the follow-up request carried one tool result containing the OpenWork PDF note and no file or image parts, the turn completed, and the transcript's tool part still holds an application/pdf attachment. Every request advertised the openwork_pdf_pages tool.
ℹ️ ASSERTION — 3. Derived text and page images are kept in the workspace inbox for the agent's tools and later steps.opencode/openwork/inbox/pdf-pages holds b2fc86b31300ea96-on-disk and f80d003ffc4116df-report.
Test run created 2026-09-04T22:55:33.661Z · Source: Actual headless web verificationLaunched the final checkout with Additional checks
The final permission regression also proves that viewer tokens cannot submit context/query/command requests, poll the mailbox, or forge a reply. Collaborator tokens continue to work without exposing host credentials in web. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (553289a0a941aaa029ca1d9a718e5392f229ff42). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
The spec proved a pending background open through POST /experimental/ui-control/request, but the server mailbox answers "did not answer within 5 seconds" (#4459) while the step needs the user to switch conversations and approve navigation. Stamp the command with its origin through window.__openworkControl.command instead, which is exactly what the mailbox hands the window, and print the reply when it lacks a result.
…observation (#4744) * test(evals): state that a pending consent tab has no hidden host or viewport A background conversation's browser.open_url allocates a blank consent tab that stays off every native host and unsized until its approved first navigation completes (deferBackground, #4468). The spec asserted the 1280x800 background viewport on that blank tab; assert zero bounds and no hidden window there, and assert the background host geometry once the page holds a document. Also read state through probe.browserState() in the last step, which this world never exposed as readBrowserState. * feat(desktop): observe native context menus in development Native popups have no DOM and no CDP target, so nothing outside the main process can see which entries a right-click offered or deliver a choice. Record each shown template as plain data (ids, labels, enabled, no callbacks) plus the last selection, and expose inspect/choose/dismiss to the app's main frame only when OPENWORK_DEV_MODE=1 and the app is unpackaged. * test(evals): drive the transcript link menu through the native menu seam be5ab61 (#4650) replaced the overlay.html link menu with a native popup, so the spec's overlay target never appears. Read entries and deliver choices through the development seam, keep the negative half (no HTML menu in the app document), and assert Copy Link Address through the recorded selection and the clipboard. * test(evals): issue the background open at the window boundary The spec proved a pending background open through POST /experimental/ui-control/request, but the server mailbox answers "did not answer within 5 seconds" (#4459) while the step needs the user to switch conversations and approve navigation. Stamp the command with its origin through window.__openworkControl.command instead, which is exactly what the mailbox hands the window, and print the reply when it lacks a result. * test(evals): baseline the paused-open comparison after the reading tab re-attaches Switching back to the reading conversation re-attaches its view to the panel asynchronously; snapshotting native state mid-transition made the rejected paused open look like it changed geometry. * test(evals): assert task protection through the panel's disabled Suspend control The panel renders a "Suspend" button that is disabled while a task protects the page (title: Protected until browser work is released) and never sends the request, so the "Suspend tab" click and "protected or busy" toast the step expected could not exist. Assert the disabled control, then that browser.release_tab enables it. * test(testkit): wait for a seeded session's title like sessions() does seed.session fired session.rename and returned; three of five Daytona runs of browser-tabs-owned-by-thread then never saw the new conversation's title in the sidebar (it stayed "New session"). Reuse renameSessionAndWait, which confirms the listed title and retries the rename once. * test(desktop): type the context-menu template fixture against the IPC contract The typecheck:electron step rejected the inspection fixture because the request() helper inferred a narrow item shape from its default argument, so a separator entry could not be passed. Annotate the fixture helpers with the NativeContextMenuItem contract from @openwork/types/desktop-ipc.


In OpenWork Web,
openwork_context, UI queries, and UI commands could not reach the browser because they relied on Electron discovery files. Route in-app tools through an authenticated, short-lived mailbox on openwork-server, answered by the existing control surface in both desktop and web.This removes desktop discovery and implicit user-data fallbacks from the in-app plugin. The external desktop UI MCP bridge remains compatible. Every mailbox route requires collaborator or owner scope: read-only tokens cannot submit work, claim requests, or forge replies. The browser uses its existing client token; host credentials stay out of headless web. Requests expire after five seconds, cancelled polls cannot claim work, and each request is delivered to one polling window. Multiple windows connected to one server use the first polling window; this change does not elect a focused tab.
Verification on this branch:
Agent/server journey: passed, including no-window behavior, model-visible split context, authentication, and single delivery of queries/commands.
Desktop split journey: passed on PR head in Daytona (1 passed, 0 failed, 0 skipped).
Actual headless web: created a split in the browser, verified five server snapshots with both session IDs and secondary focus, queried capabilities, and opened Library through a server command.
Plugin tests: 26 passed. App/server typechecks and packaged server build passed.
PDF attachment model-routing regression: passed on PR head (1 passed, 0 failed, 0 skipped).
All journey evidence is published below for
553289a0a941aaa029ca1d9a718e5392f229ff42. Reproduction:pnpm evals:pr specs/agent-ui-context-via-server.test.ts OPENWORK_EVAL_REF=553289a0a941aaa029ca1d9a718e5392f229ff42 pnpm evals:e2e new-split-session pnpm evals:pr specs/pdf-attachments-model-routing.test.ts pnpm --filter openwork-server test src/opencode-plugins/openwork-extensions-preview.test.ts pnpm typecheck pnpm --filter openwork-server typecheck pnpm --filter openwork-server buildThe E2E runner printed
placement: daytona (daytona CLI authenticated); server-boundary specs ran locally. The implementation and journey verdict is Passed.The optional broad
pnpm evals:typecheckexits 2 with 296 diagnostics on both this PR head and cleanorigin/devat2390c79ee06c2910b34ca3d49341409bce5dd2b9, using Node 24.15.0 and the same installs/build prerequisites. All diagnostic signatures match after normalizing checkout paths and line numbers. First failure on both:apps/server/src/agent-context-cloud-probe.ts(216,15): TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.This check remains red on the base; app/server typechecks and required CI pass.