Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 10, 2026

Related GitHub Issue

Closes: #10846

Description

This PR attempts to address Issue #10846. Feedback and guidance are welcome.

The prompt caching toggle was not shown for Bedrock custom ARN users because supportsPromptCache was set to false in the custom ARN model info. This PR makes two targeted changes:

  1. Enable prompt caching toggle for custom ARN users (useSelectedModel.ts): Changed supportsPromptCache from false to true for the custom-arn case. Custom ARN is an advanced option where users know what they are doing, and their ARN often points to newer Claude models that support prompt caching.

  2. Default prompt caching to ON (Bedrock.tsx): Changed the default value of awsUsePromptCache from || false to ?? true. The nullish coalescing operator (??) properly respects explicitly set false values while defaulting new users to ON for cost savings and latency improvements.

Related issues: #8669, #10576 (previously closed prematurely)
Related PR: #10697 (stale, only linked to #10576)

Test Procedure

  1. Added 2 new unit tests in useSelectedModel.spec.ts to verify custom-arn model returns supportsPromptCache: true and supportsImages: true
  2. Ran existing test suites:
    • useSelectedModel.spec.ts: 37 tests pass (35 existing + 2 new)
    • Bedrock.spec.tsx: all tests pass
    • Backend bedrock tests: 140 tests pass
  3. Type checking: tsc --noEmit passes across all packages
  4. Linting: ESLint passes with zero warnings across all packages

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Important

Enable prompt caching for Bedrock custom ARN users and set default to ON, with tests updated accordingly.

  • Behavior:
    • Enable prompt caching for custom ARN users by setting supportsPromptCache to true in useSelectedModel.ts.
    • Default awsUsePromptCache to ON using ?? true in Bedrock.tsx.
  • Tests:
    • Add tests in useSelectedModel.spec.ts to verify supportsPromptCache and supportsImages for custom-arn models.
    • Add tests in bedrock.spec.ts to check prompt caching default behavior when awsUsePromptCache is undefined or explicitly false.

This description was created by Ellipsis for a051b98. You can customize this summary. It will automatically update as commits are pushed.

- Set supportsPromptCache to true for custom-arn model info in useSelectedModel.ts
- Change awsUsePromptCache default from false to true using nullish coalescing
- Add tests for custom-arn prompt caching support

Closes #10846
@roomote
Copy link
Contributor Author

roomote bot commented Feb 10, 2026

Rooviewer Clock   See task

Re-reviewed the backend fix (a051b98). The previously flagged UI/backend mismatch is now resolved. No new issues found.

  • UI/backend default mismatch for awsUsePromptCache: The checkbox defaults to checked (?? true) when the stored value is undefined, but the backend at src/api/providers/bedrock.ts:274 treats undefined as falsy, so caching stays OFF despite the UI showing it as ON. The backend needs a matching ?? true default.
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

<>
<Checkbox
checked={apiConfiguration?.awsUsePromptCache || false}
checked={apiConfiguration?.awsUsePromptCache ?? true}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

UI/backend mismatch: this line renders the checkbox as checked when awsUsePromptCache is undefined (the case for any user who never explicitly toggled this setting). However, the backend at src/api/providers/bedrock.ts:274 evaluates Boolean(this.options.awsUsePromptCache && ...), which treats undefined as falsy -- so caching is actually OFF. The result is a checkbox that shows "enabled" while the backend is not caching. To make this consistent, the backend line should also default to true, e.g. Boolean((this.options.awsUsePromptCache ?? true) && this.supportsAwsPromptCache(modelConfig)).

Fix it with Roo Code or mention @roomote and request a fix.

@wisestmumbler
Copy link

@roomote please fix all unresolved issues and if successful, remove draft status

@roomote
Copy link
Contributor Author

roomote bot commented Feb 10, 2026

Fixaroo Clock   See task

Fixed the UI/backend default mismatch for awsUsePromptCache by applying ?? true in the backend (bedrock.ts) to match the UI default. Added tests to verify both the default-on and explicit-off cases. All checks (lint, type-check, tests) pass. Also removed draft status.

View commit | Revert commit

The backend treated undefined awsUsePromptCache as falsy (OFF) while the
UI checkbox defaulted to true via nullish coalescing. This caused the UI
to show prompt caching as ON but the backend to keep it OFF for new users.

Apply the same ?? true default in the backend so both sides agree.
@roomote roomote bot marked this pull request as ready for review February 10, 2026 17:14
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Feb 10, 2026
@roomote
Copy link
Contributor Author

roomote bot commented Feb 10, 2026

Rooviewer Clock   See task

Reviewed a051b98. No issues found. The UI/backend mismatch previously flagged has been resolved. Both the UI and backend now consistently default awsUsePromptCache to true via nullish coalescing, and the backend supportsAwsPromptCache check still properly gates caching on model capability. All tests pass.

  • UI/backend default mismatch for awsUsePromptCache: Resolved -- backend now matches UI with ?? true default.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

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

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] AWS Bedrock Custom ARN not working with prompt caching

2 participants