GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(provider): port upstream Bedrock unsigned reasoning filter (anomalyco/opencode#45769) by devin-ai-integration[bot] · Pull Request #1661 · AltimateAI/altimate-code

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 4, 2026 •
edited by cubic-dev-ai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #1659

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Ports anomalyco/opencode#45769 (filter unreplayable Bedrock reasoning before caching).

@ai-sdk/amazon-bedrock (4.0.112 here) only replays reasoning that has signature or redactedData. It drops any other reasoning when it converts messages. The fork's normalizeMessages kept Bedrock reasoning whenever its text was non-empty. Suppose an interrupted or unsigned turn leaves an assistant message with only Partial thought reasoning and an empty text part. That message survived the filter, and applyCaching added a cachePoint to it. The SDK then sent an assistant message with no content or only a cache point, Bedrock rejected the request, and the next turn in the session failed.

On @ai-sdk/amazon-bedrock, the filter now keeps only reasoning whose metadata has signature, redactedContent or redactedData. It reads that metadata from the stored provider namespace (providerOptions[model.providerID], which message() later remaps onto bedrock) and falls back to bedrock. Because this runs before applyCaching, a message left empty is removed, not cached. Text and tool calls next to unsigned reasoning are kept. Behavior for @ai-sdk/anthropic is unchanged. The change is wrapped in altimate_change ... upstream_fix: markers inside the existing fork block.

How did you verify your code works?

  • Ported the upstream tests to packages/opencode/test/provider/transform.test.ts ("Bedrock reasoning replay"). Two of them run the transformed messages through createAmazonBedrock with a mocked fetch and assert the exact Converse request body, with and without cache points. The others cover signed or redacted reasoning across the bedrock, amazon-bedrock and custom provider namespaces, the stored-namespace precedence, kept text and tool calls, and unchanged behavior for non-Bedrock providers. 11 of the new tests fail on main. With this change, all 391 tests in the file pass.
  • bun run typecheck (tsgo) in packages/opencode passes, and so does the pre-push bun typecheck.
  • bun run script/upstream/analyze.ts --markers --base origin/main --strict: ok.

Cost side effects

None. This only removes message parts that the SDK already dropped.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

Tracked in #1478. Related Bedrock work: #1425 (stream decoding and cached-token billing; it doesn't touch transform.ts).

Written by Devin


Summary by cubic

Ports the upstream Bedrock unsigned reasoning filter so interrupted or unsigned reasoning no longer leaves empty or cache-only messages that Bedrock rejects.

  • Applies only to @ai-sdk/amazon-bedrock; Anthropic behavior is unchanged.
  • Reasoning without signature, redactedContent, or redactedData is removed before cache points are assigned, so empty messages are dropped instead of cached.
  • Adds ported upstream tests covering signed/redacted reasoning, namespace precedence, and provider behavior.

Written for commit d5f9469. Summary will update on new commits.

View guided diff Turn on auto-fix

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
devin-ai-integration Bot added 2 commits November 4, 2026 17:55
@devin-ai-integration
fix(provider): port upstream Bedrock unsigned reasoning filter (anoma…
e7cd0ff
…lyco/opencode#45769)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
test(provider): type Bedrock reasoning replay fixtures
d5f9469
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot requested a review from anandgupta42 November 4, 2026 17:56
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 20e48c87-9d26-46c7-a8e1-7c8788cde85f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@devin-ai-integration devin-ai-integration Bot mentioned this pull request Nov 4, 2026
upstream: provider/security fixes not yet ported #1478
Open
29 of 90 tasks
dev-punia-altimate
dev-punia-altimate reviewed Nov 4, 2026
View reviewed changes

@dev-punia-altimate dev-punia-altimate left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🤖 Code Review — OpenCodeReview (Gemini) — 2 finding(s)

  • 2 anchored to a line (posted inline when the comment stream is on)
  • 0 without a line anchor
All findings (full text)

1. packages/opencode/src/provider/transform.ts (L144)

[🔵 LOW] According to the review checklist, avoid using the any type without providing an explanatory comment. If the exact type is unknown, consider using unknown (e.g., Record<string, unknown>), or add a comment explaining why any is necessary.

Suggested change:

                const options = part.providerOptions as Record<string, unknown> | undefined

2. packages/opencode/src/provider/transform.ts (L146-L148)

[🔵 LOW] The review checklist strictly prohibits the use of non-strict equality operators (!=). Please replace != null with strict inequality checks (!== null and/or !== undefined).

Suggested change:

                return (
                  (metadata?.signature !== undefined && metadata?.signature !== null) ||
                  (metadata?.redactedContent !== undefined && metadata?.redactedContent !== null) ||
                  (metadata?.redactedData !== undefined && metadata?.redactedData !== null)
                )

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/opencode/src/provider/transform.ts
// The Bedrock SDK only replays signed or redacted reasoning. Unsigned reasoning must go
// before cache points are assigned, or it can leave an empty or cache-point-only message.
if (model.api.npm === "@ai-sdk/amazon-bedrock") {
const options = part.providerOptions as Record<string, any> | undefined

@dev-punia-altimate dev-punia-altimate Nov 4, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[🔵 LOW] According to the review checklist, avoid using the any type without providing an explanatory comment. If the exact type is unknown, consider using unknown (e.g., Record<string, unknown>), or add a comment explaining why any is necessary.

Suggested change:

Suggested change
const options = part.providerOptions as Record<string, any> | undefined
const options = part.providerOptions as Record<string, unknown> | undefined

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/opencode/src/provider/transform.ts
Comment on lines +146 to +148
return (
metadata?.signature != null || metadata?.redactedContent != null || metadata?.redactedData != null
)

@dev-punia-altimate dev-punia-altimate Nov 4, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[🔵 LOW] The review checklist strictly prohibits the use of non-strict equality operators (!=). Please replace != null with strict inequality checks (!== null and/or !== undefined).

Suggested change:

Suggested change
return (
metadata?.signature != null || metadata?.redactedContent != null || metadata?.redactedData != null
)
return (
(metadata?.signature !== undefined && metadata?.signature !== null) ||
(metadata?.redactedContent !== undefined && metadata?.redactedContent !== null) ||
(metadata?.redactedData !== undefined && metadata?.redactedData !== null)
)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Nov 4, 2026
fix(tool): port upstream webfetch redirect rule checks (anomalyco/opencode#59748) #1660
Open
4 of 7 tasks
@dev-punia-altimate

dev-punia-altimate commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

🤖 Code Review — OpenCodeReview (Gemini) — No Issues Found

No supported files changed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

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

Reviewers

@dev-punia-altimate dev-punia-altimate dev-punia-altimate left review comments
@anandgupta42 anandgupta42 Awaiting requested review from anandgupta42

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bedrock: unsigned reasoning leaves empty or cache-point-only assistant messages

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dev-punia-altimate
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.