diff --git a/internal/agentexec/inprocess.go b/internal/agentexec/inprocess.go index b38d642a6..b6e7dc137 100644 --- a/internal/agentexec/inprocess.go +++ b/internal/agentexec/inprocess.go @@ -171,7 +171,7 @@ func captureToolSet(specs []CaptureTool, captures map[string][]json.RawMessage) } var object map[string]json.RawMessage if err := json.Unmarshal(value, &object); err != nil { - return spec.Name + " rejected: arguments must be a JSON object", nil + return spec.Name + " rejected: arguments must be a JSON object", nil //nolint:nilerr // the agent loop must see malformed tool arguments as feedback it can correct, not as a failed tool call } for _, field := range spec.RequiredFields { if _, ok := object[field]; !ok { @@ -181,13 +181,13 @@ func captureToolSet(specs []CaptureTool, captures map[string][]json.RawMessage) for _, field := range spec.NonEmptyStrings { var text string if raw, ok := object[field]; !ok || json.Unmarshal(raw, &text) != nil || strings.TrimSpace(text) == "" { - return fmt.Sprintf("%s rejected: %s must be a non-empty string", spec.Name, field), nil + return fmt.Sprintf("%s rejected: %s must be a non-empty string", spec.Name, field), nil //nolint:nilerr // same: a rejection message lets the model retry with a valid argument } } for _, field := range spec.BooleanFields { var value bool if raw, ok := object[field]; !ok || json.Unmarshal(raw, &value) != nil { - return fmt.Sprintf("%s rejected: %s must be a boolean", spec.Name, field), nil + return fmt.Sprintf("%s rejected: %s must be a boolean", spec.Name, field), nil //nolint:nilerr // same: a rejection message lets the model retry with a valid argument } } captures[spec.Name] = append(captures[spec.Name], append(json.RawMessage(nil), value...)) @@ -215,11 +215,11 @@ func scriptToolSet(workspace string) core.ToolSet { Path string `json:"path"` } if err := json.Unmarshal([]byte(input), &args); err != nil || strings.TrimSpace(args.Path) == "" { - return "run_go_script rejected: arguments must be a JSON object with a non-empty path field", nil + return "run_go_script rejected: arguments must be a JSON object with a non-empty path field", nil //nolint:nilerr // same: a rejection message lets the model retry with a valid path } full := filepath.Join(workspace, args.Path) if rel, err := filepath.Rel(workspace, full); err != nil || strings.HasPrefix(rel, "..") { - return "run_go_script rejected: path escapes the workspace", nil + return "run_go_script rejected: path escapes the workspace", nil //nolint:nilerr // same: a rejection message lets the model retry with a valid path } out, err := skillscript.Run(full) if err != nil { diff --git a/internal/agentexec/worker.go b/internal/agentexec/worker.go index 844aa829a..d4a7e6194 100644 --- a/internal/agentexec/worker.go +++ b/internal/agentexec/worker.go @@ -108,7 +108,7 @@ func runStages(ctx context.Context, runner Runner, msg AgentRequestMessage, chan Error: runErr.Error(), Channel: channel, } - return resp, nil + return resp, nil //nolint:nilerr // runErr is reported to the caller in the response envelope's Error field; returning it here as well would double-report and abort the NATS reply } totalTokens += result.TokensUsed totalIter += result.Iterations diff --git a/internal/channels/email/email.go b/internal/channels/email/email.go index 0ff284279..81c83e24c 100644 --- a/internal/channels/email/email.go +++ b/internal/channels/email/email.go @@ -82,7 +82,7 @@ func (g *Gateway) Start(ctx context.Context, router *gateway.Router) error { conn, err := ln.Accept() if err != nil { if ctx.Err() != nil { - return nil + return nil //nolint:nilerr // Accept failed because the listener was closed by context cancellation, which is a clean shutdown, not a failure } g.log.Error("email accept", "err", err) continue diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go index b23429cfd..08015ea9a 100644 --- a/internal/gateway/gateway.go +++ b/internal/gateway/gateway.go @@ -340,7 +340,7 @@ func (r *Router) handleApprove(ctx context.Context, rest string) (string, error) identity, arg := parseTaskControl(rest, r.Identity) id, err := parseTaskID(arg) if err != nil { - return "Usage: /approve [identity=name] ", nil + return "Usage: /approve [identity=name] ", nil //nolint:nilerr // chat commands report problems as text to the human, never as Go errors, which would surface as a gateway fault } if err := r.Controller.Approve(ctx, id, identity); err != nil { return fmt.Sprintf("Cannot approve task %d: %v", id, err), nil @@ -355,7 +355,7 @@ func (r *Router) handleCancel(ctx context.Context, rest string) (string, error) identity, arg := parseTaskControl(rest, r.Identity) id, err := parseTaskID(arg) if err != nil { - return "Usage: /cancel [identity=name] ", nil + return "Usage: /cancel [identity=name] ", nil //nolint:nilerr // chat commands report problems as text to the human, never as Go errors, which would surface as a gateway fault } if err := r.Controller.Cancel(ctx, id, identity); err != nil { return fmt.Sprintf("Cannot cancel task %d: %v", id, err), nil diff --git a/internal/indexing/codesearch.go b/internal/indexing/codesearch.go index daf246352..24be299a9 100644 --- a/internal/indexing/codesearch.go +++ b/internal/indexing/codesearch.go @@ -523,7 +523,7 @@ func WorkspaceFiles(ctx context.Context, root string) ([]string, error) { var files []string err = filepath.WalkDir(root, func(path string, entry os.DirEntry, walkErr error) error { if walkErr != nil { - return nil + return nil //nolint:nilerr // an unreadable entry skips that path and continues the walk; a best-effort index must not abort on one bad file } if path != root && strings.HasPrefix(entry.Name(), ".") { if entry.IsDir() { diff --git a/internal/nats/client_test.go b/internal/nats/client_test.go index 4e87db305..8b23e84be 100644 --- a/internal/nats/client_test.go +++ b/internal/nats/client_test.go @@ -189,24 +189,31 @@ type mockConsumer struct { func (m *mockConsumer) Fetch(int, ...jetstream.FetchOpt) (jetstream.MessageBatch, error) { return m.batch, nil } + func (m *mockConsumer) FetchBytes(int, ...jetstream.FetchOpt) (jetstream.MessageBatch, error) { panic("FetchBytes not implemented") } + func (m *mockConsumer) FetchNoWait(int) (jetstream.MessageBatch, error) { panic("FetchNoWait not implemented") } + func (m *mockConsumer) Consume(jetstream.MessageHandler, ...jetstream.PullConsumeOpt) (jetstream.ConsumeContext, error) { panic("Consume not implemented") } + func (m *mockConsumer) Messages(...jetstream.PullMessagesOpt) (jetstream.MessagesContext, error) { panic("Messages not implemented") } + func (m *mockConsumer) Next(...jetstream.FetchOpt) (jetstream.Msg, error) { panic("Next not implemented") } + func (m *mockConsumer) Info(context.Context) (*jetstream.ConsumerInfo, error) { panic("Info not implemented") } + func (m *mockConsumer) CachedInfo() *jetstream.ConsumerInfo { panic("CachedInfo not implemented") } diff --git a/internal/skill/skill.go b/internal/skill/skill.go index 2fad425db..87b25cfe3 100644 --- a/internal/skill/skill.go +++ b/internal/skill/skill.go @@ -52,7 +52,7 @@ func Catalog(dir string) ([]CatalogEntry, error) { if err != nil { // A file at .agents/skills (ENOTDIR) is not fatal -- treat as no skills. // Same for permission errors and other non-fatal ReadDir failures. - return nil, nil + return nil, nil //nolint:nilerr // documented above: a non-directory or unreadable skills path means no skills, not a fatal error } var names []string diff --git a/internal/worktree/worktree.go b/internal/worktree/worktree.go index 94d9c944d..245bfae79 100644 --- a/internal/worktree/worktree.go +++ b/internal/worktree/worktree.go @@ -275,6 +275,7 @@ func archieBranch(issue int, title, body, labels string) string { // branchPrefix derives a conventional-commit prefix from the issue // labels, then falls back to "feat". Maps: bug→fix, feature→feat, // enhancement→feat, docs→docs, chore→chore, test→test. +// FIXME - Unused parameters title and body where they should be used. - just a missing implementation by the looks of it. func branchPrefix(title, body, labels string) string { for l := range strings.SplitSeq(labels, ",") { switch strings.TrimSpace(strings.ToLower(l)) {