From 42e87b6684ea81b7d950597c5cbc2ba75faee85d Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 9 Oct 2025 13:57:57 -0300 Subject: [PATCH 1/3] fix: lint Signed-off-by: Carlos Alexandro Becker --- internal/llm/agent/mcp-tools.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/llm/agent/mcp-tools.go b/internal/llm/agent/mcp-tools.go index ae81a306b7981713b9faefc6cde860b640a2b5cf..7ef24148c93c7c9d08156e25f59b55e1327c3534 100644 --- a/internal/llm/agent/mcp-tools.go +++ b/internal/llm/agent/mcp-tools.go @@ -335,7 +335,11 @@ func updateMcpTools(mcpName string, tools []tools.BaseTool) { } func createMCPSession(ctx context.Context, name string, m config.MCPConfig, resolver config.VariableResolver) (*mcp.ClientSession, error) { - transport, err := createMCPTransport(m, resolver) + timeout := mcpTimeout(m) + mcpCtx, cancel := context.WithCancel(ctx) + cancelTimer := time.AfterFunc(timeout, cancel) + + transport, err := createMCPTransport(mcpCtx, m, resolver) if err != nil { updateMCPState(name, MCPStateError, err, nil, 0) slog.Error("error creating mcp client", "error", err, "name", name) @@ -359,10 +363,6 @@ func createMCPSession(ctx context.Context, name string, m config.MCPConfig, reso }, ) - timeout := mcpTimeout(m) - mcpCtx, cancel := context.WithCancel(ctx) - cancelTimer := time.AfterFunc(timeout, cancel) - session, err := client.Connect(mcpCtx, transport, nil) if err != nil { updateMCPState(name, MCPStateError, maybeTimeoutErr(err, timeout), nil, 0) @@ -384,7 +384,7 @@ func maybeTimeoutErr(err error, timeout time.Duration) error { return err } -func createMCPTransport(m config.MCPConfig, resolver config.VariableResolver) (mcp.Transport, error) { +func createMCPTransport(ctx context.Context, m config.MCPConfig, resolver config.VariableResolver) (mcp.Transport, error) { switch m.Type { case config.MCPStdio: command, err := resolver.ResolveValue(m.Command) @@ -394,7 +394,7 @@ func createMCPTransport(m config.MCPConfig, resolver config.VariableResolver) (m if strings.TrimSpace(command) == "" { return nil, fmt.Errorf("mcp stdio config requires a non-empty 'command' field") } - cmd := exec.Command(home.Long(command), m.Args...) + cmd := exec.CommandContext(ctx, home.Long(command), m.Args...) cmd.Env = m.ResolvedEnv() return &mcp.CommandTransport{ Command: cmd, From 886bb7c7101ec637104d17b34dce8573e1daa5ee Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 9 Oct 2025 19:32:10 +0200 Subject: [PATCH 2/3] fix(mcp): fix ui description, double spaces (#1210) Signed-off-by: Carlos Alexandro Becker --- internal/tui/components/core/core.go | 7 +++++-- .../core/testdata/TestStatus/EmptyDescription.golden | 2 +- internal/tui/components/mcp/mcp.go | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/tui/components/core/core.go b/internal/tui/components/core/core.go index 18de56b17f08e4513bde34fe9fef7aaf4e08c09f..80c28ba1e11c4ddeb7e6da1f4802577d23e8b4dc 100644 --- a/internal/tui/components/core/core.go +++ b/internal/tui/components/core/core.go @@ -110,14 +110,17 @@ func Status(opts StatusOpts, width int) string { extraContentWidth += 1 } description = ansi.Truncate(description, width-lipgloss.Width(icon)-lipgloss.Width(title)-2-extraContentWidth, "…") + description = t.S().Base.Foreground(descriptionColor).Render(description) } - description = t.S().Base.Foreground(descriptionColor).Render(description) content := []string{} if icon != "" { content = append(content, icon) } - content = append(content, title, description) + content = append(content, title) + if description != "" { + content = append(content, description) + } if opts.ExtraContent != "" { content = append(content, opts.ExtraContent) } diff --git a/internal/tui/components/core/testdata/TestStatus/EmptyDescription.golden b/internal/tui/components/core/testdata/TestStatus/EmptyDescription.golden index 5b396377658610dd0fbc0746fd960f2faaf76f49..db4acad54383ecbc2cc50061ee5ba77491dc545d 100644 --- a/internal/tui/components/core/testdata/TestStatus/EmptyDescription.golden +++ b/internal/tui/components/core/testdata/TestStatus/EmptyDescription.golden @@ -1 +1 @@ -● Title Only  \ No newline at end of file +● Title Only \ No newline at end of file diff --git a/internal/tui/components/mcp/mcp.go b/internal/tui/components/mcp/mcp.go index d11826b77749ba65276b5336a5d88cdbc8552881..fd3bd012732397538cc263b2eff92ae617e866d8 100644 --- a/internal/tui/components/mcp/mcp.go +++ b/internal/tui/components/mcp/mcp.go @@ -55,7 +55,7 @@ func RenderMCPList(opts RenderOptions) []string { // Determine icon and color based on state icon := t.ItemOfflineIcon - description := l.MCP.Command + description := "" extraContent := "" if state, exists := mcpStates[l.Name]; exists { From 390983a851b54d39b5812bd5aaaab2101703ca14 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 9 Oct 2025 14:46:11 -0300 Subject: [PATCH 3/3] chore: allow to pass args to task run Signed-off-by: Carlos Alexandro Becker --- Taskfile.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 13c171ed2e67faa9aa87c6f9f7d0ec3b7018f382..1c4225158fc21508e8dccac8d6f47610f7d81faf 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -38,7 +38,7 @@ tasks: run: desc: Run build cmds: - - go run . + - go run . {{.CLI_ARGS}} test: desc: Run tests @@ -104,6 +104,6 @@ tasks: - git push origin --tags fetch-tags: - cmds: + cmds: - git tag -d nightly || true - git fetch --tags