W18: context cleanup + CLI fixes + loader audit + CI matrix (W18.1-W18.4)
Some checks failed
CI / Determine matrix (push) Has been cancelled
CI / ${{ matrix.os }} / ${{ matrix.build_type }} (push) Has been cancelled

- W18.1 (王测+林深): Remove g_max_tokens dead API, UTF-8 bounds protection, deduplicate token counting, 0xC0/0xC1 handling, add 13 test blocks (36 checks)
- W18.2 (赵码+朱晴): Fix /context no-session error message, /status 3-state connection display
- W18.3 (曹武+徐磊): plugin_loader security audit — 9 dimensions, rating C, 1 HIGH + 2 MEDIUM findings
- W18.4 (马奔+胡桐): CI dual-platform matrix (Ubuntu clang-18 + Windows clang-cl), ccache, build timing baseline

Build 0 error, ctest 5/5 pass, metadata check clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 19:09:21 +08:00
parent 852e2cac08
commit c545d16120
18 changed files with 945 additions and 77 deletions

View File

@@ -440,19 +440,15 @@ int main()
std::cout << "\n--- Regression Tests (R1-R3: W11.7/W12 bug protection) ---\n";
// ---- R1: context max_tokens 生效 ----
// 回归: W11.1 Discovery 3 (g_max_tokens 死变量 — W12.3 已修)
// 回归: W11.1 Discovery 3 (g_max_tokens 死变量 — W12.3 已修, W18.1 彻底移除)
// W11.7 BUG-3 (/context 静默 — W12.3 已修)
// 验证: set_max_tokens 后 trim 能正确裁剪消息数,调用链完整不崩溃
// 验证: trim 能正确裁剪消息数,调用链完整不崩溃
{
auto* ctx = static_cast<const dstalk_context_service_t*>(
dstalk_service_query("context", 1));
if (ctx) {
std::cout << "[OK] R1: context service found\n";
// 设置较小的 max_tokens 触发裁剪
ctx->set_max_tokens(50);
std::cout << "[OK] R1: set_max_tokens(50) no crash\n";
// 构造 5 条消息,每条 ~50 字符 / ~15 token总计 ~75 token > 50 max
dstalk_message_t msgs[5];
msgs[0] = {"user", "Hello this is message one with enough text to count tokens", nullptr, nullptr};