Skip to content

Reject a mistyped subcommand instead of running its group parent - #16944

Open
vitally wants to merge 9 commits into
omacom:quattrofrom
vitally:fix/16770-dispatcher-typo
Open

vitally wants to merge 9 commits into
omacom:quattrofrom
vitally:fix/16770-dispatcher-typo

Conversation

@vitally

@vitally vitally commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #16770.

omarchy update firmwre resolved omarchy-update, which ignores extra arguments, so a typo started a full system update and the confirmation prompt described the whole update instead of what was typed. The same applied to every group parent that takes no operand.

$ omarchy update firmwre
Unknown Omarchy command: omarchy update firmwre
Run 'omarchy update --help' to see its subcommands.

How

bin/omarchy now looks at the leftovers after a resolved command before executing it (find_unknown_subcommand, used on both the direct-route and full-table paths):

  • Only group parents are affected: a command with omarchy-<name>-* children.
  • Only when the command documents no operand (# omarchy:args is empty or flags only), so omarchy theme set <theme> and omarchy hook <name> args still forward.
  • Flags are skipped, so omarchy update -y firmwre is caught too, and a -- keeps everything after it literal.
  • Valid children still win (omarchy update firmware, omarchy update aur pkgs), and --help behaves as before.
  • Works for aliases (omarchy up firmwre).

The operand contract is documented in agents/skills/command-metadata.md.

One visible change: omarchy agent Review this project now fails at the dispatcher (pointing at omarchy agent --help) instead of reaching omarchy-agent's own "use omarchy agent prompt" error. The launcher's guidance is still there for callers that invoke omarchy-agent directly, and the test covers both paths.

Tests

  • test/cli — added fixtures for rejection (exit 127), no parent execution, a bare word after a flag, -- passthrough, child resolution, and a parent documenting no arguments at all.
  • test/shell.d/default-agent-test.sh — updated for the router path, plus direct launcher coverage.
  • Full ./test/shell: 12 of the 13 failing files fail identically on origin/quattro (battery math, widevine, kernel reboot, i18n, a missing omarchy-install-video-decode, etc.). remote-session-service-test is live-session portal noise from a fixture that only runs probe.sh.

`omarchy update firmwre` resolved `omarchy-update`, which ignores extra
arguments, so a typo started a full system update. A group parent that
documents no operand now reports the unknown command and points at its help.
A parent that documents an operand (`omarchy theme set <theme>`) still
forwards its leftovers, and `--` keeps everything after it literal.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The router now rejects leftover words under commands that have children but document no operands, rather than accidentally running the parent command.

  • Group commands reject stray words instead of running their parent.

No actionable issues found. Bash syntax checks passed; the full test suites were not run.

Reviews (7) · Last reviewed commit: "Correct router guidance and keep coverag..." · Reviewed by Greptile

omarchybot and others added 3 commits November 3, 2026 01:51
quattro's omarchy-agent now documents value-taking options (`--local-model <recipe>`, `--agent <id>`) in omarchy:args, so the dispatcher counts it as taking an operand and forwards `omarchy agent Review this project` to the launcher, which answers with its own `omarchy agent prompt` guidance. The router-path assertion expected the dispatcher's unknown-command error and failed once this branch met quattro.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alias and metadata routes are dispatched by dispatch_or_help, whose rejection had no test: removing that check left test/cli green while `omarchy up firmwre` ran the parent again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: muse-wonder <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Nov 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks @vitally. The fix does what it says, and I pushed two small commits to your branch so it holds on current quattro.

What was run. On a disposable Omarchy worker I copied the real bin/, replaced the update and reinstall commands with stubs that only print that they ran, and drove the real dispatcher. On quattro, omarchy update firmwre, omarchy up firmwre, omarchy update aur pkg, omarchy update -y firmwre and omarchy reinstall configz all run the parent. On this branch each one exits 127 with the unknown-command message, and they run the parent again once bin/omarchy is reverted. Real children (update firmware, update aur pkgs, reinstall configs), bare update and update -y, and the flag-only parents debug --print and migrate --pending still run as before. ./test/cli passes. The full ./test/shell run has 4 failing files (ascii, branding-about-animation, first-run, runtime-smoke), and each fails the same way on quattro. CI is green.

What I pushed.

  • 986bc8d merges quattro in, and 698fe5d updates test/shell.d/default-agent-test.sh. Since this was opened, quattro's omarchy-agent has started documenting --local-model <recipe> and --agent <id> in omarchy:args. Those <…> words count as operands, so the dispatcher no longer catches omarchy agent Review this project: it passes it to the launcher, which refuses it with its own omarchy agent prompt guidance, as it did before this change. Merged with quattro, your router-path assertion expecting the dispatcher's error failed. It now expects the launcher's message again. That also means the "one visible change" in the description no longer happens.
  • 5cd7cc5 adds a test for a mistyped subcommand reached through an alias (dispatch_or_help, bin/omarchy:1192). Nothing covered that path before, and test/cli stayed green with that check removed. The new test fails without the check.

Competing fixes. #16777 (older) and #17016 (newer) also fix #16770. This one covers cases both of them miss. #16777 guards only omarchy-update, so omarchy reinstall configz still opens the reinstall prompt. #17016 checks only the first leftover word and only parents that document flags, so omarchy update -y firmwre still starts an unattended update and reinstall is never checked. What #16777 adds that this does not: it also refuses omarchy update -- firmwre, omarchy update --firmwre, and omarchy-update firmwre run directly. Those gaps are left for the maintainer to decide.

Second opinion. Codex Medium and muse-wonder (via pi, thinking high) reviewed it over two rounds, and the final round on this head found no defects (independence not guaranteed). Neither found a shipped no-operand group parent that legitimately takes a bare word, and my own pass over bin/ agrees. muse-wonder raised the missing alias-path coverage, which is now fixed. The two models split on which fix should win: muse-wonder chose this one for the reasons above, and Codex Medium preferred #16777 as the oldest and smallest.

Waiting on the maintainer to choose between the fixes for #16770.

A parent whose omarchy:args are only flags must still run when given just a flag (omarchy update -y); the bare-word check must not reject it.

Co-Authored-By: Luca Volpe <lucavolpe97@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot removed the ready Good to merge label Nov 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I pushed one more commit to your branch: cbc3ea6 folds in a test from #17016 by @Liukskywalkerr, credited to them as co-author. It checks that a flags-only group parent still runs when it gets only its flag (omarchy update -y). Nothing here or on quattro covered that. A version of the bare-word check that rejected any leftover would break omarchy update -y without any test failing.

What was run. On a disposable Omarchy worker, ./test/cli passes at cbc3ea6 and test/shell.d/default-agent-test.sh passes (44 of 44). With bin/omarchy changed to reject a leftover made only of flags, the new assertion is the one that fails, and every earlier one still passes. Only test/cli changed since the last round, so the reproduction reported above still holds. CI is green on this head.

What I checked. I went through every command in bin/ that has subcommands and whose omarchy:args declares no operand (update, reinstall, debug, migrate, version, capture-screenrecording, system-factory-reset, the hw-* and theme-set-* parents, and the rest). None reads a bare word it does not declare. The ones that use $1 or $@ use it to parse flags, as a helper function's own argument, or to re-run themselves with the same arguments, so this change rejects nothing any of them accepts today.

Second opinion. Codex Medium and muse-wonder (via pi, thinking high) reviewed the new commit and found no defects. Independence is not guaranteed.

Next. verified stays on this head and ready has come off. This changes how bin/omarchy routes every command, and the questions left are the maintainer's: choosing between this, #16777 and #17016, and whether the omarchy:args line should now decide whether a command runs at all.

Co-Authored-By: muse-wonder via pi, thinking high <noreply@meta.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

I pushed one commit to your branch, 95a57f6, which adds a sentence to the Dispatch section of docs/cli-router.md so the router docs describe this change. A group parent whose args lists only flag tokens, or nothing, refuses a leftover bare word and exits 127. A flag with a separate value placeholder, such as omarchy-agent's [--agent <id>], counts as an operand and turns the check off. A -- before the first bare word passes the rest through. Only Markdown changed, so nothing was rerun; the sentence was checked against find_unknown_subcommand and command_takes_no_operand in bin/omarchy at this head.

Review. Claude Opus 5.5 wrote the sentence. The second opinion, Codex Medium and muse-wonder (via pi, thinking high), read it against the code over two rounds. In the first round, muse-wonder found two inaccuracies in the original wording, and the sentence above fixes both. It had claimed every flags-only parent refuses a bare word, which [--agent <id>] disproves. It had also said words after any -- pass through, but a bare word before the -- is still refused. In the second round, neither model found anything left. muse-wonder is credited as co-author on the commit.

One more case worth knowing about when choosing between the fixes for #16770. omarchy update -y --mispeled still starts an unattended update with this pull request, because a mistyped flag is not a bare word. #16777's guard inside omarchy-update refuses it. That makes #16777 worth taking beside this one rather than instead of it: this one covers mistyped subcommands under every group parent, including reinstall, and #16777 covers mistyped flags and direct omarchy-update calls.

Nothing is needed from you. This waits on the maintainer.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 12, 2026
@vitally

vitally commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

CI's only failure here is test/shell.d/i18n-startup-test.sh, and current quattro is failing it the same way (runs 43266170334, 43259237147, 43256417346: first reads en while current reads da). It is unrelated to this change, and the latest commit (95a57f6) is docs-only. Could a maintainer re-run the failed job so this head has a green check? Thanks.

@vitally

vitally commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed the branch on current quattro (merge commit 03244d8). The sole failing check was test/shell.d/i18n-startup-test.sh; #18734 (60cb9bf) fixes that flake upstream and the merge brings it in, so CI should be green this time. test/cli and test/shell.d/default-agent-test.sh pass locally.

For whoever reviews: #18798 arrived on the same guard while this was waiting, and the added code is the same in both. They differ only in where the docs sentence lives (docs/cli-router.md here, agents/skills/command-metadata.md there) and how the tests are shaped. Either is fine by me; #16777 remains the only one that also refuses a mistyped flag such as update -y --mispeled.

omarchybot and others added 2 commits November 18, 2026 01:48
Keep the group-parent typo guard beside the updated required-argument exit status documentation.

Co-Authored-By: GPT-6 High <noreply@openai.com>
Nested command help shows usage without listing subcommands. Keep the error hint accurate, document the matched-command metadata read and flag-value exemption, and drop the direct agent assertion that does not exercise this router change.

Co-Authored-By: GPT-6 High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@openrouter.ai>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Nov 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This branch now merges cleanly onto current quattro at 210b8238. The router documentation conflict is resolved, the help hint and metadata documentation match the implementation, and the unrelated direct-agent test is removed. The agent launcher itself is unchanged.

On a disposable Omarchy worker, the reproduction fails on quattro, passes on this head, and fails again with only bin/omarchy reverted. It drives the real router and command metadata with harmless command implementations, including alias routing, a typo after -y, and reinstall configz; valid children, operands and -- passthrough still work. All 144 CLI assertions pass. The full 430-file shell run has four failures reproduced at the same assertions on quattro (ascii, branding-about-animation, provision-owner-keyboard, runtime-smoke), and six files contain skipped checks. CI is green on this head.

GPT-6 High in Codex reviewed the change and audited all 19 affected group parents for undeclared positional operands. Opus 5.5 High and muse-wonder via pi (thinking high) reviewed the corrected head and found no remaining actionable defects. Independence is not guaranteed.

#16777 remains open for validation inside the updater, including unknown flags and direct binary calls. Nothing is needed from the author here; awaiting the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mistyped subcommand silently runs the parent command (e.g. omarchy update firmwre runs a full update)

3 participants