fix(events): 工具耗时算完即丢,SSE `tool_progress` 用批次墙钟冒充单工具耗时(同批同数字、还含审批等待)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 50/100
Research direction
Start at run_core.rs:1227-1228 and :1293, where duration_ms is computed but only fed to the PostToolCall hook, and at the ToolResult event definition in src/event.rs:41-52. Add duration_ms to ToolResult, populate it at those two sites, and have the SSE handler at handlers.rs:1204-1227 forward it rather than subtracting ToolCall from ToolResult. Finish by rendering it in crates/recursive-tui/src/model.rs:117-123. Done when each tool in a batch reports its own duration and the TuiPermissionHook approval wait (backend.rs:328-359) is excluded.
Written by the indexing model from the issue text.
Description
场景 gap 单(okguitar 提报)· 优先级 P1 · 依赖:无 · 验收:代码 diff 逐点核对;运行时可见性另需 Langfuse(#124)
基线 origin/main = fc29f3d4。
Summary
duration_ms在run_core.rs:1227-1228(并行)/:1293(串行)算好后只喂 PostToolCall hook;ToolCallOutcome无该字段;ToolResult事件无耗时(src/event.rs:41-52字段:id/name/output/step/is_error)。- 所有
ToolResult在整批execute_tool_calls返回后统一发射(run_core.rs:1429-1430)→ HTTP 侧用 ToolCall→ToolResult 差值算 elapsed(handlers.rs:1204-1227):同批所有工具显示同一个数字,且包含TuiPermissionHook的人工审批等待(backend.rs:328-359批内阻塞)。TUI 的 ToolCall block 也无 duration(crates/recursive-tui/src/model.rs:117-123)。
影响
"哪个工具慢、慢在排队还是执行、人审批占了多少"——三个值班问题一个都答不了;tool_progress 数字会误导归因。
建议
ToolResult 补 duration_ms(有条件再补 queue/approval 分段);SSE 直接转发不重算;TUI 渲染显示。
- Dominant language
- Rust
- Stars
- 4
- Forks
- 0
- Avg merge
- 5h 32m
- Merged PRs (30d)
- 7
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jeffkit/recursive
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
jeffkit/recursive#134 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
jeffkit/recursive#131 · 1 comment ·
Maintainers usually reply within 1 day
All issues in jeffkit/recursive
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Devolutions/picky-rs#546 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zcashlabs/thus-spoke-zakura#153 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
topgrade-rs/topgrade#2395 ·
Maintainers usually reply within 1 day
-
app bug windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day