openai / openai/codex

Bedrock Runtime: switching models within a thread replays incompatible encrypted reasoning on Windows

Open
#46,474 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

aws-bedrock bug CLI custom-model session windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Environment
  • Codex CLI: 0.155.0
  • OS: Windows
  • Provider: amazon-bedrock-runtime
  • Custom model catalog: US Sol, Astra, Terra, and Luna models
  • Reasoning summaries disabled in both config and model catalog
Problem

Switching models with the model picker after a model has responded in a thread causes Amazon Bedrock Runtime to reject the next request:

encrypted reasoning was created for a different account or model

The provider remains amazon-bedrock-runtime throughout. This reproduction does not involve Azure or switching providers.

Steps to reproduce
  1. Configure model_provider = "amazon-bedrock-runtime" and the custom US model catalog.
  2. Set model_reasoning_summary = "none" and each model's default_reasoning_summary = "none".
  3. Start a thread with a model such as us.openai.gpt-5.6-sol and let it respond.
  4. Use /model to select another model from the catalog.
  5. Send another message in the same thread.

Expected: the conversation continues with the selected model, preserving visible conversation and tool history.

Actual: the request fails with the encrypted-reasoning error above. A fresh thread reproduces the problem once a model has responded and is then switched.

Investigation

Source inspected: 7498521d288b9b3b96ffba4eedf089d8d6e06a84.

  • codex-rs/core/src/client.rs requests reasoning.encrypted_content.
  • Model switching changes the active settings while retaining history.
  • The next sampling request can replay reasoning encrypted for the previous model.
  • All four custom model entries share comp_hash = "3000", so a differing compaction hash was not the trigger in this reproduction.

Enabling reasoning summaries is not a workaround; Bedrock rejects that parameter:

Unsupported parameter: 'reasoning.summary' is not supported with the 'us.openai.gpt-5.6-sol' model.
Tested reference patch

https://github.com/LukeSheely/codex/commit/612788c8401ed41a81099f5d8c8ff0c03ce8b295

For Bedrock providers only, the patch filters the outbound sampling input to omit encrypted Reasoning items before the latest model-switch instruction. It preserves visible messages, tool results, unencrypted reasoning, the switch instruction, and encrypted reasoning generated after the switch. Persisted history is not rewritten.

In my local Bedrock test, switching worked after applying this filter. The development CLI used --no-daemon, a separate sqlite_home, and reasoning summaries disabled.

Validation:

  • Formatting, Windows compilation, and the filter unit test passed.
  • HTTP integration coverage was added and compiled, but returned early under the development session's network-test guard, so it is not claimed as exercised.
  • Full core-suite validation is not claimed as passing: the run encountered a Windows symlink privilege failure.

The patch is limited to Bedrock model switches and Reasoning items. It does not address transparent account/region failover or encrypted compaction items.

Related report

#17541 describes a related encrypted-history failure originally reported for Azure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in codex-rs/core/src/client.rs, where the issue identifies reasoning.encrypted_content handling and outbound sampling input. Review the referenced filter patch and its unit and HTTP integration coverage, then reproduce the Bedrock model switch with summaries disabled. Done means switching models preserves visible and tool history without replaying incompatible encrypted reasoning, with Windows compilation and relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, rust
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.