test PR (debug) - #3
Closed
7723qqq wants to merge 1 commit into
Closed
Conversation
Each tryNative* call now records a native_tool_fallback telemetry event with one of disabled | load_failed | function_missing | function_threw, and logs once per (tool, reason) via console.warn so broken native binaries are visible without spam. The internal loader is now an explicit four-state machine (unloaded | disabled | load_failed | loaded) so flag-off vs binary- missing/ABI-mismatch are distinguishable in telemetry. setNativeTelemetry is wired automatically in SDKRpcClient from the harness telemetry option, so app code needs no change. No new lint warnings, typecheck clean, two new vitest cover the disabled branch and the warn-once-vs-telemetry-each-call semantics.
7723qqq
added a commit
that referenced
this pull request
Aug 10, 2026
- http.rs: widen the shared turn-context grace period from 100ms to 2s — a lagging WS projector could miss turn.started after the async-submit cleanup, silently dropping the whole turn projection and leaving its messages stuck in pending (v1 #2/#5) - kimi-web agent projector: only emit the client-accumulated usage snapshot at turn end when the turn actually reported step usage, so the authoritative event.session.usage_updated numbers are no longer clobbered with zeros (v1 #3) - regression tests for the usage gating
7723qqq
added a commit
that referenced
this pull request
Aug 10, 2026
…#5) - eventReducer messageUpdated now stores the protocol status on the message instead of dropping it, so streamed assistant messages leave their initial/pending state when the Rust server projects the completed close-out - AppMessage gains an optional status field; REST snapshot messages map as completed history (toAppMessage status param), WS-created messages stay unset until message.updated arrives - regression test covers the status hand-off; G-2 #2/#3 verified already fixed (take_turn 2s grace, usage_updated consumption)
7723qqq
added a commit
that referenced
this pull request
Aug 10, 2026
- new mappers-to-app-event tests lock message.updated status and session.usage_updated normalization onto the AppEvent shapes the Rust server projects - toAppMessage status parameter covered: snapshot loads carry 'completed', WS-created messages stay unset until message.updated - record the G-3 entry-switch assessment: the TS command surface is equivalent (plugin_run_node is superseded by the engine plugin model); the remaining blocker is the stage-F distribution packaging
7723qqq
added a commit
that referenced
this pull request
Aug 15, 2026
#2: Batch appendLoopEvent in executeStepTools — collect all tool.call and tool.result events during for-await, then dispatch once at end. Eliminates N synchronous context array copies per step. #3: Wire tryNativeReadBatch into native-tools.ts — existing Rust nativeBatchRead now callable from the tool layer. Callers fall back to sequential nativeRead when native module unavailable. #1: Async-ify native_edit with spawn_blocking — no longer blocks event loop during parallel tool execution.
7723qqq
added a commit
that referenced
this pull request
Aug 15, 2026
- http.rs: widen the shared turn-context grace period from 100ms to 2s — a lagging WS projector could miss turn.started after the async-submit cleanup, silently dropping the whole turn projection and leaving its messages stuck in pending (v1 #2/#5) - kimi-web agent projector: only emit the client-accumulated usage snapshot at turn end when the turn actually reported step usage, so the authoritative event.session.usage_updated numbers are no longer clobbered with zeros (v1 #3) - regression tests for the usage gating
7723qqq
added a commit
that referenced
this pull request
Aug 15, 2026
…#5) - eventReducer messageUpdated now stores the protocol status on the message instead of dropping it, so streamed assistant messages leave their initial/pending state when the Rust server projects the completed close-out - AppMessage gains an optional status field; REST snapshot messages map as completed history (toAppMessage status param), WS-created messages stay unset until message.updated arrives - regression test covers the status hand-off; G-2 #2/#3 verified already fixed (take_turn 2s grace, usage_updated consumption)
7723qqq
added a commit
that referenced
this pull request
Aug 15, 2026
- new mappers-to-app-event tests lock message.updated status and session.usage_updated normalization onto the AppEvent shapes the Rust server projects - toAppMessage status parameter covered: snapshot loads carry 'completed', WS-created messages stay unset until message.updated - record the G-3 entry-switch assessment: the TS command surface is equivalent (plugin_run_node is superseded by the engine plugin model); the remaining blocker is the stage-F distribution packaging
7723qqq
added a commit
that referenced
this pull request
Sep 1, 2026
v2 staleGuardService 的 Edit/Write 写前读检查此前对原生执行完全失效 (原生 Write 是裸奔面)。本批在引擎内全量镜像其语义: - tools/stale_guard.rs(新增):StaleGuardState(canonical 路径 → mtime 元组,精确比较)+ stale_denial 三分支判定(文案逐字节对齐 v2)+ observe_execution + plan_file_write_exempt(plan 文件豁免镜像 v2 planService.allow() 短路)+ StaleGate 门面(denial 仅当要拦时经 state_read 查 plan 豁免,桥失败 fail-open 与 P39 一致)。 - callbacks.rs:NativeToolCallbacks 增 stale_guard 字段;execute_tool 门 在 permission allow 后、执行前插拦截(denial 发 tool.native is_error, 不回退宿主);native 成功/宿主转发/沙箱回退三处完成后观测记录,把 宿主路径 read 的记录洞闭上。 - 三路径接线:napi create_engine_session / stdio session/create / REPL 每会话一次 = v2 per-agent-scope 生命周期,跨 turn 存活。 - 验证:cargo lib 854(stale_guard 12 + 门级 4)、stdio 集成 15/15 (未读直写拦字节精确文案/read→write/外部改 mtime 拦/宿主 read→native write/跨 turn session RPC)、napi-integration 46/46(真实 .node + session-handle 跨 turn)、clippy 0、oxlint 0 errors。 - ROADMAP P38 表 #3 销账 + P41 文档;changeset 记录用户可见行为变化。 已知 flaky 与本批无关:P28 subagent spawned 断言与 M1c quiescence 5s 超时在全量并行下偶发,pristine 树(stash 还原 + 重建 .node)同样复现。
7723qqq
added a commit
that referenced
this pull request
Sep 1, 2026
v2 goalAgentRuntime 的 CreateGoal 启动审批与陈旧 goal 拒绝此前对原生 执行完全失效(goal 静默启动、旧轮可改已变更的 goal)。本批在引擎内补齐: - tools/goal_guard.rs(新增):GoalGuard——turn 起始 goal 绑定表 + requires_host(非 auto 路由)+ stale_denial(突变工具双拼写、 goalId 比较、goal 清空即 stale、读失败 fail-open、文案逐字节对齐 v2)。 - #7 审批 = 路由回宿主:非 auto 模式(含 mode 未知 fail-closed)下 CreateGoal 不经原生执行,走宿主 executeTool——goal-start 审批链 (含 mode 切换面板)原样生效,零重实现。mode 取 pipeline 快照 (PermissionEngine::mode())。 - #8 stale veto:run_turn 入口经新 HostCallbacks::set_turn_goal 绑定 turn→goal(默认 no-op,NativeToolCallbacks/SteerQueueCallbacks 转发, 零装配点改动);gate 在 permission 后插入 stale_denial,denial 发 tool.native is_error + 合成结果,不回退宿主。 - 预算宽限轮由 run_turn 硬停结构性覆盖,无需复刻(文档说明差异)。 - 顺带修复 napi callbacks.goal() 死缝:NapiHostCallbacks 增 goal_fn 并实现(session 接线,legacy 留 None fail-open)。 - 验证:cargo lib 866(goal_guard 6 + 门级 4 + 绑定 2)、stdio 16/16 (CreateGoal 无快照必回退 E2E)、napi-integration 49/49(manual 回退/ auto 原生/session stale E2E)、clippy 0、oxlint 0 errors。 - ROADMAP P38 #7/#8 销账 + P42 文档(含诚实边界:mode 会话级陈旧、 REPL 无审批、预算硬停差异);changeset 记录用户可见行为。 迁移队列:#4 P39 ✅、#3 P41 ✅、#7+#8 P42 ✅ → 剩余 #6/#2/MoonshotAI#13。
7723qqq
added a commit
that referenced
this pull request
Sep 1, 2026
v2 agentExternalHooksService 的用户 PreToolUse 钩子此前对引擎原生路径 零对应(原生工具执行不触发)。本批在引擎内全量执行: - tools/external_hooks.rs(新增):HookGuard——event 过滤(只 PreToolUse)/matcher 正则(非法跳过)/command 去重/并行(tokio join_all,按序取首个 block);平台 shell spawn;stdin 写 snake_case 载荷(hook_event_name/session_id/cwd/client_type/session_title/ tool_name/tool_input/tool_call_id);超时 select + kill;三分支判定 (exit 2 → stderr;stdout JSON deny → reason;其余 allow)与 fail-closed 文案(failed to spawn / timed out / errored)逐字节对齐 v2。 - 配置随 PolicySnapshot 推送(零新 wire 字段):PolicySnapshot 增 pre_tool_hooks;宿主 rust-engine.ts getPolicySnapshot 从 loadRuntimeConfigSafe 读 [hooks];REPL 经 KimiConfig.hooks 段 + build_policy_snapshot。 - gate 集成:permission allow 后、goal_guard 前(镜像 v2 链序); denial 发 tool.native is_error + 合成结果,不回退宿主。 - 验证:cargo lib 879(external_hooks 11 + 门级 2)、stdio 18/18 (exit2 拦/exit0 放行 E2E)、napi-integration 51/51(真实 .node)、 rust-engine 25/25(宿主推送零回归)、clippy 0、oxlint 0 errors。 - ROADMAP P38 #6 销账 + P43 文档(含诚实边界:载荷字段近似、kill 链 降级、快照会话级推送、其他 19 种事件仍归宿主、cmd 引号教训); changeset 记录用户可见行为。 迁移队列:#4 P39 ✅、#3 P41 ✅、#7+#8 P42 ✅、#6 P43 ✅ → 剩余 #2(toolDedupe)、MoonshotAI#13(tower worker,随 M3)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
debug