feat(acp): Supervisor.Spawn extraEnv parameter

- extraEnv overrides agent_kinds.encrypted_env same-name keys (spec §6.1 #11)
- Prevents admin from hard-coding ACW_MCP_TOKEN in agent_kinds
- SessionService passes nil for now; system token wiring lands in I4
- BuildSpawnEnv exported for testing the override priority
- Fix app.go NewSupervisor call to match updated signature (from I5)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-08 12:46:50 +08:00
parent 3a448cee5f
commit d44ffc851f
5 changed files with 70 additions and 9 deletions
+3 -3
View File
@@ -86,7 +86,7 @@ func TestSupervisor_HappyPath_Spawn_Handshake(t *testing.T) {
require.True(t, ok)
sup := newSupervisorForTest(t, pool, repo, true)
proc, err := sup.Spawn(ctx, sess, k)
proc, err := sup.Spawn(ctx, sess, k, nil)
require.NoError(t, err)
require.NotNil(t, proc)
@@ -163,7 +163,7 @@ func TestSupervisor_HangAgent_HandshakeTimeout(t *testing.T) {
slogDiscard(),
)
_, err = sup.Spawn(ctx, sess, k)
_, err = sup.Spawn(ctx, sess, k, nil)
require.Error(t, err, "hang agent must trigger handshake timeout")
deadline := time.After(5 * time.Second)
@@ -215,7 +215,7 @@ func TestSupervisor_AgentCrashes(t *testing.T) {
require.True(t, ok)
sup := newSupervisorForTest(t, pool, repo, true)
proc, err := sup.Spawn(ctx, sess, k)
proc, err := sup.Spawn(ctx, sess, k, nil)
require.NoError(t, err)
require.NotNil(t, proc)