Repository navigation
fix(codex): preserve provenance through context-engine compaction - #150490
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 4:01 AM ET / 08:01 UTC (Revision 9). ClawSweeper reviewWhat this changesPreserves stable speaker labels in Codex conversation history and context-engine projections while neutralizing metadata mentions and budgeting the added text. Merge readiness✅ Ready for maintainer review This remains a useful fix: current main still loses sender labels in Codex history projection. The previous findings are addressed, and the supplied live compaction evidence supports the intended behavior. Priority: P2 Review scores
Verification
How this fits togetherThe Codex plugin converts OpenClaw messages and assembled conversation history into native app-server inputs. These inputs become the history available to subsequent turns and native compaction. flowchart LR
A[Current user message] --> C[Codex input preparation]
B[Assembled conversation history] --> D[History projection]
C --> E[Bound and neutralize sender metadata]
D --> E
E --> F[Native Codex thread]
F --> G[Compaction and later recall]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +103, Tests +270. Total +373 across 11 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep speaker provenance in the Codex-owned input adapters, with legacy rows unattributed and generated metadata excluded from native selection. Do we have a high-confidence way to reproduce the issue? Yes, from source: feed distinct sender-attributed user messages through current main's Codex projection and their labels become bare roles. No current-main runtime reproduction was executed in this review. Is this the best way to solve the issue? Yes. The patch repairs the two Codex-owned history boundaries without changing public protocol shapes, reconstructing legacy identities, or introducing another compaction owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c6e7c6612616. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready verification for head
Root cause and fix: native current-user input and context-engine history projection discarded stable speaker metadata. The fix serializes bounded, inert provenance at those Codex-owned boundaries and reserves its prefix in the existing prompt budget. Generic-compaction-only changes cannot repair these native paths; no new compaction owner, protocol, or storage change is needed. Production +120/-17 (net +103); tests and fixtures +305/-35. Growth implements the two adapter boundaries and shared prefix budgeting. Proof limits: I did not rerun authenticated live compaction or the runtime test suite locally. Hosted exact-head CI and the contributor's reported 74-test receipt supplement the live two-speaker compaction evidence already in this PR. That live environment included the separately disclosed owner-routing shim; it is not evidence of that unrelated lifecycle fix or a pristine-main live run. Autoreview did not execute project code. Same-turn steering is unchanged; this PR repairs new native turns and projected history. |
|
Merged via squash.
|
…enclaw#150490) * fix(codex): preserve sender provenance in native history * fix(codex): preserve provenance in context projections * fix(codex): harden native provenance inputs * fix(codex): neutralize whitespace-separated plugin links --------- Co-authored-by: compoodment <[email protected]>
Fixes #150489.
What Problem This Solves
The generic compaction fix in #149869 does not own Codex-native sessions. Codex has two additional paths that can erase group-chat authorship before native compaction:
UserInput::Text; andturn/startprompt.Both paths previously reduced user turns to bare
[user]text. After compaction, the model could retain the statement but not its speaker.This patch carries a compact sender envelope only when OpenClaw provides a stable
senderId. Display names are labels, never identity. Legacy and name-only records remain bare[user]rows.Fix
Evidence
Focused regressions
native-provenance.test.ts: exercises the real active context-engineturn/startassembly with two attributed users plus one legacy user; it verifies distinct stable labels and an unchanged bare legacy row.turn-params.test.ts: proves metadata$skillsyntax is neutralized while an explicit$skillin the user request is preserved.Real Behavior Proof
Fresh two-speaker Codex-native session on Clanker, 2026-09-17 (UTC+2). Test messages:
alternativment)After native compaction, the follow-up attribution query was issued without channel-history tooling. The model returned:
alternativment)Redacted gateway/session receipt:
No active-writer or secondary-compaction error occurred. The gateway remained healthy throughout.
Test-environment note: Clanker ran the #150490 provenance artifact plus a separate local Codex app-server owner-routing shim. That shim repairs an unrelated client-lifecycle bug which otherwise prevents native compaction from running; it is not part of this PR. The provenance behavior and sender mapping above exercise the #150490 code.
Session, thread, client, channel, host, and account identifiers are omitted. The synthetic test text and display names are intentionally retained.
Worked on by
Native selection boundary proof
The pre-native
turn/startassembly was exercised with sender metadata containing[@probe] (plugin://probe@market). Both a current sender envelope and projected-history sender labels emitted[@probe] (plugin://probe@market); the raw metadata sigil was absent. The explicit current request[@probe](plugin://probe@market) $intentional-skill remain selectablewas preserved byte-for-byte. This keeps generated sender metadata out of Codex's explicit plugin/MCP selection path while retaining intentional current-request selection.The focused receipt is 74/74 native Codex tests, including the current-input and active context-engine
turn/startpaths; production and extension-test typechecks pass.