publishCompactionError sends a tool-result error part so connected clients see that compaction failed.
(config CompactionOptions, msg string)
| 183 | // publishCompactionError sends a tool-result error part so |
| 184 | // connected clients see that compaction failed. |
| 185 | func publishCompactionError(config CompactionOptions, msg string) { |
| 186 | if config.PublishMessagePart == nil || config.ToolCallID == "" { |
| 187 | return |
| 188 | } |
| 189 | errJSON, _ := json.Marshal(map[string]any{ |
| 190 | "error": msg, |
| 191 | }) |
| 192 | config.PublishMessagePart( |
| 193 | codersdk.ChatMessageRoleTool, |
| 194 | codersdk.ChatMessageToolResult(config.ToolCallID, config.ToolName, errJSON, true, false), |
| 195 | ) |
| 196 | } |
| 197 | |
| 198 | // normalizedCompactionConfig returns a copy of the compaction options |
| 199 | // with defaults applied. The bool is false when compaction is |
no test coverage detected