Skip to content

fix(acp): keep Grok managed agents on headless stdio with Buzz auth - #7418

Open
Trevongit wants to merge 2 commits into
block:mainfrom
Trevongit:fix/grok-managed-stdio-auth
Open

fix(acp): keep Grok managed agents on headless stdio with Buzz auth#7418
Trevongit wants to merge 2 commits into
block:mainfrom
Trevongit:fix/grok-managed-stdio-auth

Conversation

@Trevongit

Copy link
Copy Markdown

Summary

Managed Grok Build agents were slow and often mute in the room for two harness reasons, not model reasons:

  1. Empty agent_args launched interactive grok (ENXIO under Desktop). Catalog argv agent --always-approve stdio still omitted --no-leader, so a managed agent shared the interactive TUI leader socket when [cli] use_leader is on.
  2. grokShell drops *KEY* / *SECRET* / *TOKEN* unless shell_environment_policy.ignore_default_excludes is true. BUZZ_PRIVATE_KEY matches *KEY*, so buzz messages send failed with auth_error and the model spent a dozen tool calls scraping /proc.

This PR makes any Grok-harnessed managed agent use headless ACP and keep harness auth env in grokShell. It does not rewrite stored persona JSON.

Changes

  • Catalog + default_agent_args: agent --always-approve --no-leader stdio for command identity grok.
  • Spawn-time insert of --no-leader on existing ACP argv. Explicit --leader is left alone.
  • Inject GROK_CONFIG with overlay-allowlisted shell_environment_policy filter fields so grokShell keeps BUZZ_* already on the grok process. It does not inject secret values.
  • README: Running with Grok Build, plus the operator disk fallback. Some Grok security gates read ~/.grok/config.toml instead of the overlay.

Related

Test plan

  • cargo test -p buzz-acp --lib grok
  • Desktop grok normalize/preset tests (extras tree; origin worktree sidecar-less tauri build cannot compile the desktop lib here)
  • Manual: Grok Build managed agent with empty args initializes ACP, buzz messages send succeeds without /proc hunting, and does not attach to an interactive grok TUI leader

Empty grok argv launched the interactive TUI (ENXIO under Desktop).
Catalog argv without --no-leader shared the TUI leader socket when
[cli] use_leader is on. grokShell also dropped BUZZ_PRIVATE_KEY via
the *KEY* denylist, so buzz messages send failed and the model hunted
/proc.

Default grok argv to agent --always-approve --no-leader stdio, insert
--no-leader on existing ACP argv unless --leader is explicit, and
inject GROK_CONFIG so grokShell keeps harness auth env. Some grok
security gates still read ~/.grok/config.toml; README documents the
operator disk fallback.

Related: block#3457 block#4224
Signed-off-by: Trevor P <trev2005@gmail.com>
@Trevongit
Trevongit requested a review from a team as a code owner September 6, 2026 12:06
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 3c7f288c60d67df78577b237e27c3dfc8831aaa1...935c21316293d19f25d16d9dd084fa1852279587.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 935c21316293d19f25d16d9dd084fa1852279587 to authorize a new review.
Any previous review applies only to its recorded range.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fac1e0f79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

fn default_agent_args(command: &str) -> Option<Vec<String>> {
match normalize_agent_command_identity(command).as_str() {
"goose" => Some(vec!["acp".to_string()]),
"grok" => Some(grok_acp_args()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Treat the legacy acp parser default as empty for Grok

When BUZZ_ACP_AGENT_COMMAND=grok is set without BUZZ_ACP_AGENT_ARGS—the documented standalone quick start—Clap supplies the existing default agent_args = ["acp"], so this Grok default is never selected: normalize_agent_args returns ["acp"] rather than the headless stdio argv. Thus buzz-acp, models, and authentication helpers invoke grok acp, leaving the advertised no-args workflow unfixed; handle the legacy acp sentinel for Grok and cover the parsed CLI path rather than testing only a manually constructed empty vector.

AGENTS.md reference: AGENTS.md:L188-L192

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 935c213.

Clap still defaults BUZZ_ACP_AGENT_ARGS to acp. normalize_agent_args now treats that sentinel as empty whenever the command has a table default, so BUZZ_ACP_AGENT_COMMAND=grok without args resolves to agent --always-approve --no-leader stdio instead of grok acp.

grok_cli_without_agent_args_uses_headless_stdio covers CliArgs::parse_fromConfig::from_args.

BUZZ_ACP_AGENT_ARGS defaults to acp. That blocked Grok's headless
stdio default and launched grok acp. Collapse the sentinel whenever
the command has a table default, and cover Config::from_args.

Signed-off-by: Trevor P <trev2005@gmail.com>
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.

1 participant