Skip to content

feat(runtime): add runtimeEnv config for CLI process environment variables (#375)#380

Merged
alexey-pelykh merged 1 commit intomainfrom
feat/runtime-env
Mar 8, 2026
Merged

feat(runtime): add runtimeEnv config for CLI process environment variables (#375)#380
alexey-pelykh merged 1 commit intomainfrom
feat/runtime-env

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

  • Adds runtimeEnv?: Record<string, string> to AgentDefaultsConfig as a sibling to runtime and runtimeArgs
  • Adds resolveCliRuntimeEnv() in runtime-factory.ts (parallel to resolveCliRuntimeArgs())
  • Threads runtimeEnv through ChannelBridgeAgentExecuteParams.env across all 4 dispatch sites (agent command, auto-reply, cron, followup)
  • Hook-provided env from before_runtime_spawn takes precedence over config env (hooks are more specific/dynamic)
  • CLIRuntimeBase.execute() already merges params.env into the spawn environment — no changes needed there

Closes #375

Test plan

  • resolveCliRuntimeEnv() unit tests — all config path permutations (set, empty, missing at each nesting level)
  • ChannelBridge unit tests — runtimeEnv passed as env to runtime.execute(), env left undefined when unset
  • Full test suite passes (868 tests, 93 files)
  • Type-check clean, lint clean, format clean

🤖 Generated with Claude Code

…ables (#375)

Add `runtimeEnv` to `AgentDefaultsConfig` as a sibling to `runtime` and
`runtimeArgs`, allowing users to inject environment variables (API keys,
OAuth tokens, custom config) into spawned CLI processes via configuration.

- Add `runtimeEnv?: Record<string, string>` to config type and Zod schema
- Add `resolveCliRuntimeEnv()` in runtime-factory (parallel to runtimeArgs)
- Thread `runtimeEnv` through ChannelBridge to `AgentExecuteParams.env`
- Hook-provided env overrides config env (hooks are more specific/dynamic)
- CLIRuntimeBase.execute() already merges params.env into spawn environment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit 4659fdb into main Mar 8, 2026
5 checks passed
@alexey-pelykh alexey-pelykh deleted the feat/runtime-env branch March 8, 2026 00:49
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.

feat(runtime): add runtimeEnv config for CLI process environment variables

1 participant