Skip to content

fix(app): open activity files and copy image contents - #4716

Merged
reachjalil merged 4 commits into
devfrom
fix/activity-file-actions
Sep 15, 2026
Merged

reachjalil merged 4 commits into
devfrom
fix/activity-file-actions

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Keep activity file actions bound to the exact referenced path, including case, backslashes, and literal workspace directory prefixes. Never substitute a cached suffix match or normalize a network-share prefix into a local path.
  • Preserve workspace previews. Explicit default-app actions on files inside the workspace use the existing native opener, with visible errors. Files outside the workspace are revealed in the file manager and never handed to the shell opener. Remote workspace paths never fall back to the local opener, and automatic preview requests cannot trigger native opening.
  • Add file-chip Open file, Open in default app, and Copy path actions. Add native Copy Image, Copy Image Address, and Copy Link Address actions, including linked images.
  • Copy Chromium's already-decoded image pixels. No image URL fetch, new IPC command, or server filesystem access is introduced.

Review Reconciliation

Addressed JJ9-N5M: relative native targets are checked for empty, dot, and parent components after URL decoding and before joining the workspace root. Both slash styles and encoded separators are covered. Invalid input is rejected rather than normalized into a different file. Safe literal filesystem names remain unchanged; explicit absolute local paths retain the intended outside-workspace action.

The chip also preserves the input path before validation. The former normalization could strip real workspaces/... or workspace/123/... directories and collapse a UNC prefix. Component assertions cover those cases as well as exact opening/copying without a cached-file substitution.

Addressed VLC-7DN: nativeFileAction decides what an explicit native action may do. Only paths contained by the workspace root are passed to openDesktopPath; any other local path, including an absolute path with a dot segment such as /workspace/../x, is routed to revealDesktopItemInDir, which shows the item in the file manager and never launches it. Containment is a comparison only: the literal path handed to the desktop is not rewritten. Remote workspaces and automatic preview requests are unchanged.

Revisions

  • Current head: 23710cd1bdb27cdcf1a2cb1ae6e64825ea96d7bd
  • Dev base: 916c0ba5f31832d7bec2de5618e2dbb9d356e634
  • Previous heads: 00290894550482cf19f2445420753ad30c1647fc (rebase), 7004444f0347d990b7234358d564f8b2d860f9ce on dev dfbd2e0b27f9f975ce669aa567d48df49f782fb2

Rebased onto freshly fetched dev to resolve the merge conflict; merge-base equals that exact base. The fourth commit adds the outside-workspace reveal boundary. All commits above dev carry verified signatures. The branch was updated with an exact expected-head force-with-lease.

Conflict resolution

The only conflict was in apps/desktop/electron/context-menu.mjs. #4744 added dev-mode native popup observation (describeTemplate, findTemplateItem, and inspect/choose on the controller) to the same region where this branch adds contentMenuTemplate and the clipboard dependency for createNativeContextMenus. Both sides are additive and were kept together; no product behavior from either side was changed. main.mjs, preload.mjs, context-menu.test.mjs, and session-page.tsx auto-merged. The merged test file now runs both this branch's content-menu tests and #4744's observation tests.

Testing

Checks below ran on the current head after the rebase:

Check Result
pnpm --filter @openwork/desktop typecheck:electron Exit 0; no diagnostics
node --test apps/desktop/electron/context-menu.test.mjs Exit 0; 10 passed, 0 failed, 0 skipped
pnpm --filter @openwork/app exec bun test --isolate ./tests/resolve-open-target.test.ts ./tests/tool-aggregate-group.test.tsx Exit 0; 43 passed, 0 failed, 0 skipped
pnpm --filter @openwork/app typecheck Exit 0; no diagnostics
git diff --check origin/dev...HEAD Exit 0

The app checks cover traversal/encoding rejection, safe path preservation, exact file-chip targets, workspace resolver behavior, copy-path without opening a file, and the new open/reveal decision: workspace-contained relative and absolute paths (including Windows drive-letter case) open, while /tmp/..., sibling directories, .command/.sh targets, file: URLs outside the workspace, another drive, and /workspace/../... all reveal. The desktop menu checks run on the current head and are unchanged by the final commit. The desktop menu checks cover selection-gated decoded-pixel/address callbacks, existing native menu boundaries, and the dev-mode observation added on dev by #4744.

Earlier CI failure on this branch

An earlier head failed pnpm --filter @openwork/desktop typecheck:electron in build job 103090666303: three TS2339 errors accessed label/click without narrowing the menu-item union, and one TS2345 error omitted the required clipboard fixture dependency. The test(desktop): satisfy native menu type contract commit fixes only context-menu.test.mjs: it narrows the union before accessing menu fields, asserts callable actions, and provides a clipboard fixture that rejects unexpected writes. The same command now exits 0 on the current head. Automatic CI validates the new head.

Not covered

These checks do not exercise the operating system's file launcher, Chromium hit-testing, the system image clipboard, or the full SessionPage remote/local dispatch path. Real Electron file-launch/image-clipboard and remote/local dispatch journeys, and manual security review, have not been run for this change. The existing artifact-code-browser journey covers workspace previews but does not yet assert the native actions or the remote/local fallback boundary added here. No local E2E, cloud provisioning, or manual review run was performed. Normal automatic CI remains unchanged.

Manual Reproduction

  1. In a local workspace, read a PNG at an explicit absolute path outside the workspace. Click its activity filename or choose Open in default app; the exact file should be revealed in the file manager, not launched. A file inside the workspace should open in the system viewer.
  2. Read a previewable file inside the workspace. Its filename should still select the artifact preview; a missing file should report an error.
  3. Use a file under a literal workspaces/photos/ directory. Open and Copy path must retain that directory and the filename's case.
  4. Try relative ../, ./, backslash, and URL-encoded dot-segment targets with Open in default app. They must not reach the native opener. URL schemes and network shares must also be rejected.
  5. Right-click a displayed image, including an image wrapped in a link. Copy Image should paste pixels into an image-capable application. Copy Image Address and Copy Link Address should copy the corresponding address without navigation.
  6. Verify remote workspace files never open a same-named local file, including when server resolution fails.

UI/UX impact: adds file-chip actions (Open file, Open in default app, Copy path) and native image/link copy menu items as described in the Summary. Open in default app on a file outside the workspace now reveals it in the file manager instead of launching it; workspace files, previews, and editing menus behave as before.

No merge or release is included.

@vercel

vercel Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 15, 2026 10:36pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 15, 2026 10:36pm UTC
openwork-diagnostics Skipped Skipped Sep 15, 2026 10:36pm UTC
openwork-landing Skipped Skipped Sep 15, 2026 10:36pm UTC

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (109070 ms), confidentiality-review (123517 ms), desktop-den-sync-review (147481 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 5
  • Distinct heads in retained window: 5
  • Current unresolved Warden threads: 0 of 2 observed
  • Observed resolved/unresolved transitions in retained snapshots: 2 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 2
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 5/20 run attempts retained; truncated: false
  • Transition snapshot: 2/2 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 10, 2026 23:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app September 10, 2026 23:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 10, 2026 23:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 10, 2026 23:48 Inactive
@reachjalil
reachjalil force-pushed the fix/activity-file-actions branch from 848987a to 7004444 Compare September 10, 2026 23:49
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 10, 2026 23:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 10, 2026 23:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 10, 2026 23:49 Inactive
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Passed · 12/12 tests · 18/18 assertions · 8 images

Commit 23710cd1bdb27cdcf1a2cb1ae6e64825ea96d7bd · selected evidence

Open review report

@reachjalil
reachjalil force-pushed the fix/activity-file-actions branch from 7004444 to 0029089 Compare September 15, 2026 22:21
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 15, 2026 22:21 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 15, 2026 22:21 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 15, 2026 22:21 Inactive
diff-warden[bot]
diff-warden Bot previously approved these changes Sep 15, 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 (00290894550482cf19f2445420753ad30c1647fc). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

Explicit native file actions hand only workspace-contained paths to the
default application. Paths outside the workspace root, including absolute
paths with dot segments, are shown in the file manager and never passed to
the shell opener, so a referenced path cannot start a program.

@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 (23710cd1bdb27cdcf1a2cb1ae6e64825ea96d7bd). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil merged commit 4dde431 into dev Sep 15, 2026
29 checks passed

This branch was successfully deployed

1 active and 3 inactive deployments
Preview – openwork-app — 23710cd1 Deployed Sep 15, 2026 by vercel[bot]
Preview – openwork-landing — 23710cd1 Deployed Sep 15, 2026 by vercel[bot]
Preview – openwork-diagnostics — 23710cd1 Deployed Sep 15, 2026 by vercel[bot]
Preview – openwork-den — 23710cd1 Deployed Sep 15, 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