Skip to content

fix(codex): preserve conversation text within fork history window - #159651

Merged
steipete merged 2 commits into
mainfrom
codex/qa1014-fork-history
Sep 28, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa1014-fork-history

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes fresh Codex conversations and ordinary conversation forks losing the end of a saved message even when the complete history fits the continuity window.

User Impact

Conversation text and summaries now use the existing overall history limit. A message that fits remains complete; overflowing history retains its newest tail. Tool payload caps, attachment handling, redaction, Unicode-safe truncation, and native input limits remain unchanged. No migration or configuration change is needed.

Why This Change Was Made

Live browser QA created an 80-item synthetic checklist, then forked it. The UI retained and copied all 7,919 characters, but the fork could not quote item 80; the parent could. The fresh-thread model input contained only the first 6,000 characters plus a truncation notice, ending around item 63. A per-message cap was discarding ordinary conversation text before the existing 24,000-character history window was applied.

The projection owner now reserves per-part truncation for tool payloads and lets the existing history-window owner bound conversation text and summaries. It does not infer a model window or change ordinary forks into native thread forks.

Evidence

All five new regression cases failed against the original owner for the intended clipping behavior. The corrected projection passes all 60 tests, including complete user/assistant/summary text, bounded newest-tail retention, Unicode boundaries, tool payload caps/redaction, and input immutability. Final focused command with --maxWorkers=1 took 35.472 seconds wall; the initial green run took 12.934 seconds, with transform/setup dominating. Production and test type checks passed in 42.826 and 88.233 seconds. Formatting and whitespace checks passed. Independent managed review through P2 found no actionable findings.

The type check caught an impossible tool-result string branch missed by runtime tests; that branch was removed before the final proof and review. The canonical tool-result content is an array, whose text blocks retain their cap.

Full build passed (591.150 seconds), and build-dependent lint passed with no warnings or errors (145.195 seconds). The local strict UI asset check remained red by 47 bytes for startup gzip and 73 bytes for the largest chunk; no limits were changed. This patch changes no UI or dependency inputs. Local QA used that explicitly recorded build; CI remains a separate gate.

Live corrected proof on production-equivalent head 9fa6ec5 created a fresh fork from a separate 8,686-character, 80-item synthetic checklist. Asked only to quote item 80, the fork returned its exact final sentence and QA1019_FORK_COMPLETE in 11 seconds. The answer and independent Unicode drafts persisted after reload. All 43 saved-workflow groups passed canonical before/after continuity checks across the isolated Gateway update, and all eight served startup assets matched the build. The original parent had no short follow-up exposing item 80.

The before and after screenshots use different synthetic parent conversations to avoid contaminating the corrected proof with the original parent control answer. The follow-up commit changes only test fixtures; the built and live-tested production code is unchanged.

Before: the fork cannot quote item 80 even though it is visible in its saved history

After: a fresh fork quotes item 80 exactly and retains its Unicode draft after reload

CI run 36322820987 caught four existing current-input integration fixtures that still expected an old history prefix to survive. Their 600,000-character message now correctly loses that prefix under the existing 450,000-character newest-tail window. The follow-up fixture repair retains all four scenarios and current-message/current-ID/image assertions, and explicitly checks retained tail, dropped prefix, and the window bound. The accepted auto-merge request was retired through native recovery before changing the head. The corrected owning file now passes 34 tests in 50.295 seconds wall; all 60 projection siblings pass in 28.280 seconds. The four affected integration cases take 148, 134, 132, and 149 milliseconds. Required changed checks passed in 466.802 seconds, including types, lint and guards. Fresh independent review of the full five-file PR found no actionable P0–P2 findings. To retain the file-size limit, scenario setup moved into the existing test-support module; case order, suite lifecycle, and all current-input assertions remain. Exact-head CI run 36325448555 passed on 116a2b4. The refreshed independent review on September 28 found no actionable findings; native recovery then landed this head as 9ac804cdcd3232c5d4f8d5ff9a194c350968ae9e. The canonical checkout was fast-forwarded and its merge ancestry verified.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: S labels Sep 27, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 4:43 AM ET / 08:43 UTC (Revision 5).

ClawSweeper review

What this changes

The Codex plugin preserves saved conversation text and summaries within the overall continuity window for fresh turns and ordinary forks, with updated tests and documentation.

Merge readiness

✅ Ready for maintainer review

Current main still clips saved conversation text before applying the history window. The prior fixture finding is resolved on this head, and inspected fork proof supports the fix; no new blocking finding emerged.

Priority: P1
Reviewed head: 116a2b4f6b6f039c7e5ecad1dcae44073e0a9447

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Direct fork proof, a narrow owner-level change, repaired integration assertions, and successful exact-head CI provide strong review confidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The changed Codex history projection feeds saved messages into fresh native turns. Inspected before/after web chat fork screenshots show item 80 unavailable before and quoted exactly after the production change; the later head commit changes tests only. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The changed Codex history projection feeds saved messages into fresh native turns. Inspected before/after web chat fork screenshots show item 80 unavailable before and quoted exactly after the production change; the later head commit changes tests only. No stored-data contract changes.
Evidence reviewed 10 items Introduced production change: The introduced hunk removes the separate text-part cutoff for conversation text and summaries while retaining it for tool-result text parts.
Current main still needs the fix: The fetched main revision still applies the per-part cutoff to saved conversation text and summaries. Its later refactor changes a separate tool-payload helper.
Production entry point: Fresh-thread continuity passes saved messages and the separate overall character budget to the changed projection.
Findings None None.
Security None None.

How this fits together

OpenClaw’s Codex plugin reads saved session messages when starting a fresh native turn. Its history projection turns those messages into bounded prompt context sent to the Codex app server.

flowchart LR
  A[Saved session messages] --> B[Codex history projection]
  B --> C{Content type}
  C -->|Conversation| D[Continuity window]
  C -->|Tool payload| E[Cap and redaction]
  D --> F[Fresh Codex turn]
  E --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +53, Docs +6. Total +59 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 5 0
Tests 3 100 47 +53
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 111 52 +59

Review metrics

Metric Value Why it matters
Continuity fixtures 4 integration scenarios updated They now assert the retained tail, dropped prefix, and history-window bound raised in the earlier review.

Technical review

Best possible solution:

Land the plugin-owned repair through standard exact-head gates, retaining the existing tool-payload, attachment, and native-input limits.

Do we have a high-confidence way to reproduce the issue?

Yes. On unpatched main, fork a saved message whose final item is beyond the 6,000-character per-message cap but within the continuity window, then ask for that item. Source and the inspected before screenshot support this path; I did not execute it in this read-only review.

Is this the best way to solve the issue?

Yes. The existing history window is the right owner for conversation text and summaries, while tool payload and native turn-input limits remain separate.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1885ace4b108.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Fresh Codex forks can lose saved conversation text needed for the user's next turn.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The changed Codex history projection feeds saved messages into fresh native turns. Inspected before/after web chat fork screenshots show item 80 unavailable before and quoted exactly after the production change; the later head commit changes tests only. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Codex history projection feeds saved messages into fresh native turns. Inspected before/after web chat fork screenshots show item 80 unavailable before and quoted exactly after the production change; the later head commit changes tests only. No stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed Codex history projection feeds saved messages into fresh native turns. Inspected before/after web chat fork screenshots show item 80 unavailable before and quoted exactly after the production change; the later head commit changes tests only. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • compoodment: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Colton-Harris: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-27T12:57:36.716Z sha 9fa6ec5 :: needs changes before merge. :: none
  • reviewed 2026-09-27T13:40:57.575Z sha 9fa6ec5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T14:08:29.954Z sha 9fa6ec5 :: needs changes before merge. :: [P2] Assert the retained history tail in the integration fixtures
  • reviewed 2026-09-27T14:25:58.655Z sha 116a2b4 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 27, 2026 13:33
@steipete
steipete enabled auto-merge (squash) September 27, 2026 13:37
@steipete
steipete disabled auto-merge September 27, 2026 13:42
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current head remains 116a2b4. Its exact-head CI run 36325448555 completed successfully after the prior review. The four stale prefix assertions now verify retained newest-tail content within the overall continuity window, and the real fork screenshot proof remains representative because the final commit changes tests only. Please refresh the review for native landing; the previous review expired while this QA task was interrupted.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 9ac804c into main Sep 28, 2026
118 checks passed
@steipete
steipete deleted the codex/qa1014-fork-history branch September 28, 2026 08:46
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…enclaw#159651)

* fix(codex): preserve conversation text within fork history window

* test(codex): assert continuity within the newest history window
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant