Orca 派工正文含 Markdown 反引号时可能在工具调用前触发 JavaScript 语法错误
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: liuheng
**客户端版本**: 0.1.44
---
## 现象
通过代码编排工具调用 Orca `create_worker` / `send_to_worker` 时,如果把较长的 Markdown 派工正文直接嵌入 JavaScript 模板字符串,正文中的反引号或 `${...}` 可能提前结束或插值模板,导致脚本解析失败。工具实际尚未被调用,但用户侧容易理解为 Worker 创建或派工失败。
## 复现步骤
1. 构造一段包含 Markdown 行内代码、代码块反引号或 `${...}` 的派工正文。
2. 将正文直接写进 JavaScript 模板字符串,再作为 `initial_task` 或 `message` 参数调用 Orca。
3. 执行编排脚本。
脱敏错误摘要:`SyntaxError: Unexpected identifier`。错误发生在 JavaScript 解析阶段,Orca 工具没有收到调用。
## 期望行为
- 派工正文应经过 JSON 安全序列化或等效转义后再进入编排脚本。
- Markdown 反引号、`${...}`、单双引号、中文和代码块都不应影响工具调用。
- 若解析阶段失败,应明确显示“工具尚未调用”,避免误判为 Worker 创建失败。
## 实际行为
正文中的模板字符串特殊字符导致编排脚本语法错误;需要人工改成字符串数组拼接后才能成功创建并派发 Worker。
## 复现频率
当前会话中至少复现 2 次;只要使用直接模板字符串且正文包含冲突字符,具有稳定复现条件。
## 已尝试
- 将正文改为普通字符串数组并用换行拼接,调用成功。
- 避免模板字符串,或先做 JSON 安全序列化,可规避问题。
## 建议
1. Cindy 的代码编排/工具调用封装统一对自由文本参数做 JSON 安全序列化,不直接插入 JavaScript 模板字符串。
2. 增加包含反引号、`${...}`、单双引号、中文代码块的回归测试。
3. 区分“脚本解析失败”和“Orca 工具返回失败”,在 UI 中显示准确阶段。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26200)
**界面语言**: zh-CN
Contributor guide
Research direction
Start by reproducing the failure through the Cindy code-orchestration path using Orca create_worker and send_to_worker with initial_task or message containing backticks and ${...}. Trace the tool-call wrapper to identify where free-text parameters enter the JavaScript script, then add regression coverage for the listed special characters. Done means these inputs reach the tool safely and script-parse failures are distinguished from Orca tool failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100