Skip to content

Migrate to anthropic 1.x (pinned to <1 as a stopgap) #2273

Description

@JSv4

anthropic published 1.0.0 (previous release 0.125.0). It reached us unannounced and turned main red — see #2272 for the incident and the immediate fix.

Stopgap now in place

requirements/analyzers/claude_highlighter.txt is pinned to anthropic>=0.45.2,<1, and the mypy hook's additional_dependencies carries the same ceiling so CI type-checks against the major the image actually ships.

Note <2 would not have worked1.0.0 < 2, so it resolves straight to 1.0.0. Verified:

anthropic>=0.45.2        -> 1.0.0
anthropic>=0.45.2,<2     -> 1.0.0     # no-op
anthropic>=0.45.2,<1     -> 0.125.0   # holds the line

This is a stopgap, not the fix. It freezes us on the 0.x line rather than migrating.

What "doing it right" needs

  • Read the 1.0.0 release notes end to end. We only found the temperature removal because it happened to break mypy. A major release almost certainly changed more than the one thing that tripped a type check — the absence of other errors is not evidence of their absence, since most of our SDK surface isn't type-checked at that depth.
  • Audit every SDK call site against the new contract. Currently only two direct messages.create() calls (doc_analysis_tasks.py), but check for client.* usage elsewhere and in analyzers.
  • Check pydantic-ai's anthropic integration. It pulls anthropic transitively via pydantic-ai-slim[...,anthropic,...]; confirm which major it supports before we lift our ceiling, or the two constraints will fight.
  • Re-evaluate the sampling-parameter removal. temperature/top_p/top_k are gone from the API on Opus 4.7+ and rejected on Sonnet 5. fix: anthropic 1.0.0 broke messages.create — drop temperature, pin <1 (unblocks main) #2272 drops the two usages; decide whether anything else depended on them for determinism, and what replaces that (prompting, or output_config.effort).
  • Lift the <1 ceiling in both places once the above is done.

Related, surfaced by the same investigation

  • CLAUDE_ANALYZER_DEFAULT_MODEL = "claude-3-5-sonnet-latest" (constants/llm.py:65) names a model retired 2025-10-28. That default 404s unless every deployment overrides ANTHROPIC_MODEL via ANALYZER_KWARGS. Independent of the SDK bump.
  • Consider a constraints/lock file. There is none, so every image build re-resolves to latest. anthropic>=0.45.2 was the only unbounded direct dependency that could move a major — worth a sweep of requirements/ to confirm, and worth deciding whether pinning-by-convention is enough or we want a lock.

Why this bit CI before anything else

pre-commit rebuilds its hook environments from scratch on every run, so CI resolves fresh dependencies constantly while the django image only re-resolves when it is rebuilt. That is why main went red with no commit touching the code — and why a green deployment can be running a different anthropic than the one CI just tested against.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions