Skip to content
This repository was archived by the owner on Jul 24, 2026. It is now read-only.

convoy: NetworkConfig.env — a network-wide agent env map in convoy.toml - #104

Merged
myobie merged 1 commit into
mainfrom
feat-network-env
Jul 21, 2026
Merged

convoy: NetworkConfig.env — a network-wide agent env map in convoy.toml#104
myobie merged 1 commit into
mainfrom
feat-network-env

Conversation

@myobie

@myobie myobie commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a network-wide agent env map — an env field in <net>/convoy.toml — merged into every agent's derived pty.toml session env at render (both the harness and the ding session).

This is the general primitive cos asked for: the fleet-wide runtime-knob seam. Its first use is the ding cutover — one re-render bakes both ding=rust (via #99) and PTY_REAP_ON_EXIT=false (preserve finished sessions network-wide; the pty daemon reads it from its own env, so it must land on both sessions).

Precedence (safety)

networkEnv < spec.env < derived wiring:

  • the derived wiring always winsST_AGENT/ST_ROOT/PTY_ROOT are correct-by-construction, so a network (or per-agent) key can never repoint an agent at another bus;
  • a per-agent env overrides a network default (network is the fleet baseline).

Details

  • network-config.tsenv?: Record<string,string> on NetworkConfig, with isEnvMap validation: a non-string-map (e.g. a numeric value or nested table) is dropped whole, never surfaced as a half-valid launch env; read + write.
  • launch.tswritePtyToml reads the network config once (ding + env), merges networkEnv under the derived wiring on the harness session and on the ding session ({ ...networkEnv, ...env }).

Tests

+2 (535 total pass, typecheck clean): network-config round-trip + invalid-map-dropped; writePtyToml puts the knob on both sessions, the derived wiring wins over a hijack attempt, and a per-agent key overrides the network default.

Set via a hand-edit / writeNetworkConfig (the net config is the human-readable source of truth) — no CLI setter in this PR. Next: the staged hetz ding cutover uses it (ding=rust + env.PTY_REAP_ON_EXIT=false), canary agent first, myself last.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MCzqQKSpPiNX2ketyubByS

Adds an `env` field to <net>/convoy.toml: a string->string map merged into EVERY
agent's derived pty.toml session env at render — BOTH the harness and the ding
session — UNDER the derived wiring (ST_AGENT/ST_ROOT/PTY_ROOT always win, so a
network key can't repoint the agent at another bus). A per-agent `env` still
overrides a network default. Unset -> no network env.

This is the fleet-wide runtime-knob seam: e.g. PTY_REAP_ON_EXIT=false to preserve
finished sessions network-wide (the pty daemon reads it from its OWN env, so it
must go on both sessions). Pairs with the ding selector (#99) so ONE re-render
bakes both ding=rust and PTY_REAP_ON_EXIT=false.

- network-config.ts: env field + isEnvMap validation (a non-string-map is dropped
  whole, never a half-valid launch env), read + write.
- launch.ts: precedence networkEnv < spec.env < derived wiring, on both sessions.
- +2 tests: round-trip/validation; both-sessions + derived-wins + per-agent-override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MCzqQKSpPiNX2ketyubByS
@myobie
myobie merged commit 4c586a4 into main Jul 21, 2026
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant