diff --git a/internal/agent/options.go b/internal/agent/options.go index 72f8f05..1465fed 100644 --- a/internal/agent/options.go +++ b/internal/agent/options.go @@ -37,6 +37,12 @@ func buildOptions(cfg *config.Config, opts Options) ([]claude.Option, error) { claude.WithMaxTurns(cfg.Agent.MaxTurns), claude.WithPermissionMode(cfg.Agent.PermissionMode), claude.WithAllowedTools(allowedToolPattern...), + // Required by recent versions of the claude CLI when combined + // with --print and --output-format=stream-json — without it the + // subprocess exits immediately with "requires --verbose". The + // SDK passes through cfg.Verbose to the subprocess's --verbose + // flag; archy always wants this so we hardcode true. + claude.WithVerbose(true), } if opts.CLIPath != "" { out = append(out, claude.WithCLIPath(opts.CLIPath)) diff --git a/internal/agent/options_test.go b/internal/agent/options_test.go index add8a9a..bd01a07 100644 --- a/internal/agent/options_test.go +++ b/internal/agent/options_test.go @@ -42,9 +42,10 @@ func TestBuildOptions_IncludesModelMaxTurnsPermission(t *testing.T) { User: testIdentity(), }) require.NoError(t, err) - // 4 base options (model, max-turns, permission, allowed-tools) + 1 archy MCP server = 5. - // External MCPs in baseline config = 0. - assert.Equal(t, 5, applyOpts(t, opts)) + // 5 base options (model, max-turns, permission, allowed-tools, + // verbose) + 1 archy MCP server = 6. External MCPs in baseline + // config = 0. + assert.Equal(t, 6, applyOpts(t, opts)) } func TestBuildOptions_RegistersExternalEnabledMCPServer(t *testing.T) { @@ -54,7 +55,7 @@ func TestBuildOptions_RegistersExternalEnabledMCPServer(t *testing.T) { } opts, err := buildOptions(cfg, Options{ArchyBinaryPath: "/fake/archy", User: testIdentity()}) require.NoError(t, err) - assert.Equal(t, 6, applyOpts(t, opts), "5 base/archy + 1 external") + assert.Equal(t, 7, applyOpts(t, opts), "6 base/archy + 1 external") } func TestBuildOptions_SkipsDisabledExternalMCPServer(t *testing.T) { @@ -64,7 +65,7 @@ func TestBuildOptions_SkipsDisabledExternalMCPServer(t *testing.T) { } opts, err := buildOptions(cfg, Options{ArchyBinaryPath: "/fake/archy", User: testIdentity()}) require.NoError(t, err) - assert.Equal(t, 5, applyOpts(t, opts)) + assert.Equal(t, 6, applyOpts(t, opts)) } func TestBuildOptions_ExternalServerBadScheme(t *testing.T) {