Skip to content

Share Guardian user-message retention logic - #42031

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/7db246013875263ceb5806d2a6a19b4e2a3db1c4
Sep 1, 2026
Merged

Share Guardian user-message retention logic#42031
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/7db246013875263ceb5806d2a6a19b4e2a3db1c4

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 1, 2026

Copy link
Copy Markdown

Share Guardian user-message retention logic

What changed

  • Add a shared select_user_messages helper in guardian-context that always
    anchors the first user message and fills the remaining token budget from
    newest to oldest.
  • Use the helper for both core Guardian prompt rendering and the Guardian V2
    async scorer so they apply the same retention policy.

Testing

  • Cover empty and single-message transcripts, over-budget anchors, and
    newest-first selection across multiple token budgets.

## What changed

- Add a shared `select_user_messages` helper in `guardian-context` that always
  anchors the first user message and fills the remaining token budget from
  newest to oldest.
- Use the helper for both core Guardian prompt rendering and the Guardian V2
  async scorer so they apply the same retention policy.

## Testing

- Cover empty and single-message transcripts, over-budget anchors, and
  newest-first selection across multiple token budgets.

GitOrigin-RevId: 7db246013875263ceb5806d2a6a19b4e2a3db1c4
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/7db246013875263ceb5806d2a6a19b4e2a3db1c4 branch from 5a2b41c to 8209978 Compare September 1, 2026 10:41
@copyberry
copyberry Bot merged commit 8209978 into main Sep 1, 2026
26 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/7db246013875263ceb5806d2a6a19b4e2a3db1c4 branch September 1, 2026 10:42
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 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