Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1.2 KiB
Anthropic and OAuth wire quirks
Status: accepted
Context
Anthropic OAuth tokens are accepted only with Claude Code tool-name casing. Tool ids must match [a-zA-Z0-9_-] while Codex ids look like call|item. Thinking from another provider (no signature, or a Codex reasoning item) is invalid. Cache breakpoints cover tools+system via the system block. The thinking budget counts against max_tokens. The token endpoint wants JSON for Anthropic and form encoding for OpenAI. Claude's login uses the PKCE verifier as state (matching Claude Code); Codex uses a random state.
Decision
Map tool names to Claude Code casing and sanitize ids on the way out; drop foreign thinking blocks; place rolling cache breakpoints on the last message and the user message before it (where the previous request's breakpoint sat, giving a cache read); keep max_tokens above the thinking budget; encode token requests per provider; follow each provider's state convention.
Consequences
Requests are accepted and cache well; conversion code must be kept in sync with these provider rules.
Code: crates/hx-ai/src/anthropic.rs (tool names, id sanitizing, foreign thinking, cache breakpoints, thinking budget); crates/hx-ai/src/auth.rs (token request encoding, login state)