Skip to content

fix(codex): preserve encrypted reasoning alongside visible summaries - #1966

Open
WebMad wants to merge 1 commit into
Zoo-Code-Org:mainfrom
WebMad:fix/codex-encrypted-reasoning-history
Open

WebMad wants to merge 1 commit into
Zoo-Code-Org:mainfrom
WebMad:fix/codex-encrypted-reasoning-history

Conversation

@WebMad

@WebMad WebMad commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Related to #1963. Extracted from #1964; this PR does not close the whole WebSocket feature issue.

Description

Fix an independent conversation-history bug: a visible reasoning summary must not discard the encrypted reasoning state needed for continuation.

Changes are limited to two files:

This is useful for existing HTTP providers as well as the forthcoming WebSocket transport. There are no transport dependencies, provider-setting changes, or UI changes. It can be reviewed and merged independently of #1964.

Relationship to the split feature

The original backend PR is now split into this reasoning fix, transport-only #1964, and provider-activation #1967. Activation should merge after this fix and #1964. UI #1965 follows activation.

The two files are byte-for-byte identical to the corresponding files in the original unsplit PR. Recombining all backend parts and the UI reproduces the original Git tree exactly.

Test Procedure

Validation in the isolated reasoning-fix worktree:

  • 9 reasoning-history tests passed.
  • Extension type check passed.
  • Focused ESLint checks passed with no suppression-count increases.

The combined backend regression validation also passed: 570 tests, shared-types and extension type checks. Full repository CI remains to run on this new PR.

Local validation used Node 24.7.0 / pnpm 10.8.1; the repository requests Node 22.23.1.

Pre-Submission Checklist

  • Scope: Independent reasoning-history fix only; 2 files, 42 added lines.
  • Self-Review: Exact preservation and scope verified.
  • Testing: Focused regression coverage passed in isolation.
  • Visual Snapshot: Not applicable; no UI changes.
  • Documentation Impact: No new user-facing setting or UI behavior in this PR.

No changeset or changelog entry is included.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1e3d9f36-7374-4f43-9b22-76003af9a7b0
📥 Commits

Reviewing files that changed from the base of the PR and between 2baac5e and b6aa9b3.

📒 Files selected for processing (2)
  • src/core/task/__tests__/apiConversationHistory.spec.ts
  • src/core/task/apiConversationHistory.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (5)
Check persistence and lifecycle invariants: awaited atomic writes, rollback or explicit partial-failure behavior, cross-window state consistency, stale listeners/watchers, cancellation, idempotency, and safe restart/resume without lost or d...

⚙️ CodeRabbit configuration file

Files:

  • src/core/task/apiConversationHistory.ts
  • src/core/task/__tests__/apiConversationHistory.spec.ts
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

⚙️ CodeRabbit configuration file

Files:

  • src/core/task/__tests__/apiConversationHistory.spec.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • src/core/task/apiConversationHistory.ts
  • src/core/task/__tests__/apiConversationHistory.spec.ts
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.

⚙️ CodeRabbit configuration file

Files:

  • src/core/task/apiConversationHistory.ts
  • src/core/task/__tests__/apiConversationHistory.spec.ts
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • src/core/task/apiConversationHistory.ts
  • src/core/task/__tests__/apiConversationHistory.spec.ts
🔇 Additional comments (2)
src/core/task/apiConversationHistory.ts (1)

85-91: LGTM!

src/core/task/__tests__/apiConversationHistory.spec.ts (1)

5-5: LGTM!

Also applies to: 87-119


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Conversation history now preserves available encrypted reasoning alongside visible reasoning and message content. This information is retained whether or not an encrypted-content identifier is available, keeping assistant responses more complete across conversation history.

Walkthrough

The conversation history builder now includes encrypted reasoning content and its optional ID in visible reasoning blocks. A parameterized test checks cases with and without the ID.

Changes

Reasoning history

Layer / File(s) Summary
Preserve encrypted reasoning
src/core/task/apiConversationHistory.ts, src/core/task/__tests__/apiConversationHistory.spec.ts
Visible reasoning blocks now include encrypted content and its optional ID when available. Tests check both ID cases while also checking the message text and tool-use blocks.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b6aa9

The change preserves encrypted reasoning alongside visible summaries, with no identified issue requiring a fix before merge. Normal CI remains to run.

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Regression Evidence ✅ Passed The changed behavior has focused unit coverage at the lowest valid layer. The new parameterized test calls prepareApiConversationMessage directly and verifies encrypted reasoning is preserved with v…
Security Boundaries ✅ Passed No changed path meets the security failure condition. In src/core/task/apiConversationHistory.ts:82-93, the PR copies the provider-returned encrypted_content and optional id into the reasoning h…
Persistence Integrity ✅ Passed No changed persistence defect is present. The PR only adds encrypted_content and optional id to the prepared assistant reasoning block at apiConversationHistory.ts:82-95. `Task.addToApiConversat…
Lifecycle Resource Cleanup ✅ Passed The changed production path only reads handler.getEncryptedContent() and synchronously adds fields to an in-memory reasoning block in prepareAssistantMessage (`src/core/task/apiConversationHistory…
Title check ✅ Passed The title clearly and concisely describes the main fix: preserving encrypted reasoning alongside visible summaries.
Description check ✅ Passed The description is complete and relevant. It links the related issue, explains the implementation and scope, documents test results and environment details, and records checklist items. The unchecked …
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Awaiting fresh human maintainer or CODEOWNER approval.

Automated review is complete for the latest commit but does not replace human approval.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 8, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 8, 2026

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

Labels

awaiting-maintainer CodeRabbit approved; waiting for a human maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant