Skip to content

feat(desktop): use native right-click menus - #4650

Merged
reachjalil merged 2 commits into
devfrom
fix/context-editing
Sep 9, 2026
Merged

reachjalil merged 2 commits into
devfrom
fix/context-editing

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Use Electron context menus for OpenWork-owned message, session, Markdown formatting, workspace-file, transcript-link and browser-tab actions on Desktop.
  • Share explicit action definitions with the existing Base UI web menus and sidebar dropdowns. Keep callbacks in their owning renderer; only bounded descriptions and selected IDs cross the typed IPC bridge.
  • Preserve selected-text Copy, standard editing roles, Chromium edit flags and spelling suggestions in ordinary editors. Compose editing roles with Markdown formatting actions.
  • Validate the main-frame sender, reject ambiguous or oversized menus, preserve disabled actions and captured identities, and cancel stale menus without closing a newer popup. Keep browser policy and destination checks in main.
  • Support keyboard context-menu invocation without adding redundant focus stops. Leave ordinary click menus and web presentation unchanged.

Verification

Verdict: Incomplete. The implementation and focused checks are complete, but real native-menu interaction and head-matching journey evidence are not. This is not a merge-readiness claim.

Checked at 21ddb0623383f6ac02f78a55a91c34da3f2ce956, based on canonical dev at 52a028817ec185df72c28d08bc87db90ba7c71a4:

Passed (all exit 0):

  • node --test apps/desktop/electron/context-menu.test.mjs apps/desktop/electron/browser-panel.test.mjs — 62 passed, 0 failed, 0 skipped.
  • corepack pnpm --filter @openwork/app exec bun test --isolate ./tests/action-menu-model.test.ts — 6 passed, 0 failed.
  • corepack pnpm --filter @openwork/app typecheck.
  • corepack pnpm --filter @openwork/app exec tsc --allowJs --checkJs --noEmit --skipLibCheck --target ES2022 --module NodeNext --moduleResolution NodeNext ../desktop/electron/context-menu.mjs.
  • node --check apps/desktop/electron/main.mjs, node --check apps/desktop/electron/preload.mjs, and git diff --check.

Failed setup attempt: the initial browser-panel test invocation could not resolve a workspace dependency before installation. After a frozen-lockfile filtered install, the command passed. No failed assertions remain in the selected checks.

Skipped/deferred:

  • App launch, real native popup/clipboard/focus interaction, and cross-platform validation were not run.
  • Existing browser-tabs-owned-by-thread, new-split-session, cross-workspace-split-view, and session-archive-undo journeys still interact with DOM menus. They must be adapted to a real native-menu driver, then run on this head; their current selectors will not validate the new Desktop presenter. No test-only HTML fallback or direct callback invocation is being counted as OS-level proof.
  • Unused overlay renderer assets are retained for a separate cleanup; browser menus no longer create that overlay view. Third-party embedded-page menus are outside this change.

Manual verification still required

  1. Select part of a transcript message, right-click and Copy; paste elsewhere and confirm only the selection was copied.
  2. Right-click unselected message/session/file targets. Verify the expected actions, submenu disabled states and exact target; Escape must change nothing.
  3. Open via Shift+F10/ContextMenu on an existing focus target, select an action, and confirm focus returns usefully without duplicate menus.
  4. In the composer, check Undo/Redo/Cut/Copy/Paste/Select All and spelling suggestions. In Markdown, verify editing and formatting keep the intended selection.
  5. Open a link or tab menu while the embedded browser is visible. Confirm it is above browser content, copies the exact address, preserves the originating conversation, and respects browser policy.
  6. Dismiss, switch surfaces or unmount an editor while a menu is open; a stale action must not edit a different target. Verify web menus and ordinary sidebar dropdowns remain unchanged.

@vercel

vercel Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Sep 9, 2026 6:12pm UTC
openwork-den Skipped Skipped Sep 9, 2026 6:12pm UTC
openwork-diagnostics Skipped Skipped Sep 9, 2026 6:12pm UTC
openwork-landing Skipped Skipped Sep 9, 2026 6:12pm UTC

@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 8, 2026 22:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 8, 2026 22:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 8, 2026 22:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 8, 2026 22:14 Inactive
diff-warden[bot]
diff-warden Bot previously approved these changes Sep 8, 2026

@diff-warden diff-warden 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (c8efbf029dad34b661f15bbde09fcb8b65323215). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil enabled auto-merge (squash) September 8, 2026 22:15
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 9, 2026 18:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 9, 2026 18:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 9, 2026 18:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 9, 2026 18:12 Inactive
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Passed · 1/1 tests · 2/2 assertions · 0 images

Commit 61e7b810f8f872e8e9d303ac01c95a1e85cfa515 · selected evidence

Open review report

@diff-warden diff-warden 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (61e7b810f8f872e8e9d303ac01c95a1e85cfa515). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil merged commit be5ab61 into dev Sep 9, 2026
35 checks passed
yomgui added a commit that referenced this pull request Sep 10, 2026
…he snapshot-error composer test

apps/app/tests/composer-editable-on-snapshot-error.test.tsx has been red on dev
since #4293 (composer renders WorkspaceRunModeMenu, which reads
DesktopConfigProvider) and #4650 (message list renders ActionContextMenu,
which reads PlatformProvider). Both providers exist at the real app root,
so this is test drift, not a product regression. Mirror the fix already
applied to composer-focus-continuity.test.tsx in #4631 and #4640.
yomgui added a commit that referenced this pull request Sep 11, 2026
…r (missing PlatformProvider / run-mode menu) (#4802)

apps/app/tests/composer-editable-on-snapshot-error.test.tsx has been red on dev
since #4293 (composer renders WorkspaceRunModeMenu, which reads
DesktopConfigProvider) and #4650 (message list renders ActionContextMenu,
which reads PlatformProvider). Both providers exist at the real app root,
so this is test drift, not a product regression. Mirror the fix already
applied to composer-focus-continuity.test.tsx in #4631 and #4640.
yomgui added a commit that referenced this pull request Sep 11, 2026
…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.
benjaminshafii pushed a commit that referenced this pull request Oct 5, 2026
* chore: delete dead code, unused deps and orphaned assets

Remove code that nothing reaches, verified against origin/dev with knip
(new knip.jsonc) plus manual reference checks, including hidden dirs.
Typecheck passes for app, server, desktop, den-api, den-web, landing,
gateway and telemetry; the app builds; app boot and desktop tests pass.

App (apps/app):
- React-port leftovers and orphaned modules: actions store/provider,
  global sync and SDK providers, unused settings, connections and session
  modules, test-only helpers and their scripts.
- Dead exports: unused utils, Advanced sections, migration deferral
  helpers, compactSession, the deprecated signUpEmail stub.
- The unregistered OpenAI image settings state and the never-read
  microsandboxCreateSandbox flag.
- The menu-overlay renderer (native context menus replaced it in #4650),
  unused i18n keys and 192 unused grain-art images.
- Deps: @ai-sdk/react, @radix-ui/colors,
  @radix-ui/react-use-controllable-state, remark-breaks, remark-gfm.

Desktop (apps/desktop) and types:
- 16 renderer-unreachable IPC handlers and their types and re-exports
  (some wrote files), plus 7 unused browser and microphone channels.
- menu-overlay preload, unused dev icons, electron-devtools-installer.

Server (apps/server):
- Unused exports, @types/minimatch, @openwork/headless-threads and the
  opencode-chrome-devtools devDep with its module declaration (the
  bundled openwork-chrome-devtools plugin replaced it in #4423).

Den:
- Orphaned landing components, the den-api plugin-system barrel and
  desktop-policy-role-assignments re-export, a test-only cache hook,
  test helpers and evidence scripts left without tests, and unused deps
  (grammy, drizzle-orm in gateway, zod in telemetry).

Repo:
- apps/ui-demo, Tauri migration scripts, the broken dev-web-local and
  dev-den-local scripts, the den-controller stub and DEN_CONTROLLER_PORT,
  one-off scripts, HANDOFF.md, committed tsbuildinfo files and tracked
  evals/results output, the Remote MCP Apps docs.
- Add knip.jsonc and make scripts/find-unused.sh a thin knip wrapper
  that uses pnpm.

Signed-off-by: Benjamin Shafii <[email protected]>

* chore(app): keep only the artifact helpers production uses

lib/artifacts.ts keeps ArtifactType, getArtifactType and
useOpenArtifactPath; the rest had no production caller and its tests
were already removed.

Signed-off-by: Benjamin Shafii <[email protected]>

---------

Signed-off-by: Benjamin Shafii <[email protected]>

This branch was previously deployed

4 inactive deployments
Preview – openwork-landing — 61e7b810 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-diagnostics — 61e7b810 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-app — 61e7b810 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-den — 61e7b810 Deployed Sep 9, 2026 by vercel[bot]
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