Skip to content

fix(dashboard): offer the file manager only where the host has one - #23019

Merged
KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
rubencu:fix/path-chip-reveal-says-what-it-does
Nov 1, 2026
Merged

KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
rubencu:fix/path-chip-reveal-says-what-it-does

Conversation

@rubencu

@rubencu rubencu commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On a gateway host that has no file manager to open, the dashboard stops offering "Show in file manager" and "Open with default app", and a reveal that still ends in a copy says so instead of passing for the action.

A path chip's right-click menu offers "Show in file manager" in a dashboard opened from a laptop browser against a remote headless Linux gateway, reached through an ssh -L tunnel. Choosing it opens nothing; the path lands on the clipboard and the menu's second row flips to "Path copied" with a check mark, so the row reads as if it were wired to Copy. A folder named in a user message shows exactly that two-row menu.

Why it matters

Viewing a gateway on a remote Linux machine through an SSH tunnel is a common way to run the dashboard. Every reveal and open there could only copy, so the menu offered actions that can never work on that host and then acknowledged the copy as if the user had chosen Copy. It reads as broken wiring and teaches people not to trust the menu's labels.

Not a goal

What changed (motivation → approach → change)

Reproduced on main 3d6cda4, with synthetic paths under /tmp and /home/user/project, on a headless Linux host (no /usr/bin/xdg-open, no DISPLAY or WAYLAND_DISPLAY):

Setup branding.direct_local POST /api/reveal (reveal, then open) What the SPA did
(a) browser on the gateway host, 127.0.0.1 (what an ssh -L tunnel looks like) true 200 {"ok": true, "copy": "<path>"}, SEL success offered "Show in file manager" (and "Open with default app" on a file), copied, flipped the Copy row to "Path copied"
(b) non-local client (X-Forwarded-For set) false 200 {"ok": true, "copy": "<path>"}, SEL denied / remote_request already hid both rows

Server rows: the real api_branding and api_reveal_path handlers in-process, with the real locality check and launcher. UI rows: the real built SPA with /api/** answered the same way (website/scripts/capture-reveal-headless-host.mjs). The row made exactly one /api/reveal call with action: "reveal", so nothing was mis-wired.

Root cause. The native rows were gated on directLocal alone. That says the request came from loopback, not that the host can open a file manager; origin.py documents that an ssh -L peer is indistinguishable from a local browser. On a host with no launcher every reveal and open could only degrade to a clipboard copy, which the menu acknowledged with the Copy row's own "Path copied".

Change.

  1. desktop_launcher_available() (platform_compat_trust.py, re-exported by platform_compat.py) says whether this host can open a file manager right now: the launcher the hand-offs start is present (/usr/bin/open, C:\Windows\explorer.exe, /usr/bin/xdg-open), and on Linux the gateway's own environment names a desktop session (DISPLAY or WAYLAND_DISPLAY). No request input decides it. reveal_in_file_manager and open_with_default_app ask it before spawning, so the dashboard and a click cannot drift: a Linux host with no session gets the copy answer a host with no launcher gets. The spawn lines (literal absolute launchers, the path as an argv element, no shell), the sensitive-path check, .. rejection and the direct-local gate are unchanged.
  2. GET /api/dashboard/branding adds desktop_launcher, read in a worker thread, behind the dashboard token gate as before. api/client/themes.ts types it; useBranding.tsx exposes it as desktopLauncher, false when absent.
  3. useCanReveal() (directLocal && desktopLauncher) and useCanOpenFile() are the one SPA gate, read by every reveal/open surface: the path-chip and breadcrumb menu, both file overflows, the folder and project panel buttons, the deck viewer and the Office card. On a host that can't open a file manager they look as they already do for a remote viewer: in-app rows where wired, plus Copy path or Download. That is the convention FilePathMenu.tsx documents for a remote viewer, a Windows open and a directory open (hide a native row that can never perform); those gates and "Open in side panel" are unchanged.
  4. A path chip's Shift+click where no reveal can land copies the path (without its :line) in the browser and confirms "Copied!", as Ctrl/Cmd+click does, instead of asking the gateway for a reveal that could only come back as a copy. Its hover hint says "Shift+click to copy path" there.
  5. When a copy answer still arrives (a launcher present but failing to start), revealOrOpen writes it and says so in the caller's notice: "Couldn’t open this path on the machine running Kiro Crew, so it was copied instead." If the write fails too, it reports the plain reveal_failed wording. Nothing relabels Copy or Open as "Path copied", and revealOrOpen drops the { copied, copyFailed } flags that relabel used.
  6. New key components.filePathMenu.reveal_copied_instead in locales/en.json and all 11 translations, en-XA.json regenerated. Specs: learn-cron-dashboard.md, side.md, platform-compat.md.

Backwards compatibility

Compatible: nothing is renamed or removed from the wire. /api/reveal keeps its checks and answer shapes. On a Linux host with no desktop session it gives its copy answer instead of starting xdg-open with no session to open into. desktop_launcher is a new branding field the SPA reads as false when absent.

The diff hides controls on one host shape (direct-local, but unable to open a file manager) and drops a return value, so the readers:

Reader: website/src/components/FilePathMenu.tsx:FilePathMenuItems -- chat -- FilePathMenu.test.tsx "a direct-local session whose gateway host has no desktop launcher"; FilePathMenu.inApp.test.tsx "a direct-local session on a host with no desktop launcher keeps only the in-app rows and Copy path"
Reader: website/src/components/FilePathMenu.tsx:useCopyAck (the only reader of revealOrOpen's removed flags) -- chat -- FilePathMenu.test.tsx "a reveal or open the host could only answer with a copy"
Reader: website/src/components/markdown/InlineCode.tsx:InlineCode -- chat -- MarkdownRenderer.contextmenu.test.tsx "on a direct-local session whose gateway host has no desktop launcher"
Reader: website/src/components/MarkdownPanelHeader.tsx:OverflowMenu -- chat -- MarkdownPanel.test.tsx "hides both desktop hand-off entries when the gateway host has no desktop launcher"
Reader: website/src/components/FileRenderers.tsx:OfficeViewer -- chat -- FileRenderers.test.tsx "hides Open on a direct-local session whose gateway host has no desktop launcher"
Reader: website/src/pages/chat/FolderPanel.tsx:FolderPanel -- chat -- FolderPanel.test.tsx "hides the reveal button when the gateway host has no desktop launcher"
Reader: website/src/pages/chat/FilesHomePanel.tsx:FilesHomePanel -- chat -- FilesHomePanel.test.tsx "hides the reveal action when the gateway host has no desktop launcher"
Reader: website/src/apps/file-explorer/FileViewer.tsx:FileViewer -- app -- FileExplorerPageCoverage.test.tsx "FileExplorerPage reveal"
Reader: website/src/apps/pptx-maker/DeckViewer.tsx:DeckViewer -- app -- PptxDeckViewerCov80.test.tsx "hides the reveal action when the gateway host has no desktop launcher"
Reader: website/src/pages/chat/ChatPageMessageContent.tsx:DirChip -- chat -- routes Shift+click through revealOrOpen, which names a copy instead of making it silently; ChatPageW3Coverage.test.tsx
Reader: src/kiro_crew/dashboard/file_api/desktop.py:api_reveal_path -- chat -- a launcher that declines, as both do on a Linux host with no desktop session, gets the copy answer it always got; test_reveal_path.py "test_reveal_local_headless_returns_no_desktop_copy"

Tests

The production hunks were reverted under the new tests: 17 backend and 21 frontend cases went red, and all went green again once the hunks were restored. Every case below is one of them, except the guard marked as such.

Proof: not provable -- other: prove.py stops at "corrupt patch" because its production diff carries this PR's six screenshot PNGs as raw bytes, so the hunks were reverted by hand as above

A host that can't open a file manager hides both rows:

  • test/test_reveal_in_file_manager.py: desktop_launcher_available checks exactly the launcher each platform spawns; on Linux it also needs DISPLAY or WAYLAND_DISPLAY, and macOS needs neither; with no launcher, or no session, neither hand-off spawns.
  • test/test_dashboard_branding.py: branding reports desktop_launcher from the host, and false for a Linux host with xdg-open but no session.
  • FilePathMenu.test.tsx: no native rows there, for a file and for a directory (the reported two-row menu is now ["Copy path"]); FilePathMenu.inApp.test.tsx keeps the in-app rows.
  • MarkdownRenderer.contextmenu.test.tsx: a directory chip menu offers only Copy path; the hover promises a copy; Shift+click copies the path without its line, asks the gateway nothing, and confirms "Copied!".
  • FileRenderers.test.tsx, MarkdownPanel.test.tsx, FolderPanel.test.tsx, FilesHomePanel.test.tsx, PptxDeckViewerCov80.test.tsx, FileExplorerPageCoverage.test.tsx: each surface hides its control there.

A host that can open one shows them:

  • useBrandingDirectLocal.test.tsx: desktop_launcher maps through, and absent or not yet loaded reads as false.
  • FilePathMenu.test.tsx "keeps both native rows on a direct-local host that can open a file manager". This is the guard against hiding too much; it passes on main too.
  • Existing mocks state the host's launcher beside directLocal, so the desktop cases keep exercising the rows.

A launch that fails says so in plain words:

  • FilePathMenu.test.tsx: a copy answer to a reveal or an open is named in the notice and leaves the Copy row alone; a failed write reports the plain failure; a reveal that opened says nothing.
  • apiRevealPath.test.ts: revealOrOpen writes and reports a copy answer, and reports the plain failure when the write fails.
  • MarkdownPanel.test.tsx, FileExplorerPageCoverage.test.tsx and FileRenderers.test.tsx: the two overflows and the Office card name a copy answer in place.

Manual verification

  • Ran the real handlers in-process on 127.0.0.1 on this headless host for setups (a) and (b), with the results in the table above. On the same host with this branch, desktop_launcher_available() answers False with no session and with DISPLAY=:0 (no xdg-open installed), and reveal_in_file_manager spawns nothing.
  • Captured the menu with website/scripts/capture-reveal-headless-host.mjs, using the real built SPA on a loopback static server (ephemeral port, closed after each run) with /api/** answered as the handler answers. I ran it once against the main build and three times against this branch (SCENARIO=headless, launch-failed, desktop). With a launcher present and working, the menu, the click and the clipboard are unchanged from main.
  • Gate floor: the prepare-PR profile's gates[], the repo semgrep rules plus CI's registry packs (diff-scoped, 0 new findings), npm run i18n:check with a base ref. Every gate passes except the backend related-tests gate, whose failures on this host fail the same way on main.

Screenshots / video

All data is synthetic. Committed under temp-screenshots/reveal-headless-host/ (fork PR).

Before (main, headless direct-local host), the folder chip in a user message, then the same menu after choosing "Show in file manager":

main: the two-row menu
main: after the click the Copy row reads Path copied

After, same host: the user-message folder chip, then a folder chip in the assistant reply, whose bubble wires the side panel:

fix: Copy path only
fix: Open in side panel and Copy path

A host whose launcher fails to start, and a desktop host (unchanged)

fix: the notice says the path was copied instead
fix: a desktop host keeps Show in file manager

Related Issues

Related: #9411 (closed by #19121, which added the in-app rows), #22857 and #11338 (remote file actions), #15600 (a Files-pane preview's chip hint).

Sibling sweep

Swept: git grep -nE "directLocal|isLocal\b|revealPath|/api/reveal" -- website/src, and git grep -nE "reveal_in_file_manager|open_with_default_app" -- src
Sibling: website/src/components/FilePathMenu.tsx:174 -- changed here
Sibling: src/kiro_crew/platform_compat_trust.py:810 -- changed here
Sibling: website/src/components/library/LibraryTable.tsx:593 -- tracked in #11338
Sibling: website/src/pages/chat/FilesHomePanel.tsx:101 -- not affected -- a failed external-terminal launch shows the side panel's fallback note and opens the in-app terminal
Sibling: website/src/pages/settings/DisplayPanel.tsx:357 -- not affected -- it only turns on the same external-terminal launch, which has that fallback
Sibling: website/src/components/CrashReportNotice.tsx:63 -- not affected -- the desktop shell reveals its own crash folder; a plain browser has no bridge, so the action is absent

Pattern harvest

Rule candidate: review-prompt
Pattern: a UI control whose backend can only fall back to a different action is gated on who is asking (directLocal) but not on whether the host can perform it, and it acknowledges the fallback with another control's own confirmation.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@rubencu
rubencu requested review from a team and KiroCrewCaptain as code owners October 22, 2026 04:20
@rubencu
rubencu requested a review from bolichen97 October 22, 2026 04:20
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 61788327bf9c5fd768d18d64fa74d150f2cf1085 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level blocker: the reveal gate now sits on a host fact the launcher also checks, so the menu and the click give the same answer.

Notes

  • On Linux, desktop_launcher_available requires DISPLAY or WAYLAND_DISPLAY in the gateway's own environment. The user unit that service/linux_unit.py installs sets DBUS_SESSION_BUS_ADDRESS but not DISPLAY, and it starts at default.target, often before the graphical session imports DISPLAY. On a Linux desktop running the installed service, the change then hides reveal/open and stops xdg-open from being spawned. Before, xdg-open → gio could still reach a D-Bus-activated file manager. Check this on a GNOME or KDE desktop with the service installed. If it fails, also accept the session bus or XDG_SESSION_TYPE as proof of a session.
  • The ## Backwards compatibility reader list runs past the description's truncation point, so I judged it only as far as the cut.

[DESIGN-REVIEWED] 6178832

Description read

[DESCRIPTION-READ] 39383233620d5d44bdc67d57461e81ae555a4a20d1fce0456a2dda628048ff9f

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of 61788327bf9c5fd768d18d64fa74d150f2cf1085 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing the new Shift+click copy state and the Office card's new launch-failure notice. No supplied screenshot shows either one. The context-menu changes are shown, but no first-time reader has seen them, because this fork lane has no blind read.

Evidence gaps

  • Path chip Shift+click on a host with no desktop launcher (InlineCode.tsx: if (e.shiftKey && !canReveal) { shiftCopy.press(...) }, plus title={pathCopy.copied || shiftCopy.copied ? 'Copied!' ...}). Shift+click now copies in the browser and the chip's title switches to "Copied!". No image shows the hover hint "Shift+click to copy path" on a direct-local headless host, or the "Copied!" state afterwards. Close it with a screenshot of the hint and one of the confirmation.
  • Office card Open when the launcher fails to start (FileRenderers.tsx). The Open button no longer changes its label to "Path copied". Instead, revealError shows a notice above the Open / Download buttons. attachment-04 shows this notice only inside the context menu, not on the card. Close it with a screenshot of the card showing the "…so it was copied instead." notice.

Notes

  • attachment-04: the notice for "copied instead" uses the red error style and adds an "Ask the agent" row, even though the path is on the clipboard and nothing needs fixing. A neutral or info style would fit better than an alarm the user can't act on.

[UX-REVIEWED] 6178832

Description read

[DESCRIPTION-READ] 427092dcd11e2781ad0fd73b74b7f2c885096a3a2d77317ce943fca5f6fec6ed

That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 61788327bf9c5fd768d18d64fa74d150f2cf1085 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6178832

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 61788327bf9c5fd768d18d64fa74d150f2cf1085 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The changes stay within the Goal and fix the cause: the reveal gate now asks whether the host can open a file manager, not just whether the browser is local. One platform premise is unconfirmed.

Notes

  • Item 1 — inherited: "off macOS and Windows it must also have a desktop session … DISPLAY or WAYLAND_DISPLAY" is unconfirmed for a gateway running as a systemd user service on a desktop Linux host. If that service's environment has no display variable, the reveal that used to work there now stops at both the rows and the spawn. Subtraction: remove the env check from the reveal_in_file_manager/open_with_default_app spawn guard and keep it only in the dashboard answer, so a host the check misjudges still gets a working click.
  • Item 1 — duplicate of an existing predicate: DISPLAY or WAYLAND_DISPLAY already appears at 4 sites (cloud/login.py:1202, cloud/connect.py:506, apps/routes_enable.py:706, slack/gateway_runtime/service_boot.py:1348), and this is a 5th copy. Subtraction: none in scope. The existing copies also check BROWSER/SSH, so they are not the same predicate.

What this change ships

Inventory (9 items) — 7 justified

Intent: stop offering native file-manager actions on a gateway host that cannot open one, and say so when a reveal can only copy. FIX.

  1. On Linux without a display session, the gateway no longer spawns xdg-open and answers with a copy instead — inherited (display premise unconfirmed, see Notes)
  2. GET /api/dashboard/branding gains a desktop_launcher boolean — justified
  3. "Show in file manager" and "Open with default app" are hidden on a direct-local but headless host, across 8 surfaces — justified
  4. Shift+click on a path chip copies the path in the browser where no reveal can land, and the hover hint says so — justified
  5. A reveal that ends in a copy now shows a "copied instead" notice — justified
  6. The Copy row and the Office card's Open button no longer flip to "Path copied" after a reveal or open — justified
  7. New i18n key reveal_copied_instead in all 12 locales — justified
  8. New capture-reveal-headless-host.mjs harness, plus 6 committed screenshots (allowed by the fork exception in .gitignore) — justified
  9. The macOS/Windows launcher-presence checks move into the shared desktop_launcher_available — undeclared (refactor, no harm)

[FIRST-PRINCIPLES-REVIEWED] 6178832

Description read

[DESCRIPTION-READ] 672dbd4850676e84447ac5b982909fb7f967747c1966d35917f1e55e95116702

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings (all downgraded on adjudication)

Reviewed 61788327bf9c5fd768d18d64fa74d150f2cf1085 via the fork AI-review pipeline; updated in place on each push.

Opus 5.5 adjudication downgraded every blocking finding. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

Review details

BLOCKING -- website/src/components/markdown/InlineCode.tsx:717 -- Separate copy states preserve success after the latest copy fails

title={pathCopy.copied || shiftCopy.copied
Trigger: On a remote/headless dashboard, successfully Ctrl/Cmd-click a path chip ending in :12, then Shift-click it and have the clipboard write fail before the 1.5-second success flash expires. act dispatches these gestures to separate useTitleCuedCopy instances.
Outcome: The chip still reports “Copied!” while displaying the second attempt’s failure bubble; the clipboard retains the line-suffixed text rather than the requested path. useCopiedFlash updates only its own state, and its shared attempt counter does not clear an already-settled success in the other instance.
Anchor: defect
Fix: Share one copy-feedback state between both gestures, passing the raw or resolved text into the same copy attempt.

[BLOCK-MERGE-DOWNGRADED] 6178832
[GPT-REVIEWED] 6178832

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — LOW harm. Every condition checks out. The two chips each call useTitleCuedCopy, so each has its own useCopiedFlash state (patch InlineCode.tsx hunk lines 1142/1148). The check at website/src/components/markdown/copyFeedback.tsx:111 only drops results from that one instance's older attempts, so a "Copied!" that has already settled in pathCopy stays up (:113-117). Meanwhile shiftCopy's failure sets its own state. The failure also needs a clipboard write to fail on the same chip less than 1.5 s after one succeeded.

Recovery: the stale "Copied!" clears itself when the COPIED_FLASH_MS timer runs out (copyFeedback.tsx:57,114-117). The failure is still announced through CopyFailedNotice's role="alert" bubble (:166-178). So the user sees a mixed message for at most 1.5 s, which then corrects itself, and they can simply copy again.

The real fix costs more than that. It means merging the two instances into one shared state whose press takes a text and failure message per call. That changes the API of a hook the session and broken-image chips also use, or adds a coordination mechanism used only by this pair of gestures.

[ADJUDICATION] 61788327bf9c5fd768d18d64fa74d150f2cf1085 total=1 uphold=0 downgrade=1
DOWNGRADE F1 website/src/components/markdown/InlineCode.tsx:717 reason=disproportionate-remedy
[GPT-ADJUDICATED] 61788327bf9c5fd768d18d64fa74d150f2cf1085

@bolichen97 bolichen97 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.

I reviewed head d9aa504 and found nothing to change.

What I checked:

  • desktop_launcher_available tests the same literal launcher each platform spawned before, in the same platform order. Both hand-offs now return False through it before any spawn. The spawn argv, the sensitive path check and every /api/reveal answer are unchanged.
  • GET /api/dashboard/branding stays behind the dashboard token gate. The new field is a stat of a fixed system path, run in a worker thread.
  • Every surface that gated reveal on directLocal alone now reads useCanReveal. useCanOpenFile builds on it, so Windows still hides Open and keeps Reveal.
  • revealOrOpen lost its return flags. Its only reader was useCopyAck, which the diff updates.
  • I ran test/test_reveal_in_file_manager.py, test/test_dashboard_branding.py, test/test_platform_compat_refactor_facade.py and test/test_dashboard_handlers_core_coverage.py at this head: 718 passed.

Not approving yet. These maintainer checks remain: the readiness label is still checking, several backend and E2E jobs are pending, and the Opus 5.5 review job ended without a verdict for this commit. The change also spans more than 20 files, so a maintainer gives the final approval.

One behavior note, not a blocker: with no in-app opener wired (for example a path chip in a user message), a plain click on a remote or launcher-less session still asks the gateway for a reveal. It now shows the "copied instead" notice where it used to copy silently. The notice is accurate. If you prefer that click to copy in the browser, as Shift+click now does, that can be a follow-up.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 22, 2026
@rubencu
rubencu force-pushed the fix/path-chip-reveal-says-what-it-does branch from d9aa504 to 94e4b8b Compare October 22, 2026 05:23
@rubencu

rubencu commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Two ## Not a goal bullets changed in the description. The design call on hiding vs disabling came back as hide, and it defined the host fact as "this host can open a file manager right now". On Linux that needs a desktop session (DISPLAY or WAYLAND_DISPLAY) as well as xdg-open.

  • Withdrawn: "Detecting a host that has xdg-open installed but no desktop session to show a window on. The rows still show there, as on main." That detection is now part of this PR, and the rows are hidden on such a host.
  • Narrowed: "Changing what /api/reveal decides or answers, ..." now reads "Changing /api/reveal's own checks or the shape of its answers, ...". Both launchers ask the same fact before spawning, so the dashboard and a click can't drift. On a Linux host with no desktop session, /api/reveal gives the copy answer it already gives a host with no launcher, instead of starting xdg-open with no session to open into. Its checks and answer shapes are unchanged.

The Goal line, ## Why it matters and the other ## Not a goal bullets are unchanged.

@bolichen97 bolichen97 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.

Thanks for the follow up push. I read the change since my last pass: the new Linux desktop session check in desktop_launcher_available (DISPLAY or WAYLAND_DISPLAY), the matching early return in both launchers, the reworded docs and comments, and the new tests.

The new check is sound. _reveal_env copies the gateway's own environment and only pins PATH, so the variable this reads is the same one xdg-open would inherit, and the branding answer and the click still agree. macOS and Windows paths are unchanged. Locally, with no display variable set, test/test_reveal_in_file_manager.py and test/test_dashboard_branding.py pass on this head.

One thing blocks merge, and it is small: the new autouse fixture in test/test_reveal_in_file_manager.py requests the shared monkeypatch. The repo rule against that shape is blocking, and the required SAST (Semgrep) check fails on this exact line with test-autouse-shared-monkeypatch. The GPT lane raised the same point. Details and a two line fix are inline.

Once that lands and the remaining checks finish, this looks good to me. Approval stays with a maintainer because the PR touches more than 20 files.

Reviewed head: 94e4b8b

Comment thread test/test_reveal_in_file_manager.py Outdated

class TestRevealInFileManager:
@pytest.fixture(autouse=True)
def _a_desktop_session(self, monkeypatch: pytest.MonkeyPatch) -> None:

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.

The new autouse fixture patches through the shared monkeypatch, which the repo forbids and Semgrep now fails on.

_a_desktop_session is autouse and takes monkeypatch, the same instance each test in the class receives. Any test that later calls monkeypatch.undo() would also drop this fixture's DISPLAY pin, and the Linux tests would then read whatever the runner has. That is the shape the D11 rule in AUTOSDE.yaml (item 12, newly added autouse fixture requesting the shared monkeypatch) marks as blocking, and the required SAST (Semgrep) check fails here with semgrep.kirocrew.test-autouse-shared-monkeypatch.

@pytest.fixture(autouse=True)
def _a_desktop_session(self, monkeypatch: pytest.MonkeyPatch) -> None:
    monkeypatch.setenv("DISPLAY", ":0")
    monkeypatch.delenv("WAYLAND_DISPLAY", raising=False)

Suggestion: request the floor's own instance for the fixture. The monkeypatch override in conftest.py is ordered after _floor_monkeypatch, so the per test setenv and delenv calls in this class still override it and are undone first.

@pytest.fixture(autouse=True)
def _a_desktop_session(self, _floor_monkeypatch: pytest.MonkeyPatch) -> None:
    _floor_monkeypatch.setenv("DISPLAY", ":0")
    _floor_monkeypatch.delenv("WAYLAND_DISPLAY", raising=False)

Rule: tests are deterministic (D11, autouse fixtures use _floor_monkeypatch).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2044101: _a_desktop_session now requests _floor_monkeypatch and patches through it, as you suggested. The per-test monkeypatch calls in this class still override it and unwind first. Semgrep with the CI configs reports 0 findings against the rebased base. test/test_reveal_in_file_manager.py, test/test_dashboard_branding.py and test/test_host_isolation_floor.py pass locally.

@rubencu
rubencu force-pushed the fix/path-chip-reveal-says-what-it-does branch from 94e4b8b to 2044101 Compare October 22, 2026 06:56
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 22, 2026

@bolichen97 bolichen97 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.

Thanks for the quick fix. I read the change since my last pass on 94e4b8b: apart from the rebase onto main, the only change in the PR content is the autouse fixture in test/test_reveal_in_file_manager.py, which now requests _floor_monkeypatch for both the DISPLAY pin and the WAYLAND_DISPLAY removal. That resolves the point I raised last time, and the per test monkeypatch overrides in the class still unwind first because the monkeypatch override in conftest.py depends on _floor_monkeypatch.

What I verified on this head:

  • The required SAST (Semgrep) check passes; the test-autouse-shared-monkeypatch failure is gone.
  • With no display variable set, test/test_reveal_in_file_manager.py and test/test_dashboard_branding.py pass locally (43 passed).
  • The previous GPT lane blocking finding was about this same fixture and no longer applies. The GPT lane run on this head ended as review incomplete, so its sticky comment still shows the older head; a rerun should clear it.

Still open before merge: the GPT lane rerun, the Opus lane on this head, and the lint, type check and desktop build jobs that are still running. The code itself looks good to me. Approval stays with a maintainer because the PR touches more than 20 files.

Reviewed head: 2044101

@rubencu

rubencu commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Could a maintainer re-run these two on 2044101? Both failed on infrastructure, not on the diff.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 24, 2026
@rubencu
rubencu force-pushed the fix/path-chip-reveal-says-what-it-does branch from 2044101 to 1999cc6 Compare October 29, 2026 02:01
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Oct 29, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 29, 2026
A browser behind an ssh -L tunnel reaches the gateway as direct-local,
so a path chip's menu offered "Show in file manager" even when the
gateway host was a headless Linux box. There /api/reveal can only
answer the clipboard fallback, and the menu then flipped its Copy row
to "Path copied", so the reveal row read as if it were wired to Copy.

The branding payload now reports desktop_launcher: whether this host
can open a file manager right now, meaning its launcher is present and,
on Linux, the gateway's own environment names a display server. The
reveal and open launchers ask the same function, and every reveal/open
surface gates on it beside direct_local. A path chip's Shift+click
copies the path where no reveal can land, as its hint says. When a copy
still comes back (a launcher that did not start), revealOrOpen writes
it and says so in the caller's notice instead of passing it off as the
action.
@bolichen97
bolichen97 force-pushed the fix/path-chip-reveal-says-what-it-does branch from 1999cc6 to 6178832 Compare October 30, 2026 06:33
@bolichen97

Copy link
Copy Markdown
Contributor

A maintainer rebased this branch onto current main as 6178832 and resolved the one conflict, in open_with_default_app in platform_compat_trust.py. Main added wait_for_exit, which keeps the launcher process; this PR moved the per-launcher file checks into desktop_launcher_available(). The merged code keeps both: the early availability check, then proc = subprocess.Popen(...) on each branch. No other change: range-diff against 1999cc6 differs only in that hunk. The reveal and launcher tests pass locally; the few failures I saw also fail on main in my environment.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 30, 2026

@bolichen97 bolichen97 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.

Reviewed at 6178832.

This head is a rebase onto current main. I compared it with the head I last reviewed: the change's own hunks are the same, and only context lines moved where main had edited the same doc paragraphs and the open_with_default_app signature (wait_for_exit). The rebase keeps main's version of both.

I read every changed hunk at this head:

  • desktop_launcher_available checks only fixed system paths (/usr/bin/open, C:\Windows\explorer.exe, /usr/bin/xdg-open) and, on Linux, DISPLAY or WAYLAND_DISPLAY. Both launchers call it first, so the menu and the click give the same answer. The spawned command lines and _reveal_env are unchanged.
  • /api/dashboard/branding adds one boolean, computed in a worker thread. No request input decides it.
  • The front end gates every reveal and open surface on useCanReveal. A copy made in place of an open is now reported through the error notice instead of the Copy row's label. Shift+click on a chip that cannot reveal copies the path without its line suffix, as the hint says.
  • Tests, locale strings, specs and screenshots match the code.

Security checklist at this head: auth/authz no change; no new input parsing; no trust boundary widened (the server side direct-local gate on /api/reveal is unchanged, and the new flag only hides actions); no sandbox change; no approval gate change; no secret handling. The change can only make the reveal refuse more often, never less.

Good to ship. All AI review lanes pass on this head. 54 files, every hunk read. I will approve once the remaining Backend Tests shards and PR Readiness finish green on this head.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 30, 2026

@bolichen97 bolichen97 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.

Approving at 6178832.

This head is a rebase onto current main. I compared it with the head I last reviewed: the change's own hunks are the same, and only context lines moved where main had edited the same doc paragraphs and the open_with_default_app signature (wait_for_exit). The doc paragraphs keep main's text; in open_with_default_app the resolution keeps both main's wait_for_exit and this PR's early desktop_launcher_available() check.

I read every changed hunk at this head:

  • desktop_launcher_available checks only fixed system paths (/usr/bin/open, C:\Windows\explorer.exe, /usr/bin/xdg-open) and, on Linux, DISPLAY or WAYLAND_DISPLAY. Both launchers call it first, so the menu and the click give the same answer. The spawned command lines and _reveal_env are unchanged.
  • /api/dashboard/branding adds one boolean, computed in a worker thread. No request input decides it.
  • The front end gates every reveal and open surface on useCanReveal. A copy made in place of an open is now reported through the error notice instead of the Copy row's label. Shift+click on a chip that cannot reveal copies the path without its line suffix, as the hint says.
  • Tests, locale strings, specs and screenshots match the code.

Security checklist at this head: auth/authz no change; no new input parsing; no trust boundary widened (the server side direct-local gate on /api/reveal is unchanged, and the new flag only hides actions); no sandbox change; no approval gate change; no secret handling. The change can only make the reveal refuse more often, never less.

All AI review lanes pass on this head, and CI and readiness are green. 54 files, every hunk read.

@bolichen97
bolichen97 enabled auto-merge (squash) October 30, 2026 08:04

@bolichen97 bolichen97 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.

Approving at 6178832.

This head is a rebase onto current main. I compared it with the head I last reviewed: the change's own hunks are the same, and only context lines moved where main had edited the same doc paragraphs and the open_with_default_app signature (wait_for_exit). The rebase keeps main's version of both.

I read every changed hunk at this head:

  • desktop_launcher_available checks only fixed system paths (/usr/bin/open, C:\Windows\explorer.exe, /usr/bin/xdg-open) and, on Linux, DISPLAY or WAYLAND_DISPLAY. Both launchers call it first, so the menu and the click give the same answer. The spawned command lines and _reveal_env are unchanged.
  • /api/dashboard/branding adds one boolean, computed in a worker thread. No request input decides it.
  • The front end gates every reveal and open surface on useCanReveal. A copy made in place of an open is now reported through the error notice instead of the Copy row's label. Shift+click on a chip that cannot reveal copies the path without its line suffix, as the hint says.
  • Tests, locale strings, specs and screenshots match the code.

Security checklist at this head: auth/authz no change; no new input parsing; no trust boundary widened (the server side direct-local gate on /api/reveal is unchanged, and the new flag only hides actions); no sandbox change; no approval gate change; no secret handling. The change can only make the reveal refuse more often, never less.

All AI review lanes pass on this head, and CI and readiness are green. 54 files, every hunk read.

@bolichen97 bolichen97 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.

Approving at 6178832.

This head is a rebase onto current main. I compared it with the head I last reviewed: the change's own hunks are the same, and only context lines moved where main had edited the same doc paragraphs and the open_with_default_app signature (wait_for_exit). The rebase keeps main's version of both.

I read every changed hunk at this head:

  • desktop_launcher_available checks only fixed system paths (/usr/bin/open, C:\Windows\explorer.exe, /usr/bin/xdg-open) and, on Linux, DISPLAY or WAYLAND_DISPLAY. Both launchers call it first, so the menu and the click give the same answer. The spawned command lines and _reveal_env are unchanged.
  • /api/dashboard/branding adds one boolean, computed in a worker thread. No request input decides it.
  • The front end gates every reveal and open surface on useCanReveal. A copy made in place of an open is now reported through the error notice instead of the Copy row's label. Shift+click on a chip that cannot reveal copies the path without its line suffix, as the hint says.
  • Tests, locale strings, specs and screenshots match the code.

Security checklist at this head: auth/authz no change; no new input parsing; no trust boundary widened (the server side direct-local gate on /api/reveal is unchanged, and the new flag only hides actions); no sandbox change; no approval gate change; no secret handling. The change can only make the reveal refuse more often, never less.

All AI review lanes pass on this head, and CI and readiness are green. 54 files, every hunk read.

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at 6178832 for one unanswered current-head AI concern.

The headless fix is sound. desktop_launcher_available drives both the dashboard gate and the launchers. The spawn argv and the direct-local gate are unchanged, and the change can only refuse more often. CI is green and the maintainer approval is at this head.

Unanswered, and I could not settle it from the code:

  • Design and First Principles both note that on Linux the check requires DISPLAY or WAYLAND_DISPLAY in the gateway's own environment (platform_compat_trust.py#L810-L843). The installed service sets DBUS_SESSION_BUS_ADDRESS but no display variable (linux_unit.py#L310-L320), and a user unit can start before the graphical session imports one. On a GNOME or KDE desktop running the service, "Show in file manager" may therefore disappear where xdg-open to gio used to reach the file manager over D-Bus.

To clear: confirm on a Linux desktop with the service installed that reveal worked before and still works. If it no longer does, keep the display check in the dashboard answer only, as First Principles suggests, or accept another session signal.

AI findings judged non-blocking

  • GPT (downgraded): a stale "Copied!" title for at most 1.5 s after a refused Shift+click (InlineCode.tsx#L717). It clears itself and the failure bubble still shows. Rebutted by the author.
  • UX: missing screenshots for two states, and the red style on the "copied instead" notice. Evidence and styling only.
  • First Principles: a 5th copy of the display predicate. The other copies also check other conditions, so they are not the same predicate.

— crew-pr-reviewer (r136)

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on behalf of the watch holder (bolichen). Lanes pass on 6178832, checks green, no conflict, no open change request.

@rubencu

rubencu commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

On the hold above: the code bears it out. The installed Linux service is a system unit with no display variable, so under it this check hides reveal and open on a GNOME desktop. #30083 fixes it: when the gateway's own environment names no display, the session comes from the user's systemd manager, and a headless host stays hidden.

@rubencu
rubencu deleted the fix/path-chip-reveal-says-what-it-does branch November 5, 2026 01:05
rubencu added a commit to rubencu/KiroCrew that referenced this pull request Nov 5, 2026
…rvice

The installed Linux service is a system unit, so the gateway's own
environment never names a display server. Since kirodotdev#23019 that hid "Show in
file manager" and "Open with default app" on every Linux desktop running
the service, including GNOME, where xdg-open used to reach Nautilus over
the session bus.

When the gateway's own environment names no display, ask the user's
systemd manager (`systemctl --user show-environment`, 2 s timeout, answer
kept for 30 s). Copy only DISPLAY, WAYLAND_DISPLAY, XAUTHORITY,
XDG_CURRENT_DESKTOP and KDE_SESSION_VERSION, each passing a plain
character check, and count a display only while its socket exists,
checked again on every use of a kept answer. A reachable session bus
alone is not a desktop, so a headless host stays hidden and refused. The
open action asks before its stat-and-launch transaction, so no spawn
lands inside it.

Closes kirodotdev#30026
rubencu added a commit to rubencu/KiroCrew that referenced this pull request Nov 5, 2026
…rvice

The installed Linux service is a system unit, so the gateway's own
environment never names a display server. Since kirodotdev#23019 that hid "Show in
file manager" and "Open with default app" on every Linux desktop running
the service, including GNOME, where xdg-open used to reach Nautilus over
the session bus.

When the gateway's own environment names no display, ask the user's
systemd manager (`systemctl --user show-environment`, 2 s timeout, answer
kept for 30 s), run with the environment `systemctl_user_env` gives
every `systemctl --user` spawn. Copy only DISPLAY, WAYLAND_DISPLAY,
XAUTHORITY, XDG_CURRENT_DESKTOP and KDE_SESSION_VERSION, each passing a
plain character check, and count a display only while its socket exists,
checked again on every use of a kept answer. The launcher gets them on
top of the same session-bus pointers. A reachable session bus alone is
not a desktop, so a headless host stays hidden and refused. The open
action asks before its stat-and-launch transaction, so no spawn lands
inside it.

Closes kirodotdev#30026
bolichen97 pushed a commit that referenced this pull request Nov 5, 2026
…rvice (#30083)

The installed Linux service is a system unit, so the gateway's own
environment never names a display server. Since #23019 that hid "Show in
file manager" and "Open with default app" on every Linux desktop running
the service, including GNOME, where xdg-open used to reach Nautilus over
the session bus.

When the gateway's own environment names no display, ask the user's
systemd manager (`systemctl --user show-environment`, 2 s timeout, answer
kept for 30 s), run with the environment `systemctl_user_env` gives
every `systemctl --user` spawn. Copy only DISPLAY, WAYLAND_DISPLAY,
XAUTHORITY, XDG_CURRENT_DESKTOP and KDE_SESSION_VERSION, each passing a
plain character check, and count a display only while its socket exists,
checked again on every use of a kept answer. The launcher gets them on
top of the same session-bus pointers. A reachable session bus alone is
not a desktop, so a headless host stays hidden and refused. The open
action asks before its stat-and-launch transaction, so no spawn lands
inside it.

Closes #30026
buluoray pushed a commit that referenced this pull request Nov 8, 2026
…rvice (#30083)

The installed Linux service is a system unit, so the gateway's own
environment never names a display server. Since #23019 that hid "Show in
file manager" and "Open with default app" on every Linux desktop running
the service, including GNOME, where xdg-open used to reach Nautilus over
the session bus.

When the gateway's own environment names no display, ask the user's
systemd manager (`systemctl --user show-environment`, 2 s timeout, answer
kept for 30 s), run with the environment `systemctl_user_env` gives
every `systemctl --user` spawn. Copy only DISPLAY, WAYLAND_DISPLAY,
XAUTHORITY, XDG_CURRENT_DESKTOP and KDE_SESSION_VERSION, each passing a
plain character check, and count a display only while its socket exists,
checked again on every use of a kept answer. The launcher gets them on
top of the same session-bus pointers. A reachable session bus alone is
not a desktop, so a headless host stays hidden and refused. The open
action asks before its stat-and-launch transaction, so no spawn lands
inside it.

Closes #30026

(cherry picked from commit 1b8a195)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants