Skip to content

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

Open

Description

@LukeSheely

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

LukeSheely@612788c

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIaws-bedrockIssues related to AWS Bedrock providerbugSomething isn't workingcustom-modelIssues related to custom model providers (including local models)sessionIssues involving session (thread) management, resuming, forking, naming, archivingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions