W21: anthropic Stream+Tools + --prompt batch + sanitizer fix + plugin unit tests (W21.1-W21.6)
- W21.1: ci-sanitize preset 独立 Linux-clang + ci-threadsan (TSan) - W21.2: anthropic tool_use content_block 解析 + configure 缓存 tools_json - W21.3: --prompt 非交互批处理模式 - W21.4: session auto-save 失败告警 + 当前目录 fallback - W21.5: smoke 补 tool_calls 边界用例 4 块 12 断言 - W21.6: anthropic 11 块 78 CHECK + deepseek 12 块 78 CHECK Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -115,5 +115,18 @@ performance_log:
|
||||
验证: cmake --build build --config Release 0 error,
|
||||
ctest --test-dir build 5/5 pass。
|
||||
rating: done
|
||||
- date: 2026-05-27
|
||||
event: "W21.1: 修复 ci-sanitize preset 编译器冲突 + 新增 ci-threadsan"
|
||||
detail: >
|
||||
根因: ci-sanitize 继承 conan-release,后者 CMAKE_C_COMPILER/CXX=cl (MSVC),
|
||||
但 -fsanitize=address,undefined 是 clang/GCC flag,CI 运行在 ubuntu-24.04+clang-18,
|
||||
编译器覆盖冲突导致 sanitizer 行为不可预测。
|
||||
修复: ci-sanitize 改为独立 preset (generator Ninja + toolchainFile
|
||||
${sourceDir}/build/Release/conan_toolchain.cmake + CMAKE_C_COMPILER=clang-18
|
||||
+ CMAKE_CXX_COMPILER=clang++-18 + flags -fsanitize=address,undefined
|
||||
-fno-omit-frame-pointer)。新增 ci-threadsan (TSan)。
|
||||
验证: cmake --list-presets 4 个全部解析通过,Release 构建 cmake --build build --config Release
|
||||
8/8 0 error,ctest 6/6 pass。
|
||||
rating: done
|
||||
current_groups: []
|
||||
---
|
||||
|
||||
@@ -65,6 +65,23 @@ performance_log:
|
||||
/ on_init 已在 W12.1 预制异常保护,本次补全剩余 2 个入口。
|
||||
构建验证: cmake --build Release 0 error; ctest 4/4 pass。
|
||||
findings-registry: F-11.1-1 → FIXED, Fix Wave W16.2。
|
||||
- date: 2026-05-27
|
||||
event: "W21.2: anthropic_plugin Stream+Tools -- configure() + SSE tool_use content_block delta"
|
||||
rating: completed
|
||||
details: |
|
||||
L32: static g_tools_json cache from tools service.
|
||||
L79-133 build_request_json: tools_json param + tools field (L127-130).
|
||||
L138-235 parse_response: extract tool_use blocks -> OpenAI JSON (L172-201).
|
||||
L237-329 parse_sse_data: content_block_start(type=tool_use) -> ToolCallAccum (L262-278),
|
||||
input_json_delta -> accumulate partial_json (L296-308), content_block_stop/message_stop.
|
||||
L242-258 ToolCallAccum + StreamContext.tool_calls vector.
|
||||
L328-337 my_configure: query_service("tools") -> get_tools_json() -> g_tools_json.
|
||||
L358-361 my_chat: tools_json uncommented, build_request_json(tools_json?:g_tools_json).
|
||||
L484 my_chat_stream: build_request_json(g_tools_json).
|
||||
L498-519: serialize tool_calls -> OpenAI JSON -> result.tool_calls_json.
|
||||
Aligns with W20.2 pattern (cache + incremental), adapted for Anthropic format
|
||||
(content_block_start/input_json_delta vs delta.tool_calls).
|
||||
Build: cmake --build Release 0 error (anthropic plugin); ctest 6/6 pass.
|
||||
- date: 2026-05-27
|
||||
event: "W20.2: deepseek_plugin Stream+Tools 支持 — configure() 缓存 tools_json + SSE 增量 tool_calls 解析"
|
||||
rating: completed
|
||||
|
||||
@@ -57,3 +57,6 @@ current_groups:
|
||||
- date: 2026-05-27
|
||||
event: "W20.1: 实现 CLI Tool Calling 闭环 — 在 main.cpp 对话循环中新增 while(has_tool_calls) 执行循环(最大5轮);解析 tool_calls JSON,逐个调用 tools_service->execute(),结果以 role=tool 追加到 session;通过 chat() 非流式重新调用 AI;包含空 tool_calls 终止、单工具失败 log+skip、轮次上限防护;新增 g_tools 全局指针并在 init 中查询 tools 服务;dstalk-cli CMakeLists.txt 添加 boost::boost/dstalk_boost_config 链接;修复 tests/CMakeLists.txt 中 boost::boost 大小写错误和缺少 find_package;编译 0 error 0 warning;5/5 基线测试 100% pass"
|
||||
rating: A
|
||||
- date: 2026-05-27
|
||||
event: "W21.3: 实现 --prompt 批处理模式 — 新增 --prompt \"...\" 命令行参数解析(L403-409),保护 --prompt 后无值/值为空/值以 - 开头三种边界;设置 batch_mode 复用现有非交互基础设施(banner 抑制);新增 prompt_arg 代码块(L521-548)执行非交互路径:初始化→发送单条消息→输出 stdout→退出;退出码 EXIT_OK(0)/EXIT_FATAL(2)/EXIT_CONFIG(3) 统一使用;编译 dstalk-cli 0 error 0 warning;ctest 6/6 100% pass"
|
||||
rating: A
|
||||
|
||||
@@ -68,5 +68,12 @@ performance_log:
|
||||
编译 0 error 0 warning,ctest 5/5 pass。
|
||||
无新增依赖,不涉及多会话管理。
|
||||
rating: completed
|
||||
- date: 2026-05-27
|
||||
event: "W21.4 - session auto-save 失败告警 + 当前目录 fallback"
|
||||
detail: |
|
||||
on_shutdown 中 session_save 返回值检查:失败时 DSTALK_LOG_WARN + 尝试 ./dstalk_session_backup.json fallback。
|
||||
fallback 也失败时 DSTALK_LOG_ERROR,但不崩溃。
|
||||
编译 0 error,ctest 8/8 pass。
|
||||
rating: done
|
||||
current_groups: []
|
||||
---
|
||||
|
||||
@@ -54,6 +54,9 @@ performance_log:
|
||||
- date: 2026-05-27
|
||||
event: "W19.3 (协作 林深): plugin_loader 5 条发现修复验证。逐条审查 plugin_loader.cpp/host.cpp/plugin_loader.hpp:F-18.3-1 (ABI try/catch) 仅 2/5 调用点受保护,load_plugin L59/ unload_plugin L108-109/shutdown_all L306-307 仍裸奔;F-18.3-2 (静默失败) load_plugin 5 个失败路径零日志输出;F-18.3-3 (路径验证) load_plugin L28 仅 null 检查,无规范化/目录约束/扩展名校验;F-18.3-4 (fprintf→host->log) initialize_all L229+L239-240 仍用 fprintf,host_api 在手未用;F-18.3-5 (next_id_ atomics) plugin_loader.hpp L54 仍是 plain int,无 std::atomic,无 mutex。5 条发现全部 NOT FIXED,不予关单。编译 0 error + ctest 5/5 pass。"
|
||||
rating: A
|
||||
- date: 2026-05-27
|
||||
event: "W21.6: anthropic/deepseek plugin 单元测试框架搭建。通过 #include plugin source 访问 file-scope static 函数。anthropic_plugin_test.cpp: 11 测试块 78 CHECK 覆盖 parse_sse_data 边界 (空body/格式异常/畸形JSON/message_stop/content_block_delta 含 W21.2 tool_use 路径)/build_request_json (空消息/超长消息/temperature 边界/多 system 合并)/build_headers_json/extract_host_port/secure_zero/my_free_result/my_configure。deepseek_plugin_test.cpp: 12 测试块 78 CHECK 覆盖 parse_sse_line ([DONE] 精确匹配/大小写/whitespace trimming/content delta/tool_calls 增量累积)/build_request_json (tool_use/tools_json/空输入 guard)/build_headers_json/extract_host_port/append_history (tool/assistant tool_calls/null 字段)。cmake --build build --config Release 0 error。ctest 8/8 (100%) pass。"
|
||||
rating: A
|
||||
current_groups:
|
||||
- grp-quality-core (组长)
|
||||
---
|
||||
|
||||
@@ -18,6 +18,17 @@ weaknesses:
|
||||
- 单元测试有时过于针对实现
|
||||
- 不太关注测试可读性
|
||||
performance_log:
|
||||
- date: 2026-05-27
|
||||
event: "W21.5: smoke 回归补 tool_calls 边界用例 — 4 测试块, 12 断言"
|
||||
rating: done
|
||||
detail: |
|
||||
在 tests/smoke_test.cpp 新增 W21.5 边界测试块(行 563-658, +96 行):
|
||||
W21.5-1 null tool_calls_json: add message 后验证 history+1 且字段为 nullptr (2 断言)
|
||||
W21.5-2 空 "[]" tool_calls_json: add message 后验证 history+1 且字段保留为 "[]" (2 断言)
|
||||
W21.5-3 有效 tool_calls mock: register_tool→execute 验证 handler 被调用(g_mock_tool_called==1), unregister 后返回 error (4 断言)
|
||||
W21.5-4 save/load 往返: 含 tool_calls 消息的 session 经 save/load 后数据不丢失 (3 断言)
|
||||
新增 mock 全局: g_mock_tool_called + mock_tool_handler (行 27-31)
|
||||
cmake --build build --config Release 0 error, ctest 6/6 100% pass
|
||||
- date: 2026-05-27
|
||||
event: "W20.3: plugin_loader 安全回归测试 — 覆盖 W19 修复的 F-18.3-1~5"
|
||||
rating: done
|
||||
|
||||
Reference in New Issue
Block a user