Repository navigation
refactor(signal): reuse shared error coercion - #113544
Conversation
Sanjays2402
left a comment
There was a problem hiding this comment.
Verified the shared helper against both deleted copies: packages/normalization-core/src/error-coercion.ts:114 is byte-identical to the two local toLintErrorObject definitions, including the { cause: value } construction and the Object.assign for object/function values. So this is a true no-op dedup, not a behavior change smuggled in as a refactor.
One thing worth confirming before merge: client.ts already imported from openclaw/plugin-sdk/error-runtime, so that file is proven. client-container.ts gains that import path for the first time in this diff. Worth a quick check that the signal extension's build resolves plugin-sdk/error-runtime from that module too, since a missing subpath export would only surface at runtime on the WebSocket reject path, which is exactly the path nobody exercises until something is already failing.
Nice cleanup otherwise. Two identical private helpers is exactly the kind of drift that bites later when only one of them gets a fix.
|
Land-ready proof:
Behavior sweep covered HTTP, SSE, WebSocket receive, WebSocket construction, and all canonical error-coercion input branches. |
|
Merged via squash.
|
| import https from "node:https"; | ||
| import { generateSecureUuid } from "openclaw/plugin-sdk/core"; | ||
| import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime"; | ||
| import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime"; |
There was a problem hiding this comment.
extensions/signal/src/monitor.tool-result.autostart.test.ts still carries its own byte-identical toLintErrorObject copy at the bottom — third one in this extension. worth pulling into the same import while youre here so the dupe doesnt survive the cleanup.
What Problem This Solves
Signal carried two byte-equivalent local helpers for converting arbitrary rejection values into
Errorobjects, even though the Plugin SDK already exposes the canonical normalization-core implementation.Why This Change Was Made
Use
toErrorObjectfromopenclaw/plugin-sdk/error-runtimeat all four Signal call sites while preserving each existing fallback string and structured error field.User Impact
No intended behavior change. Signal client and container failures now share the established error-coercion contract, removing 27 net production lines.
Evidence
git diff --checkpnpm check:changed: passed in Blacksmith Testboxtbx_01kyby7khhk9g7ervt0gb61aj3