Repository navigation
fix(responses): frame retained compaction requests as history - #7138
Conversation
Preserve canonical replay history and original request details while framing retained plaintext requests only in translated and routed provider prompts. Native OpenAI passthrough remains unchanged. Co-authored-by: Robin Bially <7304732+robin-bially@users.noreply.github.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 8
✨ Finishing Touches
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
# Conflicts: # scripts/test-layout/layout.json
# Conflicts: # scripts/test-layout/layout.json
# Conflicts: # scripts/test-layout/layout.json
|
Maintainer integration into
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Routed models can treat retained user requests before a plaintext Codex compaction checkpoint as fresh orders and repeat completed work (#6764, follow-up to #7003). This revises the approach in contributor PR #7105: apply historical framing by default in the translated/provider prompt while preserving every original request text block and canonical stored history.
SUMMARY_PREFIXcheckpoint detection and conservative context exclusions. Frame text-only user requests before the latest checkpoint; preserve checkpoint text, earlier checkpoints, contextual wrappers, multimodal input, assistant/tool items and post-checkpoint input. Summarizer turns do not activate framing.Credit: Robin Bially's #7105 identified the plaintext checkpoint shape and supplied the selector/test approach used here. This implements the preservation-based revision rather than carrying the deletion option. The email below is from the author's commits on that PR.
Co-authored-by: Robin Bially 7304732+robin-bially@users.noreply.github.com
Verification
All tests use synthetic fixtures and local/mocked transports; no live model calls were made.
bun run typecheck: pass.bun test tests/responses/compaction-history-framing.test.ts tests/responses/compaction-continuation-note.test.ts tests/responses/compaction-continuation-wire.test.ts tests/responses/continuation-dedup.test.ts tests/responses/responses-compaction.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 148 pass, 0 fail. Covers new framing, text preservation, native OpenAI isolation, full replay across three continuations, realhandleResponsespaths on mocked Chat/Responses providers, and layout/size guards.bun test tests/responses/responses-compaction-routing.test.ts tests/lab/core-lab-boundary.test.ts: 149 pass, 0 fail.bun run structure:check,bun run privacy:scan,git diff --check: pass.cd docs-site && bun install --frozen-lockfile && bun run build: pass; 577 pages and 81,203 internal links checked. Lockfiles unchanged.bun run test:changed: attempted againstorigin/devmerge base7640a942b35044c974e534b84d5a8049f4a8ae9a; it remained queued behind the shared test lock and was terminated before tests executed, to avoid leaving an unmonitored queued run after the implementation subagent returns. This is not a passing result. The PR remains draft pending import-connected coverage and exact-head Ubuntu CI. No other lane or lock was stopped.Independent review round 1
Reviewed the complete diff against
dev, #6764 (including the corrected causal follow-up), #7105 and the owning structure contracts in a separate review worktree. Fixed one high-severity defect in commitb2b844983: after a previous plaintext checkpoint, Codex client-side compaction supplied the canonical summary prompt as an ordinary final user message, so generation-only continuation instructions were incorrectly injected into the summarizer turn. The shared projector now bypasses that exact prompt; quoted prompts remain ordinary generation input. String and text-block forms are covered through the projector, parser and routed Responses serializer. No request-body or key logging, canonical history mutation, new dependency, Lab import, or GUI change was introduced. PR draft state is unchanged.Upstream verification: Codex local compaction and its canonical prompt confirm the no-trigger wire shape. OpenAI compaction documentation confirms that native compacted windows can retain items alongside opaque state; those native destinations remain outside the projection.
Fresh validation of the review fix:
bun run typecheck: pass.bun test tests/responses/compaction-history-framing.test.ts tests/responses/compaction-continuation-note.test.ts tests/responses/compaction-continuation-wire.test.ts tests/responses/continuation-dedup.test.ts tests/responses/responses-compaction.test.ts tests/responses/responses-compaction-routing.test.ts tests/lab/core-lab-boundary.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts: 298 pass, 0 fail.bun run structure:check,bun run privacy:scan,git diff --check: pass.cd docs-site && bun install --frozen-lockfile && bun run build: pass, 577 pages / 81,203 internal links. Dependency lockfiles unchanged.test:changedwas run in this review. Remaining broad coverage is left to CI. Synthetic offline fixtures establish construction and replay semantics; no live-model success rate is claimed. The local summarizer guard recognizes Codex's canonical prompt; arbitrary custom local summarization prompts have no structural trigger and are outside this recognition rule.b2b844983361b5f052118f0d8f6f850a90cc116b.gh pr checks 7138/gh run list --commit b2b844983361b5f052118f0d8f6f850a90cc116b: no failed checks; exact-head jobs are queued/pending (Cross-platform CI run38701110306, Catalog contracts38701110232, React Doctor38701110252, and PR policy jobs). Superseded hygiene/labeler attempts are cancelled; CodeRabbit reports a draft review skip. Required CI has not completed. Verdict: needs-more, pending exact-head CI; no remaining code findings in this review. PR remains draft.Offline A/B evidence
A: with the two production integration calls temporarily removed, the new regression file reports 5 pass / 4 fail: translated context, routed Responses output and both handler paths lack historical framing. B: restoring both calls reports 9 pass / 0 fail. The unchanged canonical body retains all original text, including a synthetic unfinished-task detail deliberately absent from the summary, and
previous_response_idfull-history replay retains exactly one provider answer. Both native OpenAI passthrough destinations preserve their original input. This establishes prompt construction and replay correctness, not live model adherence or a model success rate.Risk: historical framing is advisory; models may still repeat work. It adds prompt tokens per retained request. Detection intentionally covers plaintext checkpoint/text-only shapes; existing
ocx1continuation handling and opaque native blobs keep their prior contracts.Checklist