Skip to content

feat(supervisor): single-declaration baseSpawnEnv for every agent CLI spawn - #588

Merged
SDSLeon merged 1 commit into
masterfrom
poracode/daring-willow-17ce1dea
Aug 20, 2026
Merged

feat(supervisor): single-declaration baseSpawnEnv for every agent CLI spawn#588
SDSLeon merged 1 commit into
masterfrom
poracode/daring-willow-17ce1dea

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduces baseSpawnEnv as the single declaration point for env that must ride every Poracode-made spawn of an agent CLI, replacing per-command-builder env duplication. In practice this is for CLIs that fire a detached background self-updater — on Windows that updater escapes its parent's pseudoconsole, allocates a fresh console, and (with Windows Terminal as the default terminal app) pops a stray terminal window mid-session.

A provider now declares its opt-out once on the DetectionSpec; shared runtime fans it out to every lane, so a new launch point picks it up for free instead of every command builder having to remember its own env.

Changes

  • base/spawnEnv.ts (new) — mergeSpawnEnv, withCommandBaseSpawnEnv, withBaseSpawnEnv, inheritBaseSpawnEnv. Adapters derive the map from their spec via ...inheritBaseSpawnEnv(spec) so the two can never drift.
  • Lane fan-out — detection probes (merged under probeEnv), terminal login (via authMethods[].env), PTY launch, ACP session/auth/logout, one-shots, context extraction, and subagent children.
  • update stays exempt — the user-driven "update agent" action must still reach the CLI's own updater.
  • New: antigravity AGY_CLI_DISABLE_AUTO_UPDATE — including the account probe, whose 5-minute TTL was exactly the cadence that kept re-arming the updater.
  • Migrated to baseSpawnEnv — commandcode, factory, and muse drop their repeated per-builder env.
  • Cache invalidationSTATUS_CACHE_VERSION 13→14 and the renderer store 10→11, since terminal auth methods now carry baseSpawnEnv-derived env; a status persisted before that derivation would build a login command without it.

Review fixes folded in

  • SubagentAttemptRunner built a CreateStructuredSessionInput by hand and never passed baseSpawnEnv, unlike SpawnPipeline — the one launch point where the "can't silently miss it" guarantee wasn't holding. Pinned with two regression tests.
  • buildFactoryCommand's env parameter replaced the base constant instead of layering on top, so a caller forwarding a narrower env would have silently dropped the opt-out out of the WSL login-shell script — the one lane where spawn-level env can't rescue it. Now merges.
  • withCommandBaseSpawnEnv is generic over the command shape, so lane extras (stdin, isolateCwd) survive the wrap.

Testing

  • pnpm run typecheck, pnpm run lint, pnpm run fmt:check — all pass.
  • pnpm exec vitest run src/supervisor src/renderer/state — 4098 passed, 1 failed. The single failure is the pre-existing gemini/plugin/install.test.ts pwsh-absolute-path assertion, in a file this branch does not touch.
  • Verified AGY_CLI_DISABLE_AUTO_UPDATE is a real string in the shipped agy.exe (adjacent to failed to check for updates), so the new opt-out is not a guess.

🤖 Generated with Claude Code

- Add base spawn environment utilities and version detection for agent adapters
- Update ACP, Antigravity, CommandCode, Muse, and Factory adapter implementations
- Improve runtime agent status service, status cache, and renderer status store
- Update title, commit message, and PR summary generators alongside crossagent MCP execution
- Add unit test coverage for session factories, spawn environment, and title generator
- Update agent adapters documentation
@SDSLeon
SDSLeon merged commit a966d99 into master Aug 20, 2026
8 checks passed
@SDSLeon
SDSLeon deleted the poracode/daring-willow-17ce1dea branch August 20, 2026 03:43
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