Skip to content

[codex] Filter legacy warning messages during compaction#22243

Merged
pakrym-oai merged 1 commit into
mainfrom
pakrym/filter-unified-exec-warning-compaction
May 12, 2026
Merged

[codex] Filter legacy warning messages during compaction#22243
pakrym-oai merged 1 commit into
mainfrom
pakrym/filter-unified-exec-warning-compaction

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai commented May 12, 2026

Why

Older sessions can contain model-warning records persisted as user messages, including the unified exec process-limit warning, the apply_patch-via-exec_command warning, and the model-mismatch high-risk cyber fallback warning. Those warnings are no longer produced as conversation history items, but when old sessions compact they should still be recognized as injected context rather than preserved as real user turns.

What changed

  • Removed record_model_warning and the production paths that emitted these warning messages into conversation history.
  • Added LegacyUnifiedExecProcessLimitWarning, LegacyApplyPatchExecCommandWarning, and LegacyModelMismatchWarning contextual fragments that are used only for matching old persisted messages.
  • Registered the legacy fragments with contextual user message detection so compaction filters them through the existing fragment path.
  • Added focused compaction coverage for old warning messages being dropped during compacted-history processing.

Testing

  • cargo test -p codex-core warning
  • just fix -p codex-core

@pakrym-oai pakrym-oai force-pushed the pakrym/filter-unified-exec-warning-compaction branch from 650c2ac to 368d9c0 Compare May 12, 2026 01:58
@pakrym-oai pakrym-oai marked this pull request as ready for review May 12, 2026 02:02
@pakrym-oai pakrym-oai requested a review from a team as a code owner May 12, 2026 02:02
Copy link
Copy Markdown
Contributor

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

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: 368d9c0713

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/core/src/context/contextual_user_message.rs
Comment thread codex-rs/core/src/context/legacy_unified_exec_process_limit_warning.rs Outdated
@pakrym-oai pakrym-oai force-pushed the pakrym/filter-unified-exec-warning-compaction branch from 368d9c0 to fd9dee8 Compare May 12, 2026 02:13
@pakrym-oai pakrym-oai merged commit 79c65f8 into main May 12, 2026
27 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/filter-unified-exec-warning-compaction branch May 12, 2026 02:51
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants