Repository navigation
fix(agent): error on an unrecognized command instead of opening the desktop app - #1549
Conversation
|
Agreed that a mistyped command shouldn't open the desktop app. An alternative to consider that removes the catch-all instead of carving exceptions out of it: Why the catch-all exists. Suggested change
This is net-negative code and leaves no heuristic about which arguments look like a launcher's to maintain. Things to check
|
|
@AnthonyRonning yeah i considered this but i assumed we'd want to avoid breaking existing behavior, but i can remove it instead. |
…esktop app `maple-agent begin-pairing` (the real command is `maple-agent remote begin-pairing`) was swallowed by the launcher-argument catch-all and started the desktop app. A leading bare word that is not a known command is now an error with exit status 2, with a hint when it names a nested command. Flags, URLs and file paths appended by a desktop launcher are still ignored. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ng it Maple Work registers no MimeType or URL scheme and nothing read `desktop_args`; it only swallowed what `%U` in the Linux desktop entries appended. Drop `%U` from both `Exec=` lines, remove `desktop_args`, and let clap reject unknown input. Clap suggests only at the current level, so an unknown word naming a nested command (`begin-pairing`) still gets its full path as the tip. Co-Authored-By: Claude Fable 5.2 <[email protected]>
9dbfbbc to
d426770
Compare
|
@AnthonyRonning this is ready for another look. I went with your direction:
Rebased on master. Smoke tested on Linux under Xvfb: a no-argument launch opens the window, and |
What happened
While pairing a remote node that has no GUI, I ran
maple-agent begin-pairing. The real command ismaple-agent remote begin-pairing. Instead of an error, the binary treated the word as a launcher argument and tried to start the desktop app, which on a headless machine is confusing and gives no hint about what went wrong.Change
Following the review suggestion, this removes the launcher-argument catch-all rather than carving exceptions out of it:
%Ufrom both LinuxExec=lines (scripts/linux-install.py,scripts/linux-release-appimage.py). Maple Work registers noMimeTypeor URL scheme, so it advertised a capability the app doesn't have.desktop_argsand itsconflicts_withreferences. Nothing read it.Behavior change to be aware of
Every unknown argument is now an error, including unknown flags, URLs and file paths.
Existing Linux user installs keep their old
.desktopentry with%U:linux-install.pywrites it once and refuses to replace it, and I found nothing in the in-app updater that rewrites it. Launching from the menu expands%Uto nothing, so that still opens the window. Dropping a file onto the launcher icon would now exit with an error instead of opening the app. I did not add a transitional tolerance for absolute paths; say so if that case matters.Merging is optional
The previous catch-all was deliberate and may be the desired behavior. This PR is a proposal that came out of one confusing headless pairing session; close it if ignoring unknown arguments is intended.
Testing
Run on Linux through the Agent Nix shell, after rebasing on master:
cargo test -p maple-agent-app --locked --bin maple-agent: 1389 passed, 0 failed, 4 ignoredXDG_*roots. The "Maple Work Debug" window opened. On the same display,maple-agent begin-pairingexited 2 with the tip and opened no window.begin-pairing,frobnicate,remot,--unknownand/tmp/x.txt: all exit 2 with the expected messagesRun before the rebase and not repeated since:
just ci-lint(passed) andjust python-test(26 tests OK, 1 skipped).Not run:
.desktopentry was built or started. The smoke test covers what those do after this change, which is start the binary with no arguments.maple-agent.exewith no arguments and the macOSInfo.plistdeclares no document or URL types, but neither was launched.just ci-testand the headless feature-set tests.🤖 Generated with Claude Code