fix(compaction): preserve assistant boundary replies#90641
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 8:29 AM ET / 12:29 UTC. Summary PR surface: Source +69, Tests +84. Total +153 across 2 files. Reproducibility: yes. at source level: current main removes summarized message entries before the retained boundary, and PR head still stops boundary discovery on ignored non-message entries. I did not run a live compaction session in this read-only pass. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve boundary assistants across ignored state and metadata entries, stop only on context-producing entries, keep the stale-signature stripping, and provide redacted real compaction proof before merge. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main removes summarized message entries before the retained boundary, and PR head still stops boundary discovery on ignored non-message entries. I did not run a live compaction session in this read-only pass. Is this the best way to solve the issue? No, not yet. Preserving the assistant boundary is the right direction, but the implementation needs to classify intervening entries by buildSessionContext effect and still needs real after-fix compaction proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d1b33a6040a4. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +69, Tests +84. Total +153 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba959f1933
ℹ️ 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".
| if (candidate?.type !== "message") { | ||
| continue; |
There was a problem hiding this comment.
Stop re-exposing summarized custom messages
When a surviving user message is preceded by a summarized assistant but has a custom_message or branch_summary between them, this loop skips the intervening non-message entry and still marks the assistant as the replay boundary. Since resolveSuccessorCompactionFirstKeptEntryId then moves firstKeptEntryId back to that assistant, buildSessionContext replays every appendable entry from there to the compaction (packages/agent-core/src/harness/session/session.ts:81-95), so summarized custom/branch content that previously stayed hidden behind the old first-kept user is sent to the model again after transcript rotation.
Useful? React with 👍 / 👎.
|
Closing this stale draft PR because it has been open for a long time without merge. I can reopen or resubmit if needed. |
Summary
summary -> assistant -> userinstead of hiding the replyFixes #76729
Tests
Real behavior proof
summary -> assistant -> userboundary.ba959f19332c40305f241e15ef483c4a8923cc7on macOS 15.5 with Node v22.22.1 and pnpm 11.2.2.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/compaction-successor-transcript.test.ts;git diff --check upstream/main...HEAD.