Skip to content

refactor(signal): reuse shared error coercion - #113544

Merged
vincentkoc merged 1 commit into
mainfrom
cleanup/signal-error-coercion-20260725
Jul 25, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
cleanup/signal-error-coercion-20260725

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Signal carried two byte-equivalent local helpers for converting arbitrary rejection values into Error objects, even though the Plugin SDK already exposes the canonical normalization-core implementation.

Why This Change Was Made

Use toErrorObject from openclaw/plugin-sdk/error-runtime at 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

  • Hosted Signal extension suite: 43 files and 728 tests passed
  • Fresh autoreview: no actionable findings
  • git diff --check
  • Current-main hosted pnpm check:changed: passed in Blacksmith Testbox tbx_01kyby7khhk9g7ervt0gb61aj3

@vincentkoc
vincentkoc marked this pull request as ready for review July 25, 2026 06:55
@vincentkoc vincentkoc self-assigned this Jul 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: signal Channel integration: signal size: XS maintainer Maintainer-authored PR labels Jul 25, 2026

@Sanjays2402 Sanjays2402 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready proof:

  • Exact head: 4677d602d9b5b01029b9e4524fccb8fa51d13ea0
  • Hosted Signal extension suite: 43 files and 728 tests passed
  • Current-main hosted pnpm check:changed: passed in Blacksmith Testbox tbx_01kyby7khhk9g7ervt0gb61aj3
  • GitHub CI run 30148363783: passed
  • Fresh autoreview: no actionable findings
  • Docs: not applicable
  • Changelog: not required for this internal behavior-preserving refactor

Behavior sweep covered HTTP, SSE, WebSocket receive, WebSocket construction, and all canonical error-coercion input branches.

@vincentkoc
vincentkoc merged commit f6d4562 into main Jul 25, 2026
161 of 168 checks passed
@vincentkoc
vincentkoc deleted the cleanup/signal-error-coercion-20260725 branch July 25, 2026 07:03
@vincentkoc

Copy link
Copy Markdown
Member Author

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";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: signal Channel integration: signal maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants