Skip to content

chore: sync upstream main into coder_2_33#42

Open
ethanndickson wants to merge 96 commits into
coder_2_33from
sync-v0.29.1-bedrock
Open

chore: sync upstream main into coder_2_33#42
ethanndickson wants to merge 96 commits into
coder_2_33from
sync-v0.29.1-bedrock

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

Summary

  • Sync upstream charmbracelet/fantasy main into coder_2_33 while keeping the remaining Coder-specific delta reviewable.
  • Preserve Coder Bedrock compatibility for inference-profile-qualified model IDs and configured regions.
  • Carry forward Anthropic replay metadata diagnostics and OpenAI Responses computer-use / continuity support.
  • Minimize non-essential fork divergence by restoring upstream Kronk/examples, style-only changes, cached-token accounting, and additive provider options.

Notes

Supersedes #40.

dependabot Bot and others added 30 commits March 30, 2026 09:33
Bumps the all group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [cloud.google.com/go/auth](https://github.com/googleapis/google-cloud-go) | `0.18.2` | `0.19.0` |
| [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) | `1.41.4` | `1.41.5` |
| [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) | `1.32.12` | `1.32.13` |
| [github.com/kaptinlin/jsonschema](https://github.com/kaptinlin/jsonschema) | `0.7.6` | `0.7.7` |
| [google.golang.org/genai](https://github.com/googleapis/go-genai) | `1.51.0` | `1.52.0` |


Updates `cloud.google.com/go/auth` from 0.18.2 to 0.19.0
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](googleapis/google-cloud-go@auth/v0.18.2...v0.19.0)

Updates `github.com/aws/aws-sdk-go-v2` from 1.41.4 to 1.41.5
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@v1.41.4...v1.41.5)

Updates `github.com/aws/aws-sdk-go-v2/config` from 1.32.12 to 1.32.13
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.32.12...config/v1.32.13)

Updates `github.com/kaptinlin/jsonschema` from 0.7.6 to 0.7.7
- [Commits](kaptinlin/jsonschema@v0.7.6...v0.7.7)

Updates `google.golang.org/genai` from 1.51.0 to 1.52.0
- [Release notes](https://github.com/googleapis/go-genai/releases)
- [Changelog](https://github.com/googleapis/go-genai/blob/v1.52.0/CHANGELOG.md)
- [Commits](googleapis/go-genai@v1.51.0...v1.52.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/auth
  dependency-version: 0.19.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-version: 1.41.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-version: 1.32.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: github.com/kaptinlin/jsonschema
  dependency-version: 0.7.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: google.golang.org/genai
  dependency-version: 1.52.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the all group with 3 updates: [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2), [github.com/aws/smithy-go](https://github.com/aws/smithy-go) and [google.golang.org/genai](https://github.com/googleapis/go-genai).


Updates `github.com/aws/aws-sdk-go-v2/config` from 1.32.13 to 1.32.14
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.32.13...config/v1.32.14)

Updates `github.com/aws/smithy-go` from 1.24.2 to 1.24.3
- [Release notes](https://github.com/aws/smithy-go/releases)
- [Changelog](https://github.com/aws/smithy-go/blob/main/CHANGELOG.md)
- [Commits](aws/smithy-go@v1.24.2...v1.24.3)

Updates `google.golang.org/genai` from 1.52.0 to 1.52.1
- [Release notes](https://github.com/googleapis/go-genai/releases)
- [Changelog](https://github.com/googleapis/go-genai/blob/main/CHANGELOG.md)
- [Commits](googleapis/go-genai@v1.52.0...v1.52.1)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-version: 1.32.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: github.com/aws/smithy-go
  dependency-version: 1.24.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: google.golang.org/genai
  dependency-version: 1.52.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…mbracelet#194)

Bumps the kronk group with 1 update: [github.com/ardanlabs/kronk](https://github.com/ardanlabs/kronk).


Updates `github.com/ardanlabs/kronk` from 1.21.4 to 1.22.0
- [Release notes](https://github.com/ardanlabs/kronk/releases)
- [Commits](ardanlabs/kronk@v1.21.4...v1.22.0)

---
updated-dependencies:
- dependency-name: github.com/ardanlabs/kronk
  dependency-version: 1.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kronk
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Wait until streaming has finished before dispatching tool calls to avoid
getting tool results without a matching call: essentially orphans.
Bumps the all group with 4 updates: [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2), [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2), [github.com/aws/smithy-go](https://github.com/aws/smithy-go) and [google.golang.org/genai](https://github.com/googleapis/go-genai).


Updates `github.com/aws/aws-sdk-go-v2` from 1.41.5 to 1.41.6
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@v1.41.5...v1.41.6)

Updates `github.com/aws/aws-sdk-go-v2/config` from 1.32.14 to 1.32.16
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.32.14...config/v1.32.16)

Updates `github.com/aws/smithy-go` from 1.24.3 to 1.25.0
- [Release notes](https://github.com/aws/smithy-go/releases)
- [Changelog](https://github.com/aws/smithy-go/blob/main/CHANGELOG.md)
- [Commits](aws/smithy-go@v1.24.3...v1.25.0)

Updates `google.golang.org/genai` from 1.53.0 to 1.54.0
- [Release notes](https://github.com/googleapis/go-genai/releases)
- [Changelog](https://github.com/googleapis/go-genai/blob/main/CHANGELOG.md)
- [Commits](googleapis/go-genai@v1.53.0...v1.54.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-version: 1.41.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-version: 1.32.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: github.com/aws/smithy-go
  dependency-version: 1.25.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: google.golang.org/genai
  dependency-version: 1.54.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…mbracelet#207)

Bumps the kronk group with 1 update: [github.com/ardanlabs/kronk](https://github.com/ardanlabs/kronk).


Updates `github.com/ardanlabs/kronk` from 1.22.2 to 1.23.1
- [Release notes](https://github.com/ardanlabs/kronk/releases)
- [Commits](ardanlabs/kronk@v1.22.2...v1.23.1)

---
updated-dependencies:
- dependency-name: github.com/ardanlabs/kronk
  dependency-version: 1.23.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kronk
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ent on tool call messages (charmbracelet#196)

Some OpenAI-compatible providers (e.g. Moonshot AI/Kimi) send reasoning
content under the "reasoning" JSON field rather than "reasoning_content".
The ReasoningData struct only looked for "reasoning_content", silently
dropping all reasoning from these providers.

Additionally, when thinking is enabled, providers like Kimi require
reasoning_content to be present on all assistant tool call messages,
even if empty. Without this, multi-turn conversations with tool calls
fail with "thinking is enabled but reasoning_content is missing".

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bumps the all group with 2 updates: [github.com/aws/smithy-go](https://github.com/aws/smithy-go) and [github.com/kaptinlin/jsonschema](https://github.com/kaptinlin/jsonschema).


Updates `github.com/aws/smithy-go` from 1.25.0 to 1.25.1
- [Release notes](https://github.com/aws/smithy-go/releases)
- [Changelog](https://github.com/aws/smithy-go/blob/main/CHANGELOG.md)
- [Commits](aws/smithy-go@v1.25.0...v1.25.1)

Updates `github.com/kaptinlin/jsonschema` from 0.7.7 to 0.7.11
- [Commits](kaptinlin/jsonschema@v0.7.7...v0.7.11)

---
updated-dependencies:
- dependency-name: github.com/aws/smithy-go
  dependency-version: 1.25.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: github.com/kaptinlin/jsonschema
  dependency-version: 0.7.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>
andreynering and others added 29 commits May 26, 2026 14:53
…mbracelet#263)

Bumps the kronk group with 1 update: [github.com/ardanlabs/kronk](https://github.com/ardanlabs/kronk).


Updates `github.com/ardanlabs/kronk` from 1.26.1 to 1.26.6
- [Release notes](https://github.com/ardanlabs/kronk/releases)
- [Commits](ardanlabs/kronk@v1.26.1...v1.26.6)

---
updated-dependencies:
- dependency-name: github.com/ardanlabs/kronk
  dependency-version: 1.26.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: kronk
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the all group with 1 update in the / directory: [github.com/kaptinlin/jsonschema](https://github.com/kaptinlin/jsonschema).


Updates `github.com/kaptinlin/jsonschema` from 0.7.14 to 0.7.15
- [Release notes](https://github.com/kaptinlin/jsonschema/releases)
- [Commits](kaptinlin/jsonschema@v0.7.14...v0.7.15)

---
updated-dependencies:
- dependency-name: github.com/kaptinlin/jsonschema
  dependency-version: 0.7.15
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Anthropic's DocumentBlockParam exposes a Title field that the model
uses when it refers back to an attached document. Forward FilePart.Filename
into that field so users can ask the model about a document by name.

The title is sanitized first: Anthropic restricts titles to alphanumerics,
whitespace, hyphens, parentheses, and square brackets, and returns
'The document file name can only contain alphanumeric characters,
whitespace characters, hyphens, parentheses, and square brackets.' for
any title containing other runes. Disallowed runes are replaced with
spaces, runs of whitespace are collapsed, and the result is trimmed.
Empty or fully disallowed input falls back to 'Document' so every
attached document has a stable handle, matching the invariant the
OpenAI provider already enforces with its part-N.pdf synthetic name.

The sanitizer is a Go port of the implementation in coder/mux
(src/node/utils/messages/sanitizeAnthropicDocumentFilename.ts); prior
art for sending filename as title also includes vercel/ai's
@ai-sdk/anthropic, which sets document.title from part.filename when
no provider-options title is supplied.
…ed media types

Mirror the PDF document-title handling on the text/* document branch
so text attachments also reach Anthropic with a stable handle the model
can refer back to. The filename runs through the same sanitizer; an
empty or fully disallowed filename falls back to 'Document'.

Also add a default case to the file MediaType switch that emits a
CallWarning when a FilePart's media type is not handled. Previously
the Anthropic provider silently dropped any file with a media type
other than image/*, application/pdf, or text/*, so unsupported
attachments left no trace for the caller. The new behavior matches
the openai, openaicompat, openrouter, and vercel providers, which
already warn on unsupported FilePart media types.
- Adds a typed Anthropic `ThinkingDisplay` provider option with `summarized`
  and `omitted` values.
- Sends `thinking.display` for adaptive thinking and budget-token thinking,
  defaulting omitted-display models to `summarized` when thinking is enabled.
- Converts budget-token thinking on adaptive-only models to adaptive thinking,
  while preserving plain Opus 4.7+ calls without a `thinking` field.
…kens (charmbracelet#272)

Both Vercel and OpenRouter APIs return prompt_tokens that INCLUDE cached
tokens, similar to OpenAI. The providers were using this value directly
as InputTokens, causing double-counting when cache is present.

Changes:
- Subtract cached tokens from prompt_tokens to get true input tokens
- Calculate total_tokens as input + output + cache instead of using API value
- Add comments explaining the adjustment (matching OpenAI provider pattern)

This ensures consistency across all providers and fixes incorrect token
counts displayed in the Hyper dashboard for Vercel/OpenRouter models.

Before: GLM 5.1 showed Total=40,162 (Input+Output only)
After:  GLM 5.1 shows Total=59,143 (Input+Output+Cache) ✓

Assisted-by: Crush:qwen3.6-plus
…mbracelet#275)

Bumps the kronk group with 1 update: [github.com/ardanlabs/kronk](https://github.com/ardanlabs/kronk).


Updates `github.com/ardanlabs/kronk` from 1.26.6 to 1.27.3
- [Release notes](https://github.com/ardanlabs/kronk/releases)
- [Commits](ardanlabs/kronk@v1.26.6...v1.27.3)

---
updated-dependencies:
- dependency-name: github.com/ardanlabs/kronk
  dependency-version: 1.27.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: kronk
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…armbracelet#276)

Bumps the all group with 2 updates in the / directory: [github.com/kaptinlin/jsonschema](https://github.com/kaptinlin/jsonschema) and [google.golang.org/genai](https://github.com/googleapis/go-genai).


Updates `github.com/kaptinlin/jsonschema` from 0.7.15 to 0.8.0
- [Release notes](https://github.com/kaptinlin/jsonschema/releases)
- [Commits](kaptinlin/jsonschema@v0.7.15...v0.8.0)

Updates `google.golang.org/genai` from 1.58.0 to 1.59.0
- [Release notes](https://github.com/googleapis/go-genai/releases)
- [Changelog](https://github.com/googleapis/go-genai/blob/main/CHANGELOG.md)
- [Commits](googleapis/go-genai@v1.58.0...v1.59.0)

---
updated-dependencies:
- dependency-name: github.com/kaptinlin/jsonschema
  dependency-version: 0.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: google.golang.org/genai
  dependency-version: 1.59.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the all group with 3 updates: [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2), [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) and [google.golang.org/genai](https://github.com/googleapis/go-genai).


Updates `github.com/aws/aws-sdk-go-v2` from 1.41.12 to 1.42.0
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@v1.41.12...v1.42.0)

Updates `github.com/aws/aws-sdk-go-v2/config` from 1.32.23 to 1.32.25
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@config/v1.32.23...config/v1.32.25)

Updates `google.golang.org/genai` from 1.59.0 to 1.60.0
- [Release notes](https://github.com/googleapis/go-genai/releases)
- [Changelog](https://github.com/googleapis/go-genai/blob/main/CHANGELOG.md)
- [Commits](googleapis/go-genai@v1.59.0...v1.60.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-version: 1.42.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: github.com/aws/aws-sdk-go-v2/config
  dependency-version: 1.32.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: google.golang.org/genai
  dependency-version: 1.60.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the kronk group with 1 update in the / directory: [github.com/ardanlabs/kronk](https://github.com/ardanlabs/kronk).


Updates `github.com/ardanlabs/kronk` from 1.27.4 to 1.27.9
- [Release notes](https://github.com/ardanlabs/kronk/releases)
- [Commits](ardanlabs/kronk@v1.27.4...v1.27.9)

---
updated-dependencies:
- dependency-name: github.com/ardanlabs/kronk
  dependency-version: 1.27.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: kronk
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4be1014cc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +592 to +595
if emit {
messages = append(messages, openai.UserMessage(
[]openai.ChatCompletionContentPartUnionParam{mediaPart},
))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Delay synthetic media messages until all tool outputs are emitted

When a single assistant turn has multiple tool calls and an earlier tool result is media, this appends a synthetic user media message before the remaining tool messages are emitted. Chat Completions requires the tool-call responses to immediately follow the assistant message for all tool_call_ids; the produced order like [assistant, tool img-1, user image, tool txt-2] is rejected or leaves later tool results unpaired. Buffer these follow-up user media messages until after every tool result in the tool message has been appended.

Useful? React with 👍 / 👎.

func bedrockBasicAuthConfig(apiKey string, region string) aws.Config {
return aws.Config{
Region: cmp.Or(os.Getenv("AWS_REGION"), "us-east-1"),
Region: cmp.Or(region, "us-east-1"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve AWS_REGION for direct Anthropic Bedrock auth

When callers use the public anthropic.New(WithBedrock(), WithAPIKey(...)) path directly and rely on AWS_REGION, this now falls back to us-east-1 because region is empty unless WithBedrockRegion is passed. The new providers/bedrock wrapper forwards the env region, but this direct API used to honor AWS_REGION here, so existing EU/APAC Bedrock callers can silently send requests to the wrong region after upgrading.

Useful? React with 👍 / 👎.

Comment thread retry.go
Comment on lines 111 to 113
if options.OnRetry != nil {
errors.As(err, &providerErr)
options.OnRetry(providerErr, delay)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard OnRetry against raw network errors

When a retryable raw network error reaches this path, isRetryableError returns true but errors.As does not populate providerErr, so registered OnRetry callbacks now receive nil. Existing callbacks are typed as func(*ProviderError, time.Duration) and commonly inspect provider fields such as status or headers; a transient dial/DNS timeout can therefore panic instead of retrying. Either skip the callback for non-provider errors or pass a non-nil wrapper.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.