一次真实修改,四项测试通过。
OpenCode 1.19.0 · Qwen3.8-27B · Windows · 实测于 2026 年 10 月 14 日。以代码与操作日志呈现原始运行证据。
1 → 4通过测试 / 共 4 项
25.256s智能体事件时间窗
30,911客户端记录 tokens
0保留会话内工具失败
此处展示 10 月 14 日保留的真实运行,并非 10 月 15 日重新调用 API。25.256 秒从首个 step_start 到最终 step_finish,不含安装、进程启动及独立复测;未记录整个进程的墙钟耗时。
复现起点
环境为 Node.js 25.2.1、OpenCode 1.19.0。来源示例固定了版本、配置、初始代码和测试。仅启用 IteraCompute 提供方,允许文件操作与 node --test。
固定提交的示例与锁文件 → · 原始验收证据 · OpenCode CLI · 提供方官方配置
1 · 准备环境(Bash)
git clone https://github.com/IteraCompute/migration-kit.git
cd migration-kit
git checkout b71ebf5e09b761f958c643075b8e0a5d3032e44f
cd examples/opencode
npm ci
npm run code -- --version
export ITERACOMPUTE_API_KEY="your-api-key"
mkdir workspace
cp opencode.json starter/slugify.mjs starter/slugify.test.mjs workspace/
cd workspace
node --test slugify.test.mjs查看实测提供方配置
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"model": "iteracompute/qwen/qwen3.8-27b",
"small_model": "iteracompute/qwen/qwen3.8-27b",
"enabled_providers": ["iteracompute"],
"provider": {
"iteracompute": {
"npm": "@ai-sdk/openai-compatible",
"name": "IteraCompute",
"options": {
"baseURL": "https://api.iteracompute.com/v1",
"apiKey": "{env:ITERACOMPUTE_API_KEY}"
},
"models": {
"qwen/qwen3.8-27b": {
"name": "Free Qwen3.8-27B",
"cost": { "input": 0, "output": 0, "cache_read": 0, "cache_write": 0 },
"limit": { "context": 131072, "output": 8192 },
"options": { "chat_template_kwargs": { "enable_thinking": false } }
}
}
}
},
"permission": {
"*": "deny",
"read": "allow",
"glob": "allow",
"grep": "allow",
"edit": "allow",
"bash": { "*": "deny", "node --test*": "allow" }
}
}
修改前 · slugify.mjs
export function slugify(text) {
return text.toLowerCase().replaceAll(" ", "-");
}
模型修改后 · slugify.mjs
export function slugify(text) {
return text
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
}
四项原始测试(未修改)
slugify.test.mjs
import assert from "node:assert/strict";
import test from "node:test";
import { slugify } from "./slugify.mjs";
test("lowercases and joins words", () => {
assert.equal(slugify("Hello World"), "hello-world");
});
test("trims whitespace and collapses punctuation", () => {
assert.equal(slugify(" Hello, World! "), "hello-world");
});
test("collapses repeated separators", () => {
assert.equal(slugify("API___ migration---kit"), "api-migration-kit");
});
test("keeps digits and returns empty for punctuation only", () => {
assert.equal(slugify("Version 42"), "version-42");
assert.equal(slugify(" !!! "), "");
});
完整输入与操作记录
2 · 原始完整提示
Fix slugify.mjs so all four existing tests pass. Lowercase ASCII letters, preserve digits, replace runs of other characters with one hyphen, and trim leading/trailing hyphens. Do not change slugify.test.mjs. Run node --test slugify.test.mjs and report the result.3 · 在 workspace 内执行(Bash / PowerShell)
npm --prefix .. run code -- run --dir workspace --agent build --format json "Fix slugify.mjs so all four existing tests pass. Lowercase ASCII letters, preserve digits, replace runs of other characters with one hyphen, and trim leading/trailing hyphens. Do not change slugify.test.mjs. Run node --test slugify.test.mjs and report the result."- 基线:4 项测试,1 项通过、3 项失败,退出码 1。失败覆盖标点、连续分隔符及首尾清理。
+0.769s · glob · completed列出项目文件+4.708s · read · completed读取函数+5.641s · read · completed读取测试+13.577s · edit · completed修改函数+19.899s · bash · completed执行 node --test slugify.test.mjs · 退出码 0- 最终回复非空;独立复测 4 项通过、0 项失败,退出码 0。测试文件 SHA-256 保持一致。
4 · 智能体测试输出
✔ lowercases and joins words (2.3435ms)
✔ trims whitespace and collapses punctuation (0.2539ms)
✔ collapses repeated separators (0.2248ms)
✔ keeps digits and returns empty for punctuation only (0.1989ms)
ℹ tests 4
ℹ suites 0
ℹ pass 4
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 212.5302
5 · 智能体最终回复
All 4 tests pass:
```
✔ lowercases and joins words
✔ trims whitespace and collapses punctuation
✔ collapses repeated separators
✔ keeps digits and returns empty for punctuation only
tests 4, pass 4, fail 0
```
The fix in slugify.mjs: lowercase, replace runs of non-`[a-z0-9]` characters with a single hyphen, then trim leading/trailing hyphens.6 · 独立复测:node --test slugify.test.mjs
✔ lowercases and joins words (1.8327ms)
✔ trims whitespace and collapses punctuation (0.2687ms)
✔ collapses repeated separators (0.178ms)
✔ keeps digits and returns empty for punctuation only (0.1737ms)
ℹ tests 4
ℹ suites 0
ℹ pass 4
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 198.9705
用量、费用与失败情况
| 步骤 | 输入 | 输出 | 推理 | 合计 |
|---|---|---|---|---|
| 1 | 5,484 | 32 | 21 | 5,537 |
| 2 | 5,609 | 131 | 22 | 5,762 |
| 3 | 6,143 | 158 | 195 | 6,496 |
| 4 | 6,316 | 82 | 83 | 6,481 |
| 5 | 6,530 | 96 | 9 | 6,635 |
| 总计 | 30,082 | 499 | 330 | 30,911 |
用量来自五次模型步骤的 OpenCode step_finish 计数,每步重传的上下文重复计入。该客户端记录的输出 499 与推理 330 单独列出,缓存读取 / 写入均为 0,客户端估价为 $0。这不是控制台账单,也不是独立 tokenizer 测量。
成功会话配置了 chat_template_kwargs.enable_thinking=false,但客户端仍记录 330 推理 tokens;不能仅凭该配置推定推理用量为零。
失败情况:修复前 3 项测试失败;保留的成功会话内工具失败 0 次。未记录更早尝试、请求重试或重复运行成功率。一次小型修复不能证明 128K 长上下文、图像理解、大型仓库、持续负载或其他操作系统表现。
完整脱敏证据(JSON)
opencode-workflow.json
{
"date": "2026-10-14",
"platform": "Windows",
"model": "qwen/qwen3.8-27b",
"base_url": "https://api.iteracompute.com/v1",
"versions": {
"node": "25.2.1",
"opencode": "1.19.0"
},
"source_commit": "b71ebf5e09b761f958c643075b8e0a5d3032e44f",
"prompt": "Fix slugify.mjs so all four existing tests pass. Lowercase ASCII letters, preserve digits, replace runs of other characters with one hyphen, and trim leading/trailing hyphens. Do not change slugify.test.mjs. Run node --test slugify.test.mjs and report the result.",
"event_window_ms": 25256,
"timing_scope": "First step_start to final step_finish; excludes install, process startup and independent test rerun. Process wall time was not recorded.",
"steps": [
{
"elapsed_ms": 1421,
"reason": "tool-calls",
"tokens": {
"total": 5537,
"input": 5484,
"output": 32,
"reasoning": 21,
"cache": {
"write": 0,
"read": 0
}
},
"client_cost_usd": 0
},
{
"elapsed_ms": 6373,
"reason": "tool-calls",
"tokens": {
"total": 5762,
"input": 5609,
"output": 131,
"reasoning": 22,
"cache": {
"write": 0,
"read": 0
}
},
"client_cost_usd": 0
},
{
"elapsed_ms": 14321,
"reason": "tool-calls",
"tokens": {
"total": 6496,
"input": 6143,
"output": 158,
"reasoning": 195,
"cache": {
"write": 0,
"read": 0
}
},
"client_cost_usd": 0
},
{
"elapsed_ms": 20584,
"reason": "tool-calls",
"tokens": {
"total": 6481,
"input": 6316,
"output": 82,
"reasoning": 83,
"cache": {
"write": 0,
"read": 0
}
},
"client_cost_usd": 0
},
{
"elapsed_ms": 25256,
"reason": "stop",
"tokens": {
"total": 6635,
"input": 6530,
"output": 96,
"reasoning": 9,
"cache": {
"write": 0,
"read": 0
}
},
"client_cost_usd": 0
}
],
"exit_code": 0,
"baseline": {
"tests": 4,
"pass": 1,
"fail": 3,
"exit_code": 1
},
"tools": [
{
"tool": "glob",
"status": "completed"
},
{
"tool": "read",
"status": "completed",
"file": "slugify.mjs"
},
{
"tool": "read",
"status": "completed",
"file": "slugify.test.mjs"
},
{
"tool": "edit",
"status": "completed",
"file": "slugify.mjs"
},
{
"tool": "bash",
"status": "completed",
"command": "node --test slugify.test.mjs",
"exit_code": 0,
"output": "✔ lowercases and joins words (2.3435ms)\n✔ trims whitespace and collapses punctuation (0.2539ms)\n✔ collapses repeated separators (0.2248ms)\n✔ keeps digits and returns empty for punctuation only (0.1989ms)\nℹ tests 4\nℹ suites 0\nℹ pass 4\nℹ fail 0\nℹ cancelled 0\nℹ skipped 0\nℹ todo 0\nℹ duration_ms 212.5302\n"
}
],
"client_estimated_cost_usd": 0,
"tests_unchanged": true,
"test_sha256": "a86b36c60e8d19281abbd656dafc9eabe87e66053bed8e57e466696e65e04884",
"final_code": "export function slugify(text) {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n",
"final_reply": "All 4 tests pass:\n\n```\n✔ lowercases and joins words\n✔ trims whitespace and collapses punctuation\n✔ collapses repeated separators\n✔ keeps digits and returns empty for punctuation only\ntests 4, pass 4, fail 0\n```\n\nThe fix in slugify.mjs: lowercase, replace runs of non-`[a-z0-9]` characters with a single hyphen, then trim leading/trailing hyphens.",
"independent_rerun": {
"exit_code": 0,
"stdout": "✔ lowercases and joins words (1.8327ms)\n✔ trims whitespace and collapses punctuation (0.2687ms)\n✔ collapses repeated separators (0.178ms)\n✔ keeps digits and returns empty for punctuation only (0.1737ms)\nℹ tests 4\nℹ suites 0\nℹ pass 4\nℹ fail 0\nℹ cancelled 0\nℹ skipped 0\nℹ todo 0\nℹ duration_ms 198.9705\n"
},
"tool_events": [
{
"elapsed_ms": 769,
"tool": "glob",
"status": "completed"
},
{
"elapsed_ms": 4708,
"tool": "read",
"status": "completed"
},
{
"elapsed_ms": 5641,
"tool": "read",
"status": "completed"
},
{
"elapsed_ms": 13577,
"tool": "edit",
"status": "completed"
},
{
"elapsed_ms": 19899,
"tool": "bash",
"status": "completed"
}
],
"recorded_tool_failures": 0,
"scope": "One retained successful session, five model steps. Earlier attempts and multi-run reliability were not recorded. No long-context boundary, image quality or sustained load test."
}