From 24da509486e374024e9a03d27aab26bfdeef9cc8 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Mon, 11 May 2026 17:23:49 -0300 Subject: [PATCH] fix: properly follow the `Assisted-by` header spec (#2871) We were not using the correct format. According to the SPEC it should be: Assisted-by: AGENT_NAME:MODEL_VERSION So now it'll look like this: Assisted-by: Crush:kimi-k2.6 See: https://docs.kernel.org/process/coding-assistants.html#attribution --- README.md | 3 +-- internal/agent/coordinator.go | 6 +++--- internal/agent/tools/bash.go | 10 +++++----- internal/agent/tools/bash.tpl | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2a0c2ce75e58f307b52f073e263089b024724c3a..f2acd1af54046c313e29e8b3b7d9fc8787b429da 100644 --- a/README.md +++ b/README.md @@ -548,8 +548,7 @@ it creates. You can customize this behavior with the `attribution` option: - `trailer_style`: Controls the attribution trailer added to commit messages (default: `assisted-by`) - - `assisted-by`: Adds `Assisted-by: [Model Name] via Crush ` - (includes the model name) + - `assisted-by`: Adds `Assisted-by: Crush:[ModelID]` as specified in [the convention](https://docs.kernel.org/process/coding-assistants.html#attribution) - `co-authored-by`: Adds `Co-Authored-By: Crush ` - `none`: No attribution trailer - `generated_with`: When true (default), adds `💘 Generated with Crush` line to diff --git a/internal/agent/coordinator.go b/internal/agent/coordinator.go index 468397c07336fc1b52288462d53a71772ea566d7..106e637a1d6f6b5a1456bae326547717a2cb8789 100644 --- a/internal/agent/coordinator.go +++ b/internal/agent/coordinator.go @@ -458,10 +458,10 @@ func (c *coordinator) buildTools(ctx context.Context, agent config.Agent, isSubA } // Get the model name for the agent - modelName := "" + modelID := "" if modelCfg, ok := c.cfg.Config().Models[agent.Model]; ok { if model := c.cfg.Config().GetModel(modelCfg.Provider, modelCfg.Model); model != nil { - modelName = model.Name + modelID = model.ID } } @@ -474,7 +474,7 @@ func (c *coordinator) buildTools(ctx context.Context, agent config.Agent, isSubA } allTools = append(allTools, - tools.NewBashTool(c.permissions, c.cfg.WorkingDir(), c.cfg.Config().Options.Attribution, modelName), + tools.NewBashTool(c.permissions, c.cfg.WorkingDir(), c.cfg.Config().Options.Attribution, modelID), tools.NewCrushInfoTool(c.cfg, c.lspManager, c.allSkills, c.activeSkills, c.skillTracker), tools.NewCrushLogsTool(logFile), tools.NewJobOutputTool(), diff --git a/internal/agent/tools/bash.go b/internal/agent/tools/bash.go index 83557137e769b8e949dec32aaf09909a355c2106..41b767244819399778d16bfedb818e187b4073be 100644 --- a/internal/agent/tools/bash.go +++ b/internal/agent/tools/bash.go @@ -65,7 +65,7 @@ type bashDescriptionData struct { BannedCommands string MaxOutputLength int Attribution config.Attribution - ModelName string + ModelID string } var bannedCommands = []string{ @@ -141,14 +141,14 @@ var bannedCommands = []string{ "ufw", } -func bashDescription(attribution *config.Attribution, modelName string) string { +func bashDescription(attribution *config.Attribution, modelID string) string { bannedCommandsStr := strings.Join(bannedCommands, ", ") var out bytes.Buffer if err := bashDescriptionTpl.Execute(&out, bashDescriptionData{ BannedCommands: bannedCommandsStr, MaxOutputLength: MaxOutputLength, Attribution: *attribution, - ModelName: modelName, + ModelID: modelID, }); err != nil { // this should never happen. panic("failed to execute bash description template: " + err.Error()) @@ -188,10 +188,10 @@ func blockFuncs() []shell.BlockFunc { } } -func NewBashTool(permissions permission.Service, workingDir string, attribution *config.Attribution, modelName string) fantasy.AgentTool { +func NewBashTool(permissions permission.Service, workingDir string, attribution *config.Attribution, modelID string) fantasy.AgentTool { return fantasy.NewAgentTool( BashToolName, - string(bashDescription(attribution, modelName)), + string(bashDescription(attribution, modelID)), func(ctx context.Context, params BashParams, call fantasy.ToolCall) (fantasy.ToolResponse, error) { if params.Command == "" { return fantasy.NewTextErrorResponse("missing command"), nil diff --git a/internal/agent/tools/bash.tpl b/internal/agent/tools/bash.tpl index 2d9999b849785b900b424eff27917f29e6d97f8e..cfdc6b107e4e9a521341b6d3674badd20fca6c22 100644 --- a/internal/agent/tools/bash.tpl +++ b/internal/agent/tools/bash.tpl @@ -69,7 +69,7 @@ When user asks to create git commit: {{ end}} {{if eq .Attribution.TrailerStyle "assisted-by" }} - Assisted-by: {{ .ModelName }} via Crush + Assisted-by: Crush:{{ .ModelID }} {{ else if eq .Attribution.TrailerStyle "co-authored-by" }} Co-Authored-By: Crush