Repository navigation
fix(muse): keep typed quota stops classified as rate_limit - #195095
licheer-zte wants to merge 1 commit into
Conversation
MSP reports a quota stop only through the structured `TurnError.quota` field and tells clients never to parse `message`. The Muse harness dropped that field when it converted the terminal failure to a plain Error, and the diagnostic wrapper created a second plain Error, so the host classified the failure by Muse's free-text wording. Neutral wording such as "Tier limit reached for this window." classified as null and the configured fallback model never ran. Keep the terminal error as the cause and rebuild a typed wrapper carrying status 429 when MSP attached quota detail; the host's existing status classification then yields rate_limit without reading the wording. Failures without quota detail keep their previous identity. Refs openclaw#195072
|
🦞👀 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 real behavior proof before merge. What this changesThis PR maps typed Muse quota failures to HTTP 429 so host error handling can recognize them independently of message wording. Example: Muse returns quota detail with the message “Request stopped for this account.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this PR addresses a source-confirmed Muse quota-reporting bug, but introduces an undefined class reference and still discards the structured quota error at the final wrapper. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Muse plugin translates MSP turn outcomes into OpenClaw attempt terminals, which feed shared provider-error classification and user-facing replies. flowchart LR
A[Muse CLI] --> B[Muse SDK]
B --> C[Muse harness]
C --> D[Attempt terminal]
D --> E[Host failure classification]
E --> F[User reply]
Technical reviewBest possible solution: Map MSP quota presence to status 429 and retain that error as the diagnostic wrapper’s cause, preserving existing native replay safety. Do we have a high-confidence way to reproduce the issue? Source establishes both quota-identity loss on main and the introduced unresolved identifier; the linked reporter describes a controlled CLI reproduction, but this review executed no target code. Is this the best way to solve the issue? Structural quota mapping is the right boundary, but the final wrapper must preserve its cause; the PR’s fallback claim conflicts with the reporter’s corrected reproduction and existing native replay policy. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b595ee78e015. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +36, Tests +26, Other +2. Total +64 across 4 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:
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 Reviewed November 8, 2026, 2:38 AM ET / 07:38 UTC. |
|
Thanks for the work here. We're closing this: it doesn't show a real user-facing problem (no report from an affected user and no natural reproduction), and it follows a pattern of small, speculative or duplicate changes split across many PRs. Please open an issue with a reproduction of real harm first; a fix can follow once the problem is confirmed. |
What Problem
Muse turns that stop on a quota ran out fall back to the configured fallback model only when Muse's free-text message happens to look like a rate limit. MSP marks the stop structurally and the schema tells clients to branch on
quotapresence, never onmessage:extensions/muse/harness.tsdropped that field twice — once when theterminal === "failed"branch convertedturnErrorto a plainError, and again when the diagnostic wrapper builtnew Error(failureMessage)— so the host classified the failure from the wording alone.Tier limit reached for this window.classifies asnull, and no fallback runs.Repro (classifier probe on
main, fictional wording):Why This Change Was Made
Keep the typed fact instead of re-deriving it from text:
terminal === "failed"conversion now keepsturnErroras theErrorcause.museTurnFailurerebuilds a typed wrapper only when MSP attachedquotadetail (found through the cause chain), carryingstatus: 429. The host already maps a bare 429 status torate_limit(classifyFailoverSignal), so fallback works for any wording and no new classifier pattern is needed.agentHarnessAttemptTerminal.setFailurekeeps the typed error when one is present instead of flattening it to its message.Fix shape is the one ClawSweeper named: "Translate typed Muse quota failures into the existing structured rate-limit signal and preserve it through the diagnostic wrapper."
User Impact
A Muse quota stop now fails over to the configured fallback model regardless of Muse's wording, instead of surfacing "Agent couldn't generate a response" and ending the turn. Error text shown to users and the Gateway log are unchanged.
Evidence
Classifier probe on this branch's host code (real
classifyFailoverSignal):Extension boundary lint (production imports unchanged):
New regression:
extensions/muse/harness.test.tsdrives the real harness againstfake-muse.mjs, which now emits a structurally typed MSP quota terminal (quota: { limitKind: "tierLimit", ... }, neutral messageRequest stopped for this account.) and asserts the attempt terminal carriesstatus: 429; a second test pins that an untyped Muse failure does not gain a failover status.Limitation (explicit):
extensions/musecould not be executed in this environment — the@muse-code/[email protected]workspace link is not installed (the pnpm install is blocked by the host's offline metadata mirror / Node patch floor), soextensions/muse/harness.test.tsfails at import (Cannot find package '@muse-code/sdk') before any test runs. No CI replacement is claimed here; PR CI runs the extension lane. The host-side link of the chain is executed above: the status/code the new wrapper produces classifies asrate_limit.[AI-assisted]