Repository navigation
chore: sync upstream fantasy v0.48.3 into coder_2_33 - #86
Conversation
Update both module dependency graphs and use Kronk's relocated logger and session-store factory types. Amp-Thread-ID: https://ampcode.com/threads/T-01a187f1-ff83-71d7-ba5c-859fec8b0cd9 Co-authored-by: Amp <amp@ampcode.com>
…acelet#401) Co-authored-by: Kieran Klukas <kieran@dunkirk.sh>
Bumps the all group with 3 updates: [cloud.google.com/go/auth](https://github.com/googleapis/google-cloud-go), [github.com/anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go) and [google.golang.org/genai](https://github.com/googleapis/go-genai). Updates `cloud.google.com/go/auth` from 0.24.1 to 0.24.2 - [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.24.1...auth/v0.24.2) Updates `github.com/anthropics/anthropic-sdk-go` from 1.75.0 to 1.84.0 - [Release notes](https://github.com/anthropics/anthropic-sdk-go/releases) - [Changelog](https://github.com/anthropics/anthropic-sdk-go/blob/main/CHANGELOG.md) - [Commits](anthropics/anthropic-sdk-go@v1.75.0...v1.84.0) Updates `google.golang.org/genai` from 1.71.0 to 1.76.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.71.0...v1.76.0) --- updated-dependencies: - dependency-name: cloud.google.com/go/auth dependency-version: 0.24.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all - dependency-name: github.com/anthropics/anthropic-sdk-go dependency-version: 1.84.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: google.golang.org/genai dependency-version: 1.76.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>
…harmbracelet#444) A stream ending in length, content_filter, error, or an unrecognized finish reason used to produce a normal Finish with no warning when the turn had no tool calls, so clients could not tell a truncated answer from a complete one. Emit a Warnings part naming the cause and carrying the provider's raw finish-reason string via CallWarning.RawFinishReason. Also close open reasoning blocks on the finish chunk in the openrouter hook, where a finish with empty content and no reasoning_details used to leave the block open and drop it from the recorded step content. Assisted-by: Crush:prism
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Kieran Klukas <kieran@dunkirk.sh>
…verflow Parasail reports a prompt that is already too large on its own with "This model's maximum context length is N tokens. However, your prompt contains M input tokens, which exceeds this limit even without any output tokens", which was not matched, so a context overflow looked like a generic provider failure. Capture the maximum and input token counts so it is handled like the other providers. Assisted-by: Crush:prism
* Crush PR: charmbracelet/crush#4100 Servers that read compressed uploads can save roughly four times the bytes a client re-sends on every turn. Off by default, and a body the server could not read is replayed uncompressed on a 400 or 415, so an endpoint without support behaves exactly as it did before. Other statuses are never replayed: they can follow work that was already charged. Assisted-by: Crush:prism
WithRequestCompression now takes a preference list of encodings (gzip, brotli via molecule-man/go-brrr at quality 1), trying each before falling back to a plain body. The first encoding the server accepts is remembered, so a refused encoding is paid once per client rather than once per request. No arguments keeps the gzip-only behavior it always had. Assisted-by: Crush:prism
Update both module dependency graphs and remove WithSessionStoreFactory, which Kronk no longer supports. IMC checkpoints now use internal RAM storage. Amp-Thread-ID: https://ampcode.com/threads/T-01a1d1c0-dc6c-7422-9331-d93ce87a9dd2 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1d1cd-c123-743e-8dac-797b231cf8dd Co-authored-by: Amp <amp@ampcode.com>
…t#442) Gemini repeats the running usageMetadata totals on every streamed chunk, but Stream and StreamObject added OutputTokens, ReasoningTokens and CacheReadTokens across chunks, inflating the reported usage (10, 20, 30 came out as 60). Keep the latest chunk's usage instead, as InputTokens already effectively did.
Use gzip level 6 and brotli level 4 for compressed requests. Assisted-by: Crush:kimi-k3.1-pro
Anthropic's input_tokens excludes cache_read and cache_creation tokens, so TotalTokens (input+output) undercounted any cached call. Add both to Generate and Stream, matching the OpenAI and Google providers. Signed-off-by: Alex <alex.castillog33@gmail.com>
Update both module dependency graphs and migrate the moon example to the supported Charm modules for compatibility with Kronk's newer ANSI dependency. Amp-Thread-ID: https://ampcode.com/threads/T-01a212ec-680f-75c8-8e4a-84f218b3d9ed Co-authored-by: Amp <amp@ampcode.com>
…harmbracelet#424) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Parse GitHub Copilot's reasoning_text field
Merges charmbracelet/fantasy main at a00cb28 (v0.48.3 plus Copilot reasoning for openaicompat, charmbracelet#459). Conflict resolutions: - providers/openai: take upstream's reasoning model check (charmbracelet#386), which replaces the fork's reasoningGenerationPattern (#57) and drops the service tier and auto truncation checks. Keep the fork's reasoning-model override on both transports (#57) and its include handling after the tools (#62). - providers/anthropic: count cache tokens in TotalTokens (charmbracelet#457) on the fork's per-request usage (#50). - providers/google: take upstream's tool result media (charmbracelet#463), which replaces the fork's (#58). - go.mod, go.sum: take upstream's, keep the fork's SDK replaces. The next commit restores the coder SDK forks and Go 1.26.
coder/coder ships the coder forks of anthropic-sdk-go and openai-go and builds with Go 1.26, so keep both after the upstream sync: - Import github.com/openai/openai-go/v3 instead of github.com/charmbracelet/openai-go in the two files upstream added (request compression, charmbracelet#425, and the openrouter hook tests, charmbracelet#459). - go.mod: go 1.26.5, and require the SDK modules the replaces point at the coder forks. Keep kronk v1.31.5, the last release that builds with Go 1.26, with its jinja v1.8.0 and yzma v1.23.0. - go.mod: keep kaptinlin/jsonschema v0.9.8, as v0.9.10 (charmbracelet#441) needs Go 1.27. - examples/go.mod: same Go and pins.
… token totals - openai: an unknown model on the Responses API now counts as a reasoning model (charmbracelet#386), and gpt-40 is no longer a special case. - anthropic: TotalTokens at Finish includes cache tokens (charmbracelet#457).
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex security review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14a7aee78c
ℹ️ 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".
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Go 1.26.10 has a net/http vulnerability that Go 1.26.11 fixes (GO-2026-6859), so govulncheck fails on every PR.
The called charmbracelet/meta lint workflow declares checks: write and pull-requests: read. The default token no longer carries them, so the run stops at startup with "The workflow is requesting 'checks: write, pull-requests: read', but is only allowed 'checks: none, pull-requests: none'".
|
@codex review re: Stop after the consumer rejects the warning Both of these come from upstream, not from the sync: the flagged lines in |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc958ba380
ℹ️ 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".
|
@codex review re: Check cancellation before consulting RetryableError This one is upstream's too: Still declined from the earlier round, for the same reason (lines identical to upstream, and coder/coder doesn't reach them): re: Stop after the consumer rejects the warning I'm leaving all three as upstream has them rather than diverging the fork in a sync PR. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Bump the fantasy fork to its sync with upstream v0.48.3 (coder/fantasy#86), whose Chat Completions reasoning check knows gpt-6 through gpt-9. Azure OpenAI models now also obey the Reasoning Model setting, and the model form shows it for them, as a deployment name does not have to say what model it serves. This replaces the earlier approach of routing Azure OpenAI through the OpenAI client.
) Closes #31714 Closes WI-31 Azure OpenAI reasoning models reject `max_tokens`: ``` Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. ``` We pick between `max_tokens` and `max_completion_tokens` from the model name, and that check only knew names up to `gpt-5`, so a `gpt-6-luna` deployment failed on default settings. To fix, the fantasy bump (coder/fantasy#86, coder/fantasy#87 and coder/fantasy#88) extends the check to `gpt-6` through `gpt-9`. That bump is a full sync with upstream, so it also brings the other chatd changes listed there, which is why a few test expectations move here. On Azure that name is the deployment name though, which doesn't have to say what model it serves. So the model form now also shows the existing Reasoning Model setting for Azure models, and we obey it. With it on, we send `max_completion_tokens` and drop `temperature` and `top_p`, whatever the deployment is called. I confirmed against a real Azure `gpt-5.4` deployment that it rejects `max_tokens` and accepts `max_completion_tokens`, but that test resource has since gone, so I haven't run this exact change against Azure. This only fixes the `max_tokens` error. Going by [Microsoft's docs](https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning), I think GPT-6 chats on Azure will then hit a second error, as on Chat Completions those models only accept tools with the reasoning effort set to `none`, or not at all. The OpenAI and Bedrock providers use the Responses API, so they aren't affected. I can't reproduce that for the same reason, so it's being tracked separately at [CODAGT-1655](https://linear.app/codercom/issue/CODAGT-1655).
Relates to coder/coder#31714
This syncs
coder_2_33with upstream charmbracelet/fantasymainat a00cb28 (v0.48.3 plus charmbracelet#459), which is 29 upstream commits since the last sync in #72. The one I'm after is charmbracelet#386. Our Chat Completions reasoning check stopped atgpt-5, so an Azuregpt-6-lunamodel in coder/coder fails with'max_tokens' is not supported with this model.Please merge this with "Create a merge commit", not squash, same as #72, so the next sync only has to deal with new upstream commits.
The conflict resolutions are in the merge commit message. The main ones are that upstream's reasoning model check (charmbracelet#386) replaces the name checks from #57, whilst the reasoning model override from #57 stays on both transports, and that upstream's Gemini tool result media (charmbracelet#463) replaces ours from #58. Anthropic's
TotalTokensnow counts cache tokens (charmbracelet#457), on top of our per-request usage from #50.As in #72, the commit after the merge keeps us on what coder/coder ships, i.e. the coder forks of
anthropic-sdk-goandopenai-go, Go 1.26 and kronk v1.31.5.kaptinlin/jsonschemaalso stays at v0.9.8, as v0.9.10 needs Go 1.27. The commit after that updates two of our tests for upstream's new behaviour. The last two get CI going again: govulncheck runs with Go 1.26.11, and the lint job is granted the permissions its workflow asks for (checks: writeandpull-requests: read), which the default token no longer has.A few things change for chatd in coder/coder:
gpt-6togpt-9,codex-andcomputer-usenames are now reasoning models.-chatnames, e.g.gpt-5-chat, no longer are, so they keeptemperature, and the OpenAI-compatible providers send themmax_tokensagain.gpt-3,gpt-4,chatgpt-or-chat. Unknown names used to be non-reasoning. The override from feat(providers/openai): allow reasoning-model overrides and recognize gpt-6+ #57 still wins.flexandpriorityservice tiers for models the old name checks didn't know, e.g.gpt-6. They're sent as configured.TotalTokensincludes cache read and cache creation tokens.length,content_filter, an error or an unknown finish reason) with no tool calls now emits a warnings part before the finish (fix(providers): surface abnormal finish reasons in text-only streams charmbracelet/fantasy#444).Request compression (charmbracelet#425) is opt-in, so nothing changes there.
When coder/coder picks this up,
go mod tidybumps a few dependencies (the AWS SDK,google.golang.org/api,google.golang.org/genai, etc.). Five chatd tests also need new expectations for the above: three Anthropictotal_tokensvalues, the unknown model row on Responses, and the debug panel's field coverage forStreamPart.ReceivedAtandCallWarning.RawFinishReason.I've pointed coder/coder at this PR, and with those updated the chatd and aibridge tests pass, as does a repo-wide
go build. That includes a new row for the reporter's setup (providerazure, modelgpt-6-luna), which fails on today's pin. I haven't run this against a real provider.