Repository navigation
fix: label conversation data in system updates - #206840
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: passed. What this changesThis PR exposes producer-labelled conversation quote ranges to plugins screening embedded model requests. Example: A system update contains both the instruction
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it adds useful quote metadata through the existing screening hook, and no definite correctness defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherRuntime-context producers assemble instructions and conversation data; transcript projection and provider text transforms carry quote boundaries to the final request hook, where an already-enabled plugin can rewrite outgoing content. flowchart LR
A[Runtime fragments] --> B[Context renderer]
B --> C[Stored system update]
C --> D[Message projection]
D --> E[Provider text transforms]
E --> F[Model request hook]
F --> G[Provider payload]
Technical reviewBest possible solution: Keep quote boundaries at the existing renderer and request hook, preserving optional legacy-compatible metadata and omitting ranges when rewrites make them uncertain. Do we have a high-confidence way to reproduce the issue? This is an extension capability: current main renders mixed instructions and conversation data but supplies no producer-labelled quote offsets to the final request hook. Is this the best way to solve the issue? The implementation extends the existing owners, preserves rendered text and authorization, and conservatively drops uncertain ranges instead of introducing a competing scanner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e916ef677a95. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +180, Tests +146, Docs +9, Other +1. Total +336 across 17 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. Review metrics
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 (3 earlier review cycles)Reviewed November 27, 2026, 2:56 PM ET / 19:56 UTC (Revision 4). |
Carry origin-labelled ranges through literal replacements, discard uncertain boundaries, and keep older worker updates readable. Verify redaction at provider I/O before and after a SQLite reopen. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
The PR wrapper materializes the text transform and its runtime imports. Include the new range binding so a fresh worktree can load it. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the browser clock paused while the test loads the saved conversation and fonts. Advance it to test the slow state instead of depending on CI wall time. No production UI changes. Co-authored-by: VACInc <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
A screening plugin already sees the full embedded model request. When a system update contains both OpenClaw instructions and a quote from chat, the plugin has no reliable way to tell which characters are the quote. Guessing can redact instructions or leave part of the quote untouched.
User Impact
Plugins already allowed to use
before_model_requestcan use optionalcontextSpansto screen just the quoted conversation data. There is no new opt-in, automatic scanner, or change to the provider request unless a plugin rewrites it. Older saved updates still load without labels. Missing or unmatched labels never mean the text is trusted.Why This Change Was Made
The renderer records quote boundaries while it still knows the source of each piece. The embedded runner keeps the positions attached to that exact text, adjusts them for ordinary provider replacements, and withholds uncertain positions instead of guessing. The worker protocol and its generated validator accept the optional ranges and the existing fallback replay marker.
Evidence
Latest stable → tested PR runtime
5bf8fcaa: passed. The only subsequent change changes a browser test's clock, not application code, dependencies, or persisted formats. In a fresh isolated AWS VM, the integrity-verified npm release[email protected]served a real Gateway.chat.sendandagent.waitcompleted a turn, andchat.historyreturned the saved user message and assistant reply. The released session SDK also wrote an old-format hidden system update to that same chat:turnScoped: true,replay: "append", nodataRanges. No database rows were hand-edited.We stopped the stable Gateway and started the built PR Gateway on the same state directory and unchanged config, with no manual migration. It reopened the same session ID and preserved the original user and assistant content, the hidden update's text, timestamp, and metadata. A second real Gateway turn completed and persisted. The loopback model fixture received both the old and new chat in the outgoing request. This exercised actual released and candidate binaries, the embedded agent and SQLite; only the external inference service was a fixture. No paid provider call was made.
007b587e, after a length-changing provider rewrite, the scanner selected part of the instruction label instead of"ocean blue 📎". In the repaired test, the real OpenAI Responses encoder and plugin hook redact only the quote and preserve both adjacent instructions, before and after reopening SQLite.Original change by @VACInc.