Skip to content

fix(mistral): report unreadable tools before requests - #173312

Merged
steipete merged 1 commit into
mainfrom
deslop/z13-packages-20261015
Oct 15, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z13-packages-20261015

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes silent omission of Mistral tools when a plugin supplies an unreadable tool definition or a schema that cannot be cloned.

User Impact

The request now fails before contacting Mistral and reports the original definition error. Valid tools, schema detachment, tool ordering, and streamed results are unchanged. No migration or configuration change is required.

Why This Change Was Made

The per-tool catch returned an empty list, allowing the adapter to continue with a reduced or empty tool set. Let the existing stream error owner report conversion failures instead. This is a real silent-failure fix, published under the campaign's any-size bug-fix exception: 4 net production lines removed (tests and README excluded).

Best-effort tradeoffs accepted

Evidence

  • Provider-boundary suite: 30/30 passing, including unreadable definitions alone and alongside a valid tool, with zero requests sent; existing valid-tool and schema-detachment coverage retained.
  • Core production typecheck and focused type-aware Mistral lint passed.
  • Fresh independent Codex review: scoped-clean through P2, with byte-identical production/test files at commit time.
  • Runtime import cycles: 0; Madge cycles: 0. Standalone lint-suppressions gate: 3/3 passing. No import edges changed in this bug fix.
  • Hosted CI on the exact head passed. No CI rerun or green-only push.
  • No live-provider claim: this changes local definition failure handling, not the Mistral wire contract.
  • Local check-changed was attempted: conflict markers, line-cap and assertion-safety checks passed; max-lines reported stale baseline entries in two untouched test files. The SQLite ratchet made no progress for over 12 minutes and was stopped, without altering baselines. Hosted CI on this exact head is the broad gate.

@clawsweeper

clawsweeper Bot commented Oct 15, 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.

@steipete
steipete marked this pull request as ready for review October 15, 2026 17:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T17:03:29.407667Z 586fcf5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reports unreadable Mistral tool definitions as stream errors instead of silently omitting them.

Example: A request includes healthy_tool and broken_tool, whose parameters getter throws.

  • Before: Mistral receives only healthy_tool, without reporting the omitted tool.
  • After: The stream reports the getter error before sending a request.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused and source-supported, with an explicit behavior decision; runtime confidence is limited to reported mocked-provider validation.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored PR is outside the contributor proof gate; its reported provider tests exercise conversion errors with a mocked Chat client, rather than a shipped entry point.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An unreadable tool can disappear from a Mistral request without exposing its definition error.
Reason: The maintainer-authored PR explicitly chooses visible failure over the historical partial-success contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it implements an explicitly accepted maintainer direction, and no definite introduced defect was found.

Priority: P2
Reviewed head: 586fcf54372cd660faaaee0d970121c3bc41663d

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point demonstration or executed base-versus-head regression result is supplied for the changed failure behavior.
Agent review details

How this fits together

The Mistral adapter converts conversation messages and tool definitions into SDK requests and returns assistant stream events or terminal errors.

flowchart LR
  A[Conversation and tools] --> B[Mistral payload builder]
  B --> C[Tool conversion]
  C --> D[Mistral SDK request]
  C --> E[Stream error owner]
  D --> F[Assistant events]
  E --> F
Loading

Technical review

Best possible solution:

Use the existing stream error owner to expose conversion failures while preserving valid-tool cloning and ordering.

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

Current-main source shows that a throwing tool getter or clone failure is swallowed per tool; the changed tests exercise those errors through streamMistral, but no code was executed during this review.

Is this the best way to solve the issue?

Removing the catch is a focused implementation of the accepted direction and reuses the existing terminal-error path without changing successful request construction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e0728f7f72f7.

Provenance checked

  • Mistral per-tool conversion failure handling changes intended behavior with a stated reason (991471b: Preserve healthy sibling tools when another definition is unreadable; later ordering and native-clone changes explicitly retained that behavior.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit fb380b2 adds packages/ai/src/providers/mistral.test.ts:85 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fb380b2e8746; files: packages/ai/src/providers/mistral.test.ts)
  • Vincent Koc: Raw commit 991471b adds src/llm/providers/mistral.test.ts:50 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 991471b8ec29; files: src/llm/providers/mistral.test.ts)

PR surface

Source -4, Tests -4, Docs +3. Total -5 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 13 17 -4
Tests 1 5 9 -4
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 21 26 -5

Labels

Label changes:

  • add P2: This changes limited-scope Mistral failure reporting for malformed tool definitions.
  • add merge-risk: 🚨 compatibility: A malformed tool now prevents requests that previously proceeded with healthy siblings; the maintainer-authored body explicitly accepts this behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This changes limited-scope Mistral failure reporting for malformed tool definitions.
  • merge-risk: 🚨 compatibility: A malformed tool now prevents requests that previously proceeded with healthy siblings; the maintainer-authored body explicitly accepts this behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 1:17 PM ET / 17:17 UTC.

@steipete
steipete merged commit c26f117 into main Oct 15, 2026
179 checks passed
@steipete
steipete deleted the deslop/z13-packages-20261015 branch October 15, 2026 17:34
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
## What Problem This Solves

Fixes silent omission of Mistral tools when a plugin supplies an unreadable tool definition or a schema that cannot be cloned.

## User Impact

The request now fails before contacting Mistral and reports the original definition error. Valid tools, schema detachment, tool ordering, and streamed results are unchanged. No migration or configuration change is required.

## Why This Change Was Made

The per-tool catch returned an empty list, allowing the adapter to continue with a reduced or empty tool set. Let the existing stream error owner report conversion failures instead. This is a real silent-failure fix, published under the campaign's any-size bug-fix exception: **4 net production lines removed** (tests and README excluded).

## Best-effort tradeoffs accepted

- Removed per-tool catch-and-drop: an unreadable getter or non-cloneable schema no longer quarantines only that tool while sending the rest. openclaw#90242 introduced quarantine with a synthetic unreadable-getter fixture and live Mistral probe, without a linked human actual-use incident; openclaw#172587 retained it. The stream now reports the original error before any request; the caller can repair the tool definition and retry.

## Evidence

- Provider-boundary suite: 30/30 passing, including unreadable definitions alone and alongside a valid tool, with zero requests sent; existing valid-tool and schema-detachment coverage retained.
- Core production typecheck and focused type-aware Mistral lint passed.
- Fresh independent Codex review: scoped-clean through P2, with byte-identical production/test files at commit time.
- Runtime import cycles: 0; Madge cycles: 0. Standalone lint-suppressions gate: 3/3 passing. No import edges changed in this bug fix.
- [Hosted CI on the exact head](https://github.com/openclaw/openclaw/actions/runs/38773777501) passed. No CI rerun or green-only push.
- No live-provider claim: this changes local definition failure handling, not the Mistral wire contract.
- Local check-changed was attempted: conflict markers, line-cap and assertion-safety checks passed; max-lines reported stale baseline entries in two untouched test files. The SQLite ratchet made no progress for over 12 minutes and was stopped, without altering baselines. Hosted CI on this exact head is the broad gate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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