diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..9d1a707 --- /dev/null +++ b/TODO.md @@ -0,0 +1,19 @@ +## Self-Review: feat/aicore-provider — 2026-05-09 + +### Verdict: PASS + +No blocking issues found — ready for human review. + +#### Notes (informational, not blocking) + +**[fit]** `staticcheck` reports: +- `llm/aicore.go:237` and `llm/client.go:231`: struct literal conversion style (S1016) — minor style nit, existing in both old and new code +- `gitea/diff.go:78`: HasPrefix return ignored (SA4017) — pre-existing, not introduced by this PR +- `cmd/review-bot/main_test.go:347`: nil Context (SA1012) — pre-existing, not introduced by this PR + +**[fit]** Body length validation: `aicore.go` does not include the Content-Length vs body length validation that `doRequest` has in `client.go`. This is acceptable because: +1. AI Core uses OAuth tokens which are short-lived, so truncation is less likely +2. The retry logic still applies via "read response" error pattern +3. Adding complexity to aicore.go for an edge case that hasn't manifested is premature + +**[completeness]** Tests pass (go test ./...), go vet clean, no uncommitted changes. diff --git a/llm/aicore.go b/llm/aicore.go index cc3cd45..4ec7295 100644 --- a/llm/aicore.go +++ b/llm/aicore.go @@ -253,6 +253,7 @@ func (c *AICoreClient) CompleteAnthropic(ctx context.Context, model string, mess } reqBody := anthropicRequest{ + AnthropicVersion: "2023-06-01", Model: model, MaxTokens: maxTokens, System: system, @@ -276,7 +277,6 @@ func (c *AICoreClient) CompleteAnthropic(ctx context.Context, model string, mess req.Header.Set("Authorization", "Bearer "+token) req.Header.Set("AI-Resource-Group", c.config.ResourceGroup) req.Header.Set("Content-Type", "application/json") - req.Header.Set("anthropic-version", "2023-06-01") resp, err := c.http.Do(req) if err != nil { diff --git a/llm/client.go b/llm/client.go index bc2b6a1..a7ae1d4 100644 --- a/llm/client.go +++ b/llm/client.go @@ -206,6 +206,7 @@ func (c *Client) completeOpenAI(ctx context.Context, messages []Message) (string // --- Anthropic Messages API implementation --- type anthropicRequest struct { + AnthropicVersion string `json:"anthropic_version,omitempty"` Model string `json:"model"` MaxTokens int `json:"max_tokens"` System string `json:"system,omitempty"`