Skip to content

Action argument contract: the app exports each action's arguments, and a Linux test fails any CLI call site that names one the app does not take - #36260

Merged
teamleaderleo merged 10 commits into
feat-cmux-nextfrom
contract/cli-app-args
Nov 5, 2026
Merged

teamleaderleo merged 10 commits into
feat-cmux-nextfrom
contract/cli-app-args

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Leo, 2026-11-05, after a Cloud chat failed because the CLI sent promptId and the app's cloudRelayChat only took prompt-id: "You guys keep running into these. These are weird issues that I feel like you should be able to just fix beforehand and check on beforehand."

This makes that class of drift (a CLI call site naming an app action argument the app does not take) fail CI before it merges.

What changes

  • One source of truth. ActionSurfaceExport now writes each action's args (name, kind, required, enum values, target kind) into the checked-in plans/cmux-next/action-surfaces.json. It is regenerated here, and the existing exportIsFresh and PR autofix keep it current.

  • Rust contract test (Linux). cli/tests/action_argument_contract.rs scans cmux-tui's sources for every place an app action is named by hand: CLI words (["cloud", "relay-chat", ..]), action_run_params("ID"), or "action": "ID". It fails on any --flag or args key the action does not take under its canonical name. Words that the CLI's own grammars take first (mux, agents, and chat_scope's sender flags) are skipped. A self-test plants the promptId drift in each call shape.

  • Swift contract test. ActionArgumentContractTests checks four things: every argument is lowerCamelCase, no two arguments of one action fold to one name, the export carries every argument, and the old spellings still resolve.

  • Canonical names. camelCase is the canonical spelling, because the CLI turns every --flag-name into flagName. The router folds case, - and _, so prompt-id/prompt_id keep working for one release.

  • Drift fixed (found by the new checks):

    • history.open new_tab becomes newTab.
    • palette.installCLI cmux_next becomes cmuxNext.
    • The in-process tab.moveToNewSplit keep_focus becomes keepFocus.

    None of these could be reached from cmux. cloudRelayChat's promptId itself was fixed by Cloud relay chat: argument promptId, so cloud start-chat's --prompt-id reaches it #36193.

Changelog

Fixed: cmux history open --new-tab and cmux settings install-cli-in-path --cmux-next reach their app arguments.

Verification

  • The fleet Mac regenerated the exports at de08d2f with 14 tests passing, the new suite included.
  • cargo test -p cmux-tui --lib action_argument_contract passed on fleet Linux at this head: 3 tests.

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

The app now exports each action's arguments into plans/cmux-next/action-surfaces.json as the single source of truth, so a CLI call site can't name an argument the app doesn't take — which previously broke cmux cloud start-chat when the CLI sent promptId while the app expected prompt-id. A Linux test scans cmux-tui sources for hand-written call sites and fails on any --flag or args key the action doesn't take under its canonical lowerCamelCase name.

  • Canonical argument names are lowerCamelCase, the spelling the CLI's --flag-name produces; history.open's newTab, palette.installCLI's cmuxNext, and the in-process tab.moveToNewSplit's keepFocus are renamed.
  • The router still folds case, -, and _, so old spellings like prompt-id and prompt_id keep resolving for a release.
  • A Swift contract test, named so check-action-surfaces.sh runs it on every catalog change, keeps the export current and checks the router's folding.
  • Three renamed arguments were unreachable from cmux; the promptId drift itself was already fixed.

Written for commit a66a580. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 5 commits November 4, 2026 22:03
…amelCase names, any spelling folds to them

The app's action.run arguments now ship in plans/cmux-next/action-surfaces.json (name, kind,
required, enum values, target kind), so the CLI's call sites can be checked against them on Linux.
Every argument is lowerCamelCase, the spelling the CLI's --flag-name reaches: new_tab, cmux_next
and the in-process keep_focus are renamed. The control router takes any spelling that folds to an
argument's name (prompt-id, prompt_id, promptId), so an older caller keeps working for a release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
…ll site sends is one the app's action takes

action-surfaces.json now carries each action's args; cli/tests/action_argument_contract.rs scans
cmux-tui's sources for call sites (CLI words, action_run_params, "action": ID) and fails on any
--flag or args key the action does not take under its canonical name. Runs on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
…rds the CLI's own grammars take are not app arguments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 5, 2026
…ired agent; check-action-surfaces runs the suite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
…ntractTests filter runs it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review (codex gpt-6-astra high, next-review, since=20261105T082332Z): SHIP at c310437

SHIP at c310437

Visual verdict: no images; Leo tries the build

  • [P2] [follow-up] [category:tests] [finding:F1] [outcome:pending] The scanner does not recognize run_action(...) calls or non-literal action_run_params actions, so hand-written CLI arguments in group_create.rs, space.rs, and chat_control.rs are outside the claimed contract coverage. A future argument drift there would pass this CI test.

  • [P2] [follow-up] [category:tests] [finding:F2] [outcome:pending] The compatibility test covers new_tab and cmux_next but omits the renamed tab.moveToNewSplit spelling keep_focus; add that case so the release-compatibility guarantee covers all three renamed arguments.

Follow-ups:

  • F1: Extend the scanner to cover run_action and dynamic action names.
  • F2: Test legacy keep_focus resolution.

…i-app-args

# Conflicts:
#	plans/cmux-next/action-surfaces.json
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review a66a580: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr36260 -f ref=contract/cli-app-args -f platform=macos -f backend_mode=local

Shipped in:

@cursor

cursor Bot commented Nov 5, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo
teamleaderleo merged commit 4b20a12 into feat-cmux-next Nov 5, 2026
261 of 272 checks passed
@teamleaderleo
teamleaderleo deleted the contract/cli-app-args branch November 5, 2026 12:51
lawrencecchen added a commit that referenced this pull request Nov 5, 2026
…x for tip rust-fmt reds) (#36593)

* test(prepush-gate): a changed cmux-tui Rust file left unformatted is a pre-push finding (red)

Three tip rust-fmt reds in one hour (#36358, #36524, #36260): each PR head left
a cmux-tui file unformatted; the PR's rustfmt job is warn-only and passed; the
PR merged on compile before the tip fmt check.

* prepush-gate: rustfmt layer judges each changed cmux-tui Rust file with the pinned rustfmt (local only, like SwiftFormat)

Cause of the tip rust-fmt reds since m26 (merge on compile + launch): nothing
before the merge refuses unformatted Rust. The pre-commit formatter runs only in
clones with the hooks installed, the PR rustfmt job is warn-only (it printed
'acpmux is not rustfmt-clean' on #36524 and passed), and the tip's cargo fmt
check now runs after the merge.

The layer reads each changed cmux-tui/**/*.rs through rustfmt's stdin mode
(only that file; never the modules it names) with cmux-tui's pinned toolchain
and rustfmt.toml, never installs one, and warns with no finding when rustfmt is
absent. It runs where SwiftFormat runs: the pre-push hook and a plain local run,
never CI (--base/--head, --commits, GITHUB_ACTIONS). A file the base already
left unformatted does not block (base findings cancel).

Tests: RustfmtLayerTests 4/4 (red on the previous commit: no gate.rustfmt).
cmux-bot Bot pushed a commit that referenced this pull request Nov 5, 2026
…est (base clippy red) (#36597)

clippy::semicolon_if_nothing_returned at action_argument_contract.rs:417
(from #36260) fails `clippy -D warnings` on every PR that touches a
cmux-tui package.


Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

3 inactive deployments
artifacts — a66a5807 Deployed Nov 5, 2026 by teamleaderleo via publish tree-addressed cmux-tui #115546
sentry-dsyms — a66a5807 Deployed Nov 5, 2026 by teamleaderleo via upload cmux-tui dSYMs to Sentry #115546
ci-routing-agent — a66a5807 Deployed Nov 5, 2026 by teamleaderleo via cmux-tui tree preflight #115546
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant