Skip to content

feat(desktop): add first-class Grok Build ACP runtime support - #5742

Open
ravz wants to merge 3 commits into
block:mainfrom
ravz:feat/grok-build-acp-runtime
Open

feat(desktop): add first-class Grok Build ACP runtime support#5742
ravz wants to merge 3 commits into
block:mainfrom
ravz:feat/grok-build-acp-runtime

Conversation

@ravz

@ravz ravz commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Adds first-class Grok Build ACP runtime support to the managed-agent catalog and supervised launch path, pinned to the subscription-backed ACP argv contract grok agent --model <model> stdio (discrete arguments, never shell-interpolated, no API-key/credit fallback — the child inherits only the existing local grok.com session).

Harness (crates/buzz-acp/src/config.rs)

  • default_agent_args("grok") = the pinned ["agent", "--model", "grok-4.6", "stdio"] default.
  • New effective_agent_args(command, agent_args, model) bridges the managed model into the argv as a discrete argument, fails closed on an empty model, and leaves every other runtime byte-identical to normalize_agent_args. Explicit agent_args win.
  • Deterministic tests: pinned default, model substitution, empty-model fail-closed, .exe identity normalization, explicit-args precedence, non-grok behavior unchanged.

Desktop (desktop/src-tauri/src/managed_agents/discovery.rs + runtime_metadata.rs)

  • Genuine grok entry in KNOWN_ACP_RUNTIMES: provider locked, model_env_var: None (model travels in argv, not env), required_normalized_fields: ["model"], direct ACP runtime (no adapter), login hint.
  • ~/.grok/bin added to binary discovery paths (official Grok Build install layout, matching the existing per-runtime well-known-path probes).
  • Desktop default_agent_args mirror + catalog metadata tests.

Invariants preserved: no change to the default runtime preference order (getDefaultPersonaRuntime untouched), no alias, no PATH dependence when the exact official binary is discovered, no shell string, no ambient API key, supervised one-child spawn unchanged (identity, system prompt, policy, queue, locks, timeout, cancellation all remain buzz-acp-owned).

Local verification (Windows host): cargo fmt --check clean; cargo test -p buzz-acp --lib at head: 759 passed / 17 failed, and the failure set is a strict subset of the base failure set (31 failures at base — timing/env-sensitive steer tests on this host; BUZZ_ACP_* ambient env), i.e. zero new failures attributable to this change; all new grok tests pass. Desktop crate full suite not runnable locally: the native build dependency cmake is absent on this host (no cmake anywhere on PATH/MSYS2); CI is authoritative for the desktop suite.

Adds a genuine 'grok' runtime to the managed-agent catalog and bridges the
managed model into Grok Build's subscription-backed ACP argv
`grok agent --model <model> stdio` as discrete arguments (never shell
interpolated). The model is not an env var for Grok (provider locked;
model_env_var None); it travels in the argv via the harness config bridge.

- crates/buzz-acp: default_agent_args('grok') = the pinned grok-4.6 argv;
  new effective_agent_args() substitutes the managed model as a discrete
  argument, fails closed on an empty model, and leaves every other runtime
  byte-identical to normalize_agent_args(). Deterministic unit tests cover
  the pinned default, model substitution, empty-model fail-closed, .exe
  identity normalization, explicit-args precedence and non-grok behavior.
- desktop: KNOWN_ACP_RUNTIMES 'grok' entry (provider_locked, no model env
  var, required normalized model), ~/.grok/bin added to binary discovery
  paths, desktop default_agent_args mirror, and catalog metadata tests.

No default runtime preference order change, no alias, no PATH dependence
when the official binary is discovered, no API key/credential path, no
unmanaged child (supervised spawn unchanged).

Co-authored-by: Rav Panchalingam <rav@risebt.com.au>
Signed-off-by: Rav Panchalingam <rav@risebt.com.au>
@ravz
ravz requested a review from a team as a code owner August 13, 2026 05:32
Root cause (Nyx FAIL 8e8d2528): the desktop emitted a non-empty pinned
default agent_args for grok ('agent --model grok-4.6 stdio'), which was
exported as BUZZ_ACP_AGENT_ARGS and took precedence over BUZZ_ACP_MODEL
in effective_agent_args — so an alternate managed model was accepted,
stored and displayed but silently ignored.

Fix: the desktop now emits NO default agent_args for grok (normalize
returns empty; BUZZ_ACP_AGENT_ARGS is empty/absent), so buzz-acp's
effective_agent_args builds the exact argv ['agent','--model',model,
'stdio'] from the managed model (BUZZ_ACP_MODEL), default grok-4.6.
An operator-supplied explicit agent_args remains distinguishable and
wins. Blank model fails closed. The discovery comment now states the
real contract instead of the false bridge claim.

Regression coverage:
- desktop runtime_metadata: grok emits no default args; explicit
  override passes through.
- buzz-acp config integration tests through the real clap env/flags
  boundary -> Config::from_args -> effective_agent_args -> child argv:
  managed grok-4.6, alternate grok-5, blank-model fail-closed, explicit
  override precedence. 8/8 grok tests pass; full lib 752/28 vs base
  740/31 — zero new failures, none grok-related.

Co-authored-by: Rav Panchalingam <rav@risebt.com.au>
Signed-off-by: Rav Panchalingam <rav@risebt.com.au>
@Chessing234

Copy link
Copy Markdown
Contributor

auth_probe_args: None on the new entry does not mean "no probe", it means no login step. discover_acp_runtimes_from fills AuthStatus::NotApplicable for any available runtime with no probe args, and the enum documents that as "this runtime does not have a login step (e.g. goose, buzz-agent)". grok is underlying_cli: Some("grok") and the body describes it as subscription-backed, so the badge will tell people grok needs no auth while a logged-out cli fails at the first turn — the same false-positive shape #5460 reports for claude.

separately: the default model is pinned in two places, default_agent_args (grok-4.6 in the argv) and effective_agent_args (model.unwrap_or("grok-4.6")). they will drift.

Signed-off-by: Rav Panchalingam <rav@risebt.com.au>
@ravz

ravz commented Aug 14, 2026

Copy link
Copy Markdown
Author

Addressed both points in f0d73ce.

  • Grok now probes with grok models. The current CLI exits 0 in both auth states, so the probe now captures stdout and recognizes its explicit You are not authenticated. result before applying the existing exit-code fallback. This fixes both catalog discovery and readiness checks without changing Codex/Claude behavior; config-error precedence remains intact.
  • The Grok default model is now defined once (GROK_DEFAULT_MODEL) and both default/effective argv paths use the same grok_agent_args builder.
  • While exercising the real clap boundary, I also fixed the legacy cross-runtime agent_args=["acp"] default so it cannot shadow Grok's managed model. Full explicit Grok argv overrides still win.

Local verification:

  • cargo test -p buzz-acp --lib config::tests: 123 passed
  • auth classifier source tests: 5 passed (logged in, successful-but-logged-out, generic success, config-error precedence)
  • cargo clippy -p buzz-acp --lib -- -D warnings: passed
  • root + desktop Rust formatting and diff checks: passed

The full desktop crate still cannot link on this Windows host because the unrelated native sherpa-onnx-c-api static library is unavailable; CI is authoritative for that complete build.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants