Skip to content

fix(compact): sanitize plaintext compaction replays - #1720

Open
Komzpa wants to merge 6 commits into
Soju06:mainfrom
Komzpa:fix/sanitize-encrypted-compaction-replays
Open

fix(compact): sanitize plaintext compaction replays#1720
Komzpa wants to merge 6 commits into
Soju06:mainfrom
Komzpa:fix/sanitize-encrypted-compaction-replays

Conversation

@Komzpa

@Komzpa Komzpa commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • strip poisoned local compact fallback messages together with their following compact output item
  • rewrite plaintext replayed compaction summaries into inert assistant text so old local compact summaries do not go back upstream as compaction items
  • preserve provider-looking encrypted compaction state (gAAAA...) unchanged on both normal /responses continuation and compact requests

This replaces the earlier too-broad encrypted-state rewrite: valid provider compact state is authoritative continuity and must stay opaque, not become [compact state] [unverified compact state omitted].

Live failure and follow-up

The original invalid-encrypted-content failures were caused by replaying local/plaintext compact fallback state as a provider compaction item. A later live post-compact hang showed the opposite hazard too: replacing valid provider encrypted compact state broke continuation context. This PR now keeps the two cases separate.

Testing

  • uv run pytest tests/unit/test_openai_requests.py::test_compact_rewrites_plaintext_compaction_replay_without_encrypted_content tests/unit/test_openai_requests.py::test_compact_preserves_provider_encrypted_compaction_replay tests/unit/test_openai_requests.py::test_responses_preserves_provider_encrypted_compaction_replay tests/unit/test_openai_requests.py::test_compact_strips_poisoned_local_compact_fallback_items tests/unit/test_openai_requests.py::test_responses_strips_poisoned_local_compact_fallback_items -> 5 passed
  • uv run pytest tests/unit/test_openai_requests.py -> 172 passed
  • PR scope gate: git diff --name-only origin/main...HEAD contains only app/core/openai/requests.py and tests/unit/test_openai_requests.py

@Komzpa
Komzpa force-pushed the fix/sanitize-encrypted-compaction-replays branch from cabe4ad to a4d37ff Compare August 13, 2026 13:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cabe4ad369

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/core/openai/requests.py Outdated
Comment thread app/core/openai/requests.py Outdated
Comment thread tests/unit/test_openai_requests.py
Comment thread app/core/openai/requests.py Outdated
Comment thread app/core/openai/requests.py Outdated
@Komzpa
Komzpa force-pushed the fix/sanitize-encrypted-compaction-replays branch from a4d37ff to a06a097 Compare August 14, 2026 03:52
@Komzpa Komzpa changed the title fix(compact): sanitize encrypted compaction replays fix(compact): sanitize plaintext compaction replays Aug 14, 2026
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Aug 14, 2026
@Komzpa
Komzpa force-pushed the fix/sanitize-encrypted-compaction-replays branch from a06a097 to cb7c9ae Compare August 14, 2026 03:54
@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label Aug 14, 2026
@Komzpa
Komzpa force-pushed the fix/sanitize-encrypted-compaction-replays branch from cb7c9ae to 75e7997 Compare August 14, 2026 04:07
@Komzpa

Komzpa commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75e7997236

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/core/openai/requests.py Outdated
Comment thread app/core/openai/requests.py Outdated
@Komzpa Komzpa added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels Aug 14, 2026
@Komzpa
Komzpa force-pushed the fix/sanitize-encrypted-compaction-replays branch from 5a2b9d0 to 0ff7778 Compare August 14, 2026 18:52
@Komzpa

Komzpa commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

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