Skip to content

fix(responses): frame retained compaction requests as history - #7138

Merged
lidge-jun merged 5 commits into
devfrom
fix/compaction-historical-framing
Oct 15, 2026
Merged

lidge-jun merged 5 commits into
devfrom
fix/compaction-historical-framing

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

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.

  • Reuse fix(compaction): keep routed models from redoing requests a plaintext checkpoint already finished (#6764) #7105's plaintext SUMMARY_PREFIX checkpoint 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.
  • The parser projects adapter context only. Routed Responses gateways receive a copy at their outbound boundary. Neither changes the raw canonical body, item identities, replay-prefix length or cached history. Native ChatGPT and official OpenAI Responses passthrough input remains unchanged.
  • Historical requests refer to the following checkpoint to distinguish completed and unfinished work. Original details remain available for authorized unfinished work, including details omitted from the summary. Later input retains priority; framing grants no new authority.
  • No setting, GUI change or dependency addition. Update the English configuration reference and owning transport contract; existing translated pages contain no conflicting retained-request setting.

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, real handleResponses paths 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 against origin/dev merge base 7640a942b35044c974e534b84d5a8049f4a8ae9a; 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.
  • Full-suite exception: explicitly not run because many implementation lanes share this machine. The 297 focused regression tests are the completed local coverage; import-connected and remaining platform/full-suite coverage are left to the parent/CI. No claim of a full-suite pass.

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 commit b2b844983: 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.
  • Independent mutation proof: restoring the original two production integration files from the parent commit while retaining the helper as a test import yields 5 pass / 4 fail; restoring the PR yields 9 pass / 0 fail. The added local-compaction regression fails before the review fix (1 fail, 9 filtered) and the final framing file passes 10/10.
  • Per the shared-machine instruction, neither the full suite nor test:changed was 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.
  • Final head: b2b844983361b5f052118f0d8f6f850a90cc116b. gh pr checks 7138 / gh run list --commit b2b844983361b5f052118f0d8f6f850a90cc116b: no failed checks; exact-head jobs are queued/pending (Cross-platform CI run 38701110306, Catalog contracts 38701110232, React Doctor 38701110252, 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_id full-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 ocx1 continuation handling and opaque native blobs keep their prior contracts.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. No auth, credential, workflow, release, dependency or consent-boundary changes; framing preserves existing authorization and confirmation gates.

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>
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 122ac525-825d-4f42-a940-b66cde1bbb04
📥 Commits

Reviewing files that changed from the base of the PR and between f5c0f50 and 1ae2ece.

📒 Files selected for processing: 8
  • docs-site/src/content/docs/reference/configuration/server.md
  • scripts/test-layout/layout.json
  • src/adapters/openai-responses/passthrough.ts
  • src/responses/compaction-history-framing.ts
  • src/responses/parser.ts
  • structure/transports/responses.md
  • tests/fixtures/test-layout-expected.json
  • tests/responses/compaction-history-framing.test.ts
+---------------------------------------------------------------+
| You're one `console.log` away from enlightenment. Keep going. |
+---------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 15, 2026
GOAT and others added 3 commits October 15, 2026 21:08
# Conflicts:
#	scripts/test-layout/layout.json
# Conflicts:
#	scripts/test-layout/layout.json
# Conflicts:
#	scripts/test-layout/layout.json
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer integration into dev (MAINTAINERS.md dev maintainer-integration policy; batch integration authorized by @lidge-jun on 2026-10-15).

  • Head: 1ae2ece68c230a262274d672393977f8a40f40dc (tree 6e16148afe42b84e734c09cac59e4b700b1e340d) = this branch merged with origin/dev f5c0f50733.
  • Exact-head evidence: GitHub-hosted Actions for this account have not been assigning runners since 2026-10-15 13:30 UTC, so by owner decision the evidence is a full bun run test (Bun 1.4.3 test runner, root and GUI dependencies installed, GUI built) of this exact tree on a maintainer host (macOS arm64): exit 1, 9 min, 5 failing test(s), each also failing in the same host's baseline run of dev 60bf4c7 (environment-only): a secondary ensure parent preserves shared Grok, Codex and Claude agent bytes, connected Desktop uses hub IDs across a cold restart (stored profile=false), live audio readiness and bounded closure > bad native frame fails and later normal closure, live audio readiness and bounded closure > native open and non-readiness events cannot cla, update stops the running proxy before replacing files > npm launcher restarts the stopped .
  • Local gates on the same tree: bun run typecheck, file-size ratchet, test-layout and structure:check.
  • Hosted CI checks for this head may still be queued; they are not claimed as evidence.

@lidge-jun
lidge-jun marked this pull request as ready for review October 15, 2026 18:15
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 15, 2026 18:15
@lidge-jun
lidge-jun merged commit a3dfe75 into dev Oct 15, 2026
5 of 6 checks passed
@lidge-jun
lidge-jun deleted the fix/compaction-historical-framing branch October 15, 2026 18:15
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T18:19:34.276376Z 1ae2ece Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant