Repository navigation
fix(codex): clarify policy boundaries and preserve legacy withdrawal - #189112
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. |
bdaff6c to
771d074
Compare
|
Codex review: needs real behavior proof before merge. What this changesThis PR frames OpenClaw’s native Codex policy and clarifies replacement while preserving legacy withdrawal and independent instructions. Example: An existing Codex conversation changes POLICY_ALPHA to POLICY_BETA, then receives an empty policy.
Review scores
ProductKind: Preference · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR preserves distinct, maintainer-engaged work; the earlier withdrawal defect is resolved, and no new actionable code defect was identified. Priority: P3 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin composes OpenClaw policy into native thread configuration and injects replacement developer messages before resumed or forked inference; parent-local relay instructions remain separate. flowchart LR
A[OpenClaw policy and hook output] --> B[Native policy composition]
B --> C[Policy framing]
C --> D[Thread start resume or fork]
C --> E[Replacement developer message]
D --> F[Native conversation]
E --> F
F --> G[Model request]
H[Parent local relay instructions] --> G
Technical reviewBest possible solution: Keep one shared policy renderer at the existing native composition boundaries and retain explicit withdrawal of legacy policy. Do we have a high-confidence way to reproduce the issue? Current main’s unframed carrier is verified, but the supplied evidence does not establish that its wording loses history or cancels unfinished requests; no target code was executed during this read-only review. Is this the best way to solve the issue? The change uses the existing composition and handoff owners, updates affected consumers, and introduces no new state or parallel delivery mechanism; the framing tradeoff is recorded in the maintainer-authored repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 54e0bc0c2132. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +23, Tests +51, Docs +25, Other +2. Total +101 across 21 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed November 9, 2026, 8:55 PM ET / November 10, 2026, 01:55 UTC (Revision 7). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…penclaw#189112) * fix(codex): delimit native thread policy replacements Use one labelled native policy carrier for creation, refresh and diagnostics. Preserve full replacement and empty withdrawal while explicitly excluding separate instructions, retained history and unfinished user requests. Co-authored-by: Beru <[email protected]> * fix(codex): restrict supersession to delimited policy blocks Remove the unidentifiable legacy-policy fallback. Supersede only earlier blocks with the same delimiters, and leave outside text out of the replacement scope. Co-authored-by: Beru <[email protected]> * test(codex): repair policy framing assertions and snapshots Update the configured-MCP, upstream-fork, and canonical-descendant expectations to require the complete delimited native policy, including the empty-policy handoff. Keep exact payload and lifecycle checks. Render the prompt snapshot from the built thread/start carrier instead of the raw pre-framing value hidden behind the selected-param mask. Regenerate both prompt fixtures and check their policy boundaries in the existing persona-separation test. Increase this change's test-line allocation by its exact six added regression-test lines; leave the shared baseline unchanged. Co-authored-by: Beru <[email protected]> * fix(codex): avoid opening policy tag in handoff notice Name the policy tag without angle brackets so the handoff preamble does not emit an extra opening delimiter. Preserve all replacement and preservation clauses. Co-authored-by: Beru <[email protected]> * refactor(codex): tighten policy replacement notice Apply the concise notice while retaining frame-only full replacement, omitted-rule and empty-policy withdrawal, and protection of outside instructions, history and unfinished requests. Update existing payload and ordinary-resume assertions, and shrink the dedicated test allocation by the exact two removed lines. Co-authored-by: Beru <[email protected]> * fix(codex): scope policy replacement to developer instructions Apply the approved opening that identifies OpenClaw policy in developer-role messages and excludes quoted examples, tool output and files. Leave the remaining replacement and preservation clauses unchanged. Co-authored-by: Beru <[email protected]> * fix(codex): restore policy framing with legacy withdrawal * refactor(codex): shorten thread policy delimiter --------- Co-authored-by: Beru <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
Related: #135338.
What Problem This Solves
Makes OpenClaw's native developer-policy replacement boundaries explicit while preserving legacy-policy withdrawal, independent instructions, conversation history, and unfinished requests.
User Impact
The native policy carrier is labeled with
<thread_policy>at creation, resume, fork, and in side conversations. Refresh replaces earlier OpenClaw policy blocks and legacy unframed OpenClaw generic policy; omitted rules and explicit empty policy still withdraw previous policy. Independent native, project, and current-request instructions retain authority.Supersession is still an instruction to the model, not deletion or migration of transcript records or a change to native permission enforcement. No new state or configuration is introduced.
Why This Change Was Made
Restores Dmitry Golubev's original framing design and the corresponding diagnostics, tests, documentation, and generated snapshots. The interim notice-only simplification removed the feature and has been superseded at the request of the maintainer.
Two repairs accompany the restoration:
instructionsormodel_instructions_file, OpenClaw's fallback base is enclosed in the same frame; the operator's native instructions remain independent. Canonical forks retain framed delivery, and diagnostics reflect authored-base placement.Default OpenClaw base prompts keep their separate native placement. Managed relay persona, skills, memory, and current-request instructions remain outside the native policy frame; eligible nonrelay fallback sections remain inside it. Lifecycle ownership, handoff timing, warm reuse, and transcript retention are unchanged.
Token tradeoff
Explicit boundaries are retained for instruction reliability. Raw prompt length alone does not measure total task cost: avoiding an erroneous action or recovery turn can outweigh small input overhead. No task-cost or error-rate improvement has been measured here.
Deterministic
o200k_basecounts, with unchanged policy bodies:shared runtime policyThe shorter delimiter saves 6 framing tokens versus the prefixed tag. The repair saves 28 tokens per handoff versus the original framed proposal. Compared with main, the nonempty sample adds 1 token and empty withdrawal saves 19. Fresh/warm contexts retain the roughly 9-token framing overhead; this is not a token-neutral change. Tokenizer boundaries, cached-input pricing, retained handoffs, and actual model behavior determine total cost.
Evidence
After renaming the delimiter to
<thread_policy>, 321 tests passed across the nine affected/prefix-stability suites. Snapshots were regenerated; targeted lint, formatting, and diff checks passed. All non-generated edits were verified as exact tag substitutions before formatting. The rename changes no lifecycle or replacement scope.Before the mechanical delimiter rename, local autoreview against main
b39848a3e49c39965226a8f7fbd849b5ba71f20c, P0–P2: no actionable findings. Source-only review; no model-behavior proof claimed by the reviewer.Extensions production typecheck, targeted lint, formatting, test-line ratchet, and diff checks passed.
Prompt snapshots regenerated through the repository generator, not edited by hand.
Before the mechanical delimiter rename, 407 tests passed across 14 files: policy payloads; native configuration, lifecycle and bindings; configured MCP; upstream/canonical fork continuation; side-question behavior; prompt snapshots; and prompt-prefix stability. Initial empty-policy assertions were updated to the new empty-frame representation, then the complete affected selection passed.
Existing real-model framing evidence from the original contributor is historical evidence, not a rerun of this repaired head. Legacy withdrawal and the shortened notice have not received a new live-model A/B run; focused tests establish emitted payloads, carrier boundaries, and lifecycle behavior, not guaranteed model compliance.
The test-line allocation covers shared start/resume framing, empty withdrawal, and authored-base placement regression coverage.