Skip to content

fix: honor per-role command/platform/model when spawning through AgentRuntime#250

Merged
windoliver merged 1 commit intomainfrom
fix/207-honor-per-role-runtime-selection
Apr 14, 2026
Merged

fix: honor per-role command/platform/model when spawning through AgentRuntime#250
windoliver merged 1 commit intomainfrom
fix/207-honor-per-role-runtime-selection

Conversation

@windoliver
Copy link
Copy Markdown
Owner

Summary

Closes #207.

  • AgentConfig/AgentSession extended with platform, model, agent fields
  • AcpxRuntime resolves backend via platform → command → default chain; caches isAvailable(); multi-agent listSessions() + discoverSessions() for reattach; write streams replace appendFileSync
  • SessionOrchestrator merges profile > role > default via mergeRuntimeConfig(); passes platform, model, goal from topology
  • TUI screen-manager and advanced palette pass platform/model to spawn context; prompt no longer embedded in command string (shell injection fix); launch-preview override respected
  • DRY shellEscape extracted to shell-utils.ts
  • All runtimes export GROVE_AGENT_PLATFORM/GROVE_AGENT_MODEL env vars

Live validation

Coder:    agent=codex  platform=codex       model=gpt-4.1          → "I AM CODEX BACKEND"
Reviewer: agent=claude platform=claude-code model=claude-opus-4-6  → "I AM CLAUDE BACKEND"
Different backends? YES ✓

Test plan

  • 97 targeted tests pass (shell-utils, merge-runtime-config, acpx-resolve-agent, agent-runtime, session-orchestrator, acpx-runtime, platform-integration)
  • 4996 full suite — 4995 pass, 1 pre-existing timeout (bare grove TUI dispatch)
  • TypeScript clean, Biome clean
  • Live e2e: codex + claude spawn on distinct backends, metadata survives reattach
  • Codex adversarial review: 4 findings, all fixed

…tRuntime

Closes #207. Topology roles and agent profiles define command, platform,
and model fields but the runtime ignored them — every agent spawned on
the constructor-level default backend.

Interface changes:
- AgentConfig: add platform?, model? fields
- AgentSession: add platform?, model?, agent? metadata
- SessionConfig: accept optional AgentProfile[] for overlay

Runtime changes (AcpxRuntime):
- resolveAgent(): platform → command parsing → constructor default
- PLATFORM_TO_AGENT mapping (claude-code→claude, codex→codex, etc.)
- Cached isAvailable() (no execSync per spawn)
- Write streams instead of appendFileSync in data path
- Multi-agent listSessions() + discoverSessions() for reattach
- Session metadata preserved through spawn and reattach
- GROVE_AGENT_PLATFORM/MODEL env vars exported

Orchestrator changes:
- mergeRuntimeConfig(): profile > role > default (pure function)
- Passes platform, model, goal from topology roles
- Uses role.goal in goal composition

TUI changes:
- screen-manager: passes role.platform/model to spawn context;
  skips stale platform when user overrides CLI in launch preview
- spawn-manager: prompt no longer embedded in command string (security);
  uses composed initialPrompt as goal (not bare session goal)
- app.tsx: advanced palette passes platform/model/goal to context

DRY: shellEscape extracted to shared shell-utils.ts

Tests: 97 targeted tests (0 fail), 4996 full suite (1 pre-existing).
Live validation: codex + claude sessions spawn on distinct backends,
metadata survives reattach, discoverSessions finds both.
@windoliver windoliver force-pushed the fix/207-honor-per-role-runtime-selection branch from 5405fe6 to ad9b0f0 Compare April 14, 2026 05:43
@windoliver windoliver merged commit e761c2e into main Apr 14, 2026
1 check passed
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.

fix: honor per-role command/platform/model when spawning through AgentRuntime

1 participant