Skip to content

fix(agents): let tools the agent runs reach its model credentials - #132

Merged
tee8z merged 1 commit into
mainfrom
fix/agent-review-credentials
Nov 5, 2026
Merged

tee8z merged 1 commit into
mainfrom
fix/agent-review-credentials

Conversation

@tee8z

@tee8z tee8z commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

buzz-agent-review fails in every staging Sandbox whose profile uses a Claude subscription token or a Codex access token. Brokkr hit it today on DEV-2868 and fell back to in-session reviews. Reproduced in Brokkr's pod:

  • claude -p reports Not logged in · Please run /login
  • the Codex path finds no ~/.codex/auth.json to copy

The cause is the environment. The harness holds CLAUDE_CODE_OAUTH_TOKEN and CODEX_ACCESS_TOKEN, but the agent's tool shell (buzz-dev-mcp, launched by the ACP adapter) starts from a cleared environment that lists only git config, BUZZ_PRIVATE_KEY, the relay URL, and similar. Only the API-key Codex path worked, because codex login writes auth.json.

The image README already promises the opposite: "Model credentials stay in the harness environment and are never written to workspace files. Tools that the agent runs inherit them." The first half is enforced by test-profile.py. This PR makes the second half true without breaking the first.

Fix

  • buzz-acp: forwards the harness variables named in BUZZ_ACP_MCP_FORWARD_ENV (comma-separated) into the MCP server.
    • Unset forwards nothing, so upstream behavior is unchanged.
    • Invalid names, managed git variables, and anything the harness already sets (BUZZ_PRIVATE_KEY and so on) are ignored; unset or empty values are skipped.
  • Voltage bootstrap (profile.py): sets it to exactly the model credentials it configured (INHERITED_MODEL_VARIABLES that are set, plus CODEX_HOME).
  • Docs: crates/buzz-acp/README.md env table, and the image README.

Security notes

  • Env-only, never on disk. The profile test still scans /home/agent for the subscription and access tokens.
  • Exposure: commands the agent runs can now read these tokens in their environment. Previously they could already read them from the harness's /proc/<pid>/environ (same UID), so this documents rather than widens what tools can reach.
  • Considered and rejected: a 0600 credentials file, which would contradict the no-token-in-files invariant. The other option is a team-owned review key through via. That's stronger isolation, but it needs an admin-created key, so it's a possible follow-up.

Validation

  • New listed_harness_variables_reach_the_tool_shell_and_nothing_else drives the real build_mcp_servers:

    • default forwards nothing
    • listed names pass through
    • unlisted, unset, invalid, and duplicate names don't, and BUZZ_PRIVATE_KEY is never overridden

    It uses synthetic variable names, so no test process sees fake model credentials. It fails with the forwarding line removed.

  • test-profile.py (image CI) checks the forwarded list is exactly the profile's model credentials.

  • buzz-acp: 1125 passed, run three times; clippy -D warnings and fmt are clean. Image tests run in CI.

  • To confirm live after rollout: run buzz-agent-review --runtime claude and --runtime codex from an agent shell; both should return a verdict.

🤖 Generated with Claude Code

buzz-agent-review failed for every agent whose profile uses a Claude
subscription or a Codex access token: both runtimes reported "not logged
in". The image's contract is that model credentials stay env-only and that
tools the agent runs inherit them, but the agent's tool shell (the MCP
server) starts from a cleared environment that never included them.

buzz-acp now forwards the variables named in BUZZ_ACP_MCP_FORWARD_ENV into
the MCP server. Unset forwards nothing, so the default is unchanged;
invalid names and the harness's own variables are ignored. The Voltage
bootstrap sets it to exactly the model credentials it configured. Nothing is
written to disk: the profile test's no-token-in-files check still holds and
now also checks the forwarded list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tee8z <tee8z@protonmail.com>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 32 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 51 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between dbe955d and 994ace6.

Files selected for processing: 5

  • crates/buzz-acp/README.md
  • crates/buzz-acp/src/lib.rs
  • voltage/images/buzz-agent/README.md
  • voltage/images/buzz-agent/profile.py
  • voltage/images/buzz-agent/test-profile.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@tee8z
tee8z marked this pull request as ready for review November 5, 2026 16:50
@tee8z

tee8z commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tee8z
tee8z merged commit 34d5f75 into main Nov 5, 2026
105 checks passed
@tee8z
tee8z deleted the fix/agent-review-credentials branch November 5, 2026 17:15
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