Skip to content
This repository was archived by the owner on Nov 3, 2026. It is now read-only.

fix(exec): run commands as typed, never through a plugin - #39

Merged
gold-silver-copper merged 4 commits into
mainfrom
fix/exec-runs-verbatim
Oct 25, 2026
Merged

gold-silver-copper merged 4 commits into
mainfrom
fix/exec-runs-verbatim

Conversation

@gold-silver-copper

@gold-silver-copper gold-silver-copper commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What and why

With the optional meta-rust plugin installed (make install installed it for years), meta exec -- cargo --version printed meta-rust's help instead of running cargo:

$ meta exec -- cargo --version
...meta-rust's help text...
To run raw cargo commands: meta exec -- cargo <command>

Two causes:

  1. The Exec branch offered every command to subprocess plugins before running it.
  2. SubprocessPluginManager::execute gave a plugin any command whose first word matched one of its claimed commands, so meta-rust's cargo build claim also took cargo --version, cargo fmt, cargo update, …

The routing rule (now)

Command Before After
meta exec -- <cmd> plugin first, else run in each repo always run in each repo, as typed
meta <cmd> plugin (first-word match), else "unrecognized" same, but matched on whole argv words
  • meta exec is this repo's rule: it never consults plugins, so no plugin can shadow a raw command, whatever name it claims.
  • meta <cmd> routing: the plugin whose claimed command is the longest whole-word prefix of the args wins (git snapshot create x → meta-git's git snapshot create). Otherwise the plugin that claims commands under the first word owns that namespace and gets the whole command.
  • Subcommands a plugin doesn't implement are the plugin's rule: meta-git already runs raw git for them (that is how meta git pull works). meta-rust passing any cargo subcommand through is fix: pass every meta cargo command through to cargo meta_rust_cli#15 (it claims just cargo, which routes here as a one-word claim).
  • handles_command was dead code that copied the old matching; it is deleted.

Behavior changes (intended)

Nothing in gitkb/meta or harmony relied on exec reaching a plugin: every meta exec -- git|cargo … in docs and skills expects the raw command. These still change:

  • meta exec -- git status / git commit … now run plain git in each repo instead of meta-git's versions. Use meta git status / meta git commit for those.
  • meta exec -- git fetch|pull|push … no longer gets meta-git's environment (GIT_TERMINAL_PROMPT=0, GIT_PAGER=cat, shared SSH connections), so a credential prompt can hang in parallel runs. meta git <any subcommand> passes through to git with that environment; the exec help and skill now point there (the exec help's git fetch --all example is now cargo fmt --check).
  • meta exec -- git clone <url> no longer acts as meta git clone (the bootstrap that works without a .meta). It needs a .meta like any exec. Use meta git clone.
  • Like every exec command, the args are joined into one shell command (this was already true for everything that didn't hit a plugin). So meta exec -- git commit -m "two words" needs the whole command quoted; meta git commit -m "two words" keeps the args intact.

The meta-exec skill text that documented the hijack ("fails if meta-rust is installed") is updated here, and the meta-plugins skill now describes meta-rust as gitkb/meta_rust_cli#15 ships it (meta cargo <any cargo args>; meta rust build/test are gone). The copies in gitkb/meta (claude-plugin/skills/meta-exec/SKILL.md, .meta/skills/…) still have the old text; they follow this file.

How it was verified

  • tests/plugin_routing.rs installs a fake plugin that claims touch and logs requests:
    • exec_runs_a_plugin_claimed_command_verbatim: meta exec -- touch ran creates ran in the root and both repos and the plugin gets nothing. Fails on main (the plugin took it), passes here.
    • plugin_subcommand_still_routes_to_the_plugin: meta touch ran reaches the plugin with command: "touch", args: ["ran"], and nothing runs raw.
  • Removed six tests/plugin_git.rs tests that re-ran inline copies of the old clone detection and arg splitting, not the real code.
  • Unit test test_route_matches_whole_words: longest claim wins, cargo buildx is not cargo build, unknown first words don't route, cargo --version goes to the plugin that owns cargo.
  • cargo test -p meta, cargo clippy -p meta --all-targets --all-features -D warnings, cargo fmt --check. (Locally, two registry "fails outside workspace" tests fail only because my temp dir is under $HOME, which has a ~/.meta; unrelated to this change.)
  • Live: installed this branch and current main of meta-rust into a throwaway CARGO_INSTALL_ROOT, in a scratch meta-repo with repos a and b:
    $ meta exec -- cargo --version
    ✓ . (scratch):  cargo 1.99.0 (5f94df478 2026-08-27)
    ✓ ./a:          cargo 1.99.0 (5f94df478 2026-08-27)
    ✓ ./b:          cargo 1.99.0 (5f94df478 2026-08-27)
    3 commands complete
    $ meta exec -- cargo fmt --check     # b deliberately unformatted
    ✗ ./b: cargo fmt --check (Exit code 1)
    Summary: ✗ 1 out of 3 commands failed
    $ meta cargo build                   # still meta-rust
    4 commands complete
    

Look closely at

  • SubprocessPluginManager::route in src/subprocess_plugins.rs: the matching rule.
  • handle_command_dispatch in src/main.rs: exec now checks is_explicit_exec before plugins, in both the worktree and the normal path, and skips the git clone bootstrap.

Related

Task: [[tasks/harmony-2745]]

`meta exec -- cargo --version` printed meta-rust's help instead of running
cargo: exec offered every command to plugins first, and a plugin claiming
`cargo build` also took every other `cargo ...` command by its first word.

`meta exec` now always runs the command in each repo. Plugins are only
consulted for `meta <command>`, matched on whole argv words: the longest
claimed command wins, otherwise the plugin owning the first word gets the
whole command and handles subcommands it does not implement. The unused
`handles_command` copy of the old matching is gone.

Implements [[tasks/harmony-2745]]
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3618ebd6-4abf-409a-ad10-6650e5c9a746
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

gold-silver-copper added a commit to gitkb/meta-archive that referenced this pull request Oct 24, 2026
meta exec runs commands as typed (gitkb/meta_cli#39); meta cargo passes
any cargo command through (gitkb/meta_rust_cli#15). Skill copies come
from meta_cli via make skills; Cargo.lock follows meta_rust_cli's deps.

Implements [[tasks/harmony-2743]]
Matches gitkb/meta_rust_cli#15, which drops meta rust build/test. Also
covers the reported cargo --version shape in the routing test.

Implements [[tasks/harmony-2745]]
meta exec -- git runs plain git, without meta-git's no-prompt env, so the
exec help no longer uses git fetch as its example and the skill says so.
Six plugin_git tests only re-ran copies of the old clone detection and
arg splitting inline; route and plugin_routing cover the real code.

Implements [[tasks/harmony-2745]]
@gold-silver-copper
gold-silver-copper merged commit 5ddb45e into main Oct 25, 2026
7 checks passed
gold-silver-copper added a commit to gitkb/meta-archive that referenced this pull request Oct 25, 2026
#110)

fix(build): make install overwrites untracked binaries; drop meta-rust

cargo install --path always rebuilds, so --force only changes the case
where a binary cargo doesn't track (a release download) is in the way.
meta-rust leaves make install to match what releases ship.

Implements [[tasks/harmony-2743]]

fix(build): make uninstall still removes meta-rust

Earlier make installs put meta-rust in ~/.cargo/bin; leaving it there
keeps breaking meta exec -- cargo commands other than build and test.

Implements [[tasks/harmony-2743]]

docs(readme): meta-rust is optional; name both install script dirs

Implements [[tasks/harmony-2743]]

fix(build): install and ship meta-rust again

make install keeps installing meta-rust, and releases now ship it too
(archives, Homebrew, install scripts), so every install path agrees.

Implements [[tasks/harmony-2743]]

docs: describe meta exec and meta cargo as the sibling PRs ship them

meta exec runs commands as typed (gitkb/meta_cli#39); meta cargo passes
any cargo command through (gitkb/meta_rust_cli#15). Skill copies come
from meta_cli via make skills; Cargo.lock follows meta_rust_cli's deps.

Implements [[tasks/harmony-2743]]

test(help): cargo help as meta_rust_cli#15 ships it

Implements [[tasks/harmony-2743]]

docs(skills): sync meta-plugins skill from meta_cli#39

Implements [[tasks/harmony-2743]]

docs: README routing matches meta_cli#39; bump the Claude plugin for …

…its skill changes

Implements [[tasks/harmony-2743]]

docs(skills): sync meta-exec skill from meta_cli#39

Implements [[tasks/harmony-2743]]

docs(architecture): meta exec -- git is plain git; use meta git

Implements [[tasks/harmony-2743]]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant