Skip to content

refactor(ai): share Mistral text delta appends - #157664

Merged
vincentkoc merged 2 commits into
mainfrom
refactor/mistral-text-deltas-20260924
Sep 25, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
refactor/mistral-text-deltas-20260924

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Mistral streaming duplicates text-delta accumulation and event construction for string content and typed text items.

User Impact

No transport or API behavior change. The existing dispatch branches and control flow remain; empty deltas, Unicode normalization, content indices, event order, shared partial-output identity, and thinking/tool transitions retain their behavior.

Why This Change Was Made

This specific private text-delta consolidation is a requested active deliverable in the maintainer cleanup campaign. One synchronous private appendTextDelta helper replaces the two duplicate blocks. Production -9 lines, tests +101 lines. No exported API, configuration, persisted state or migration change.

Evidence

  • The signed candidate incorporates frozen main 0484d7a3ecf52589b0d3d98741e58e5f6b5bf661, including the separately owned import repair in fix(update): restore npm-pack helper typechecking #157659. The three-path proposal patch remains byte-identical to the reviewed incoming change. Earlier hosted TS2459 failures remain failed historical evidence.
  • Fresh paired proof used the same expanded fixtures: baseline 43 owner + 27 loopback HTTP/SSE cases, candidate 43 + 27, plus 2 candidate HTTP contract cases. No skipped or failed cases. The loopback fixtures exercise the real pinned SDK; this is not a live Mistral-service claim.
  • All 29 selected canonical stages passed, including 25 fresh test-type graphs, production types, format and scoped three-file core lint. This is scoped lint, not a full-core lint claim. Complete frozen source bindings, baseline restoration, process success, EOF and exact stopped lease were verified.
  • Fresh complete candidate review found no actionable findings. Independent source, dependency, controller, terminal-proof and review-integrity audits accepted this exact candidate. SDK 2.7.0 source and runtime resolution were checked at the production consumer.
  • Node 24.19.0, pnpm 12.4.2, Linux x64, one worker. Whole-command walls: baseline owner 2.645s, baseline wire 1.957s; candidate owner 1.859s, candidate wire 1.920s, HTTP contract 1.898s. Command startup is included; provisioning/install are excluded. Sequential cache history does not support speedup or incremental hosted-CI-cost claims.
  • Historical incoming C0 remains failed at its fixture type check; its accepted C1 correction and proof are retained separately. Current-composition proof above was freshly run. Signed scoped commits used the documented targeted-validation hook skip; hooks are not claimed to have run. Portal timeout/retained staging warnings are not portal-success evidence. Exact new-head hosted CI, Sanity, ClawSweeper and native landing safeguards remain required.

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 24, 2026 23:01
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 9:02 PM ET / September 25, 2026, 01:02 UTC (Revision 2).

ClawSweeper review

What this changes

The Mistral stream adapter routes string and typed text deltas through one private append path and expands provider and HTTP/SSE tests for event behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: current main has not absorbed this cleanup, and the introduced patch has no identified correctness blocker. The previous review also recorded no findings.

Priority: P3
Reviewed head: 0f4869b07fd11d1e93d9173252f09a1d8a4daeee

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The small production consolidation has relevant SDK-backed boundary coverage and no identified patch defect; execution results are reported in the PR body.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The added loopback HTTP/SSE cases drive the changed provider entry point through SDK 2.7.0 and check text forms and tool transitions; the PR body reports passing after-change runs, which this read-only review did not execute. The MEMBER-authored internal refactor has no ordinary contributor-proof gate, and no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The added loopback HTTP/SSE cases drive the changed provider entry point through SDK 2.7.0 and check text forms and tool transitions; the PR body reports passing after-change runs, which this read-only review did not execute. The MEMBER-authored internal refactor has no ordinary contributor-proof gate, and no stored-data contract changes.
Evidence reviewed 9 items Introduced production change: The private helper preserves the existing sanitize, block, append, and event sequence for both text forms.
Current main still needs the cleanup: Fetched main retains separate sanitize-and-append blocks for string content and typed text items.
Provider entry point: The built-in provider registration sends Mistral streaming requests to the adapter changed by this PR.
Findings None None.
Security None None.

How this fits together

OpenClaw's Mistral adapter receives model response chunks through the Mistral SDK. It turns text, thinking, and tool content into assistant events and a final result.

flowchart LR
  A[Agent model request] --> B[Mistral SDK stream]
  B --> C[Mistral adapter]
  C --> D{Content form}
  D -->|String or text item| E[Shared text append]
  D -->|Thinking or tool item| F[Other event handling]
  E --> G[Assistant events and result]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -9, Tests +101. Total +92 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 19 28 -9
Tests 2 164 63 +101
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 183 91 +92

Review metrics

None.

Technical review

Best possible solution:

Keep one Mistral-owned text append path and retain boundary checks for observable event identity and ordering.

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

Not applicable: this is an internal refactor rather than a reported bug. Current main visibly retains the duplicated blocks.

Is this the best way to solve the issue?

Yes: consolidating the two branches inside the existing Mistral adapter is a narrow way to remove duplication while preserving its event contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 281967681fd0.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a bounded internal cleanup with no claimed user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The added loopback HTTP/SSE cases drive the changed provider entry point through SDK 2.7.0 and check text forms and tool transitions; the PR body reports passing after-change runs, which this read-only review did not execute. The MEMBER-authored internal refactor has no ordinary contributor-proof gate, and no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Alix-007: 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 (1 earlier review cycle)
  • reviewed 2026-09-24T23:12:26.573Z sha 39e204c :: needs maintainer review before merge. :: none

* commit '0484d7a3ecf52589b0d3d98741e58e5f6b5bf661': (68 commits)
  fix(subagents): stop completion transcript retry loops (#157571)
  perf(sessions): remove duplicate foreground history reference scans (#157572)
  improve(typesafe): defer startup work until the first decision (#157380)
  fix(update): restore npm-pack helper typechecking (#157659)
  fix(packaging): avoid heap exhaustion on large bundles (#157471)
  refactor(infra): share process error handler registries (#157632)
  chore(ui): refresh control ui locales (#157573)
  fix(gateway): release remote Skills subscriptions when shutdown drains (#157592)
  perf(plugins): reuse declared tool membership during resolution (#156205)
  fix(ui): pasted text previews fail before sending (#157390)
  fix(agents): wait for database resources during deletion (#157631)
  improve: move operator profile database reads off the Gateway thread (#155800)
  fix: explain rejected settings without losing edits (#157549)
  fix: keep Gateway responsive while recording trajectory events (#157598)
  fix(auth): show SIWC email and selected model account identity (#157629)
  docs: explain Codex app approval precedence (#155089)
  refactor(wizard): share select prompt requests (#157607)
  fix(ui): omit empty sections from conversation Markdown exports (#157590)
  fix(doctor): explain update lint supervisor refusals (#156547)
  fix(ui): GitHub folder links lose repository context (#157619)
  ...
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 25, 2026
@vincentkoc
vincentkoc merged commit 7338f79 into main Sep 25, 2026
186 checks passed
@vincentkoc
vincentkoc deleted the refactor/mistral-text-deltas-20260924 branch September 25, 2026 02:27
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
* refactor(ai): share Mistral text delta appends

* Merge main to incorporate the upstream update type fix

* commit 'dda1f68bfa102cb804392c0e7cc22c0566a0944a': (68 commits)
  fix(subagents): stop completion transcript retry loops (openclaw#157571)
  perf(sessions): remove duplicate foreground history reference scans (openclaw#157572)
  improve(typesafe): defer startup work until the first decision (openclaw#157380)
  fix(update): restore npm-pack helper typechecking (openclaw#157659)
  fix(packaging): avoid heap exhaustion on large bundles (openclaw#157471)
  refactor(infra): share process error handler registries (openclaw#157632)
  chore(ui): refresh control ui locales (openclaw#157573)
  fix(gateway): release remote Skills subscriptions when shutdown drains (openclaw#157592)
  perf(plugins): reuse declared tool membership during resolution (openclaw#156205)
  fix(ui): pasted text previews fail before sending (openclaw#157390)
  fix(agents): wait for database resources during deletion (openclaw#157631)
  improve: move operator profile database reads off the Gateway thread (openclaw#155800)
  fix: explain rejected settings without losing edits (openclaw#157549)
  fix: keep Gateway responsive while recording trajectory events (openclaw#157598)
  fix(auth): show SIWC email and selected model account identity (openclaw#157629)
  docs: explain Codex app approval precedence (openclaw#155089)
  refactor(wizard): share select prompt requests (openclaw#157607)
  fix(ui): omit empty sections from conversation Markdown exports (openclaw#157590)
  fix(doctor): explain update lint supervisor refusals (openclaw#156547)
  fix(ui): GitHub folder links lose repository context (openclaw#157619)
  ...

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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