Repository navigation
fix(cua-driver): answer a typed app_not_found refusal when launch_app finds no application on Linux - #8405
Draft
JMLX42 wants to merge 1 commit into
Draft
fix(cua-driver): answer a typed app_not_found refusal when launch_app finds no application on Linux#8405JMLX42 wants to merge 1 commit into
JMLX42 wants to merge 1 commit into
Conversation
… finds no application on Linux When the name is neither an executable on PATH nor an installed .desktop application, the Linux launch_app ended as a plain-text error with no code, on the same path as a remote-debugging flag, a launcher that does not start, an xdg-open failure and a task panic. Answer a refusal with code app_not_found and effect refused instead, in the shape of launch_handoff_timeout. The message text is unchanged and the other failures are untouched. 🤖 Written by Claude Code (2.1.317) using model claude-opus-5-5
Collaborator
|
Thanks for the fix. We'll review it. The CI checks on fork PRs need a maintainer to start them, so they may show as waiting until then. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem this solves
On Linux, five
launch_appfailures leave as plain text, with no code. Three of them share one message prefix:A caller cannot tell "nothing by that name exists" from "something was found and failed" without parsing the message. In the first case no process started, so it is a refusal.
What changed
That one case now answers a typed refusal. The text is unchanged;
structuredContentis new:launch_handoff_timeout_resultin the same file already answerseffect: "refused"plus acode, so this follows it. The{"status": "refused", "refusal": {...}}shape of other Linux tools does not appear inlaunch_app.rs.nameandlaunch_pathshare one launch path, so both get the refusal.namein the structured content is the requested command.When the refusal is given
Pseudocode of the new path, after the existing checks (no
.desktopmatch, not a URL, not an existing path):program_may_exist,programhas a/try_existsfails with another errortry_existsisOk(false),NotFoundorNotADirectoryprogram_may_exist, bare name$PATHdirectory holds it, a probe fails with another error, or$PATHis unset$PATHdirectory holds it (an entry that is a file holds nothing)names_installed_appcmd, its desktop-file id or Exec basename equalscmd(these three ignore ASCII case), or itslaunch_pathstarts with the same programnames_installed_appuses the criteria ofmatch_installed_appwithout its uniqueness rule, so an ambiguous name keeps the plain text.Results by case. Each row is a case of the new integration test:
nameNotFoundapp_not_foundlaunch_pathNotFoundapp_not_foundcua-definitely-absent --flagNotFoundapp_not_found$PATHwhose script interpreter is missing (asname, and as a multi-tokenlaunch_path)NotFound$PATHwithout execute permissionPermissionDeniedadditional_argumentsInvalidInputxdg-openon$PATHNotFoundfromxdg-open, not from the direct spawnlist_appslaunch_path, and by that launcher with other argumentsNotFoundSize of the change
Known limits
app_not_foundmeans "the driver's own resolution found nothing", not a proof of absence. What remains:/opt/acme/./editoris not recognized as/opt/acme/editor.flatpak run org.acme.Editoris judged byflatpak.applications/, and skips a.desktopfile or directory it cannot read without saying so (existing behavior ininstalled_apps.rs, unchanged here); a match there can be missed.My Editoris judged byMy.PATHset, a bare program is never classified (the default search path then differs between C libraries).Related work
process_exitedand below, and their tests. This PR touchesinvoke, the new functions next to it, and the end of the test module: no shared lines.RFC: not opened
.github/CONTRIBUTING.mdasks for an RFC when a change affects a public MCP contract. This PR adds a code to the structured content of an existing error result: no new tool, parameter or input schema, and no change to a successful result. Precedents:launch_handoff_timeoutbrowser_field_needs_keystrokesrefusalQuestions for the maintainers:
app_not_foundmean "the driver's resolution found nothing" (this PR, with the limits above), or a stronger guarantee of absence that would need a different resolution?Compatibility and risk
launch_appfor an unknown name now also carriesstructuredContentwith acode;isErrorand the text are as before.Validation
Focused tests and checks
The integration test drives
launch_appthrough the tool registry. It asserts the whole structured object for the threeapp_not_foundrows of the table above. For the other rows, it asserts the exact previous text and no structured content.What the fixture isolates from the host:
XDG_DATA_HOME,XDG_DATA_DIRS→ a privatedata/PATH→ a privatebin/IsolatedStateRootwork/;PATH, the XDG directories and each launcher command are relative to it, so the test also passes with a space and a colon inTMPDIRDISPLAY,WAYLAND_DISPLAYunsetThe fixture restores the environment and the working directory on drop. Before each case, the test spawns the program directly and asserts the spawn error kind that the case relies on. If the filesystem cannot produce it (for example a
noexecmount), the test fails with a message that names the filesystem. The missing-interpreter case is its own test, so such a mount fails only that test.The unit test of
program_may_existcovers, with temporary directories: a present and an absent program, by name and by path; a$PATHentry that is a file; a directory without search permission (asserted only where the platform makestry_existsfail there); and no search path.Commands:
rust:1.97.1+ the packages oflinux-rust-prepcargo test --locked -p platform-linux --libcargo test --locked -p platform-linux --testscargo fmt --all -- --checkcargo clippy --locked -p platform-linux --all-targets -- -D warningsbin/ci(affected mode, not--quick)bin/ci --signoff¹ SPDX headers, rustfmt, image refs, cargo lockfiles, Windows cfg grep, clippy with the reverse dependencies it selects,
platform-linuxunit tests, the generated docs reference, the UniFFI bindings check. The last revision changes only the fixture of the integration test; on it, only the fourcargocommands above ran.Manual or platform evidence
None beyond the tests.
Known gaps or CI still required
No
local-cisign-off. The GitHub CI jobs (the X11/Wayland desktop lanes, the Windows and macOS builds) have not run.Contributor and release checks
no-releaselabel is applied. (Not applicable: this is afix.)bin/ciis green and signed off (bin/ci --signoff). (bin/ciwas green on the previous revision; not rerun on the last, and the sign-off is not done.)🤖 Written by Claude Code (2.1.317) using model claude-opus-5-5