Skip to content

fix(session-recovery): add thinking_block_modified error detection and recovery#3470

Open
omer-koren wants to merge 1 commit intocode-yeongyu:devfrom
omer-koren:fix/thinking-block-modified-recovery
Open

fix(session-recovery): add thinking_block_modified error detection and recovery#3470
omer-koren wants to merge 1 commit intocode-yeongyu:devfrom
omer-koren:fix/thinking-block-modified-recovery

Conversation

@omer-koren
Copy link
Copy Markdown

@omer-koren omer-koren commented Apr 16, 2026

Problem

  • Amazon Bedrock can return thinking / redacted_thinking signature errors after compaction corrupts the latest assistant thinking block signatures.
  • Session recovery already handles thinking block ordering and thinking-disabled violations, but it did not recognize this corruption case.
  • Users with experimental.auto_resume: true were left without an automatic recovery path when the provider rejected the modified thinking blocks.

Solution

  • add a thinking_block_modified recovery error type and detect the Bedrock thinking blocks cannot be modified failure pattern
  • wire the new error type into the session recovery hook with dedicated toast messaging
  • reuse recoverThinkingDisabledViolation to strip corrupted thinking blocks, then auto-resume the session when enabled
  • add regression tests for the full Bedrock error message and a simpler variant

Testing

  • bun run typecheck
  • bun test src/hooks/session-recovery/
  • bun run build

Summary by cubic

Detects and recovers from Bedrock “thinking block modified” errors caused by compaction, restoring auto-resume when enabled and preventing stuck sessions.

  • Bug Fixes
    • Added thinking_block_modified recovery type; detects Bedrock “thinking … cannot be modified” errors (full and simple variants).
    • Integrated with session recovery: shows dedicated toast, strips corrupted thinking blocks using existing logic, and auto-resumes when experimental.auto_resume is enabled; added regression tests.

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

…ed' errors

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Safely adds detection and recovery for Bedrock thinking block errors by reusing existing logic; includes regression tests and is isolated from other error handling paths.

@omer-koren
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant