Skip to content

fix(agent-management): pass env vars to agent in spawn_streaming#59

Open
gregce wants to merge 1 commit intorivet-dev:mainfrom
gregce:fix/spawn-streaming-env-vars
Open

fix(agent-management): pass env vars to agent in spawn_streaming#59
gregce wants to merge 1 commit intorivet-dev:mainfrom
gregce:fix/spawn-streaming-env-vars

Conversation

@gregce
Copy link

@gregce gregce commented Feb 2, 2026

Summary

  • Fixes spawn_streaming() to pass environment variables from SpawnOptions.env to spawned processes
  • The non-streaming spawn() method correctly passes env vars, but spawn_streaming() was missing this code path
  • This caused agents like Claude to not receive ANTHROPIC_API_KEY, resulting in silent authentication failures

Test plan

  • Verify Claude agent receives credentials when spawned via streaming mode
  • Verify Codex agent receives credentials when spawned via streaming mode
  • Run existing agent integration tests

🤖 Generated with Claude Code

The spawn_streaming() function was not passing environment variables
from SpawnOptions.env to the spawned process. This caused agents like
Claude to not receive ANTHROPIC_API_KEY, resulting in silent
authentication failures.

The non-streaming spawn() method correctly passes env vars (lines 298-300),
but spawn_streaming() was missing this code path.

This fix adds the same env var loop to spawn_streaming(), ensuring that
credentials extracted from the host environment are properly passed to
spawned agents.
@gregce
Copy link
Author

gregce commented Feb 2, 2026

@NathanFlurry per this conversation on X

My code is effectively the same as your e2b example: https://github.com/rivet-dev/sandbox-agent/blob/main/examples/e2b/src/e2b.ts

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