makecindy / makecindy/cindy

[Bug] 插件 tool-call 参数含全角中文标点时报 UnicodeEncodeError (lone surrogate)

Open
#2,282 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

**提交人**: 老宏
**客户端版本**: 0.1.38

---

**现象**
Windows 10 上,调用一个带 node worker 的 chip 插件(`node` slot,`json-rpc-stdio` 协议),tool-call 参数里含全角中文标点(如 `:`、`。`、`,`)时,host 报错:

```
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcb7' in position 206: surrogates not allowed
```

**复现步骤**
1. 任意 chip 插件,`slots: ["tool","node"]`,node entry 为 `node/worker.cjs`,protocol `json-rpc-stdio`
2. main.js 收到 tool-call 后转发给 node worker
3. 参数含全角中文标点(例如 `text: "测试:中文冒号"`,仅 7 个字符)
4. host 报 `UnicodeEncodeError ... surrogates not allowed`

**补充观察**
- 纯汉字(无标点)的长参数正常;一旦含全角标点(UTF-8 3 字节 CJK 符号区间)立即触发
- 与参数长度无关(7 字符即复现)
- 错误发生在 host 序列化阶段:插件侧(main.js / worker / Python bridge)各自做 surrogate 清理只能缓解,无法根治,因为到达插件层时字符串已被拆成 lone surrogate
- 不经 node worker 的其它插件用同样中文参数正常 → 疑似与 node worker 转发链路的参数编码有关

**期望行为**
含全角中文标点的参数正常编码传递到插件,不产生 lone surrogate。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.19045)
**界面语言**: zh-CN

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Windows win32 failure through the host serialization path with a node/worker.cjs entry using the json-rpc-stdio protocol. Trace the value through main.js and the Python bridge to identify where the lone surrogate appears. Done means full-width Chinese punctuation reaches the node worker intact without UnicodeEncodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.