Skip to content

feat(cli): add an opt-in tool/approval wall-time bottleneck report for unattended runs (#220)#221

Merged
qwen-code-dev-bot merged 1 commit into
mainfrom
issue/220-run-bottleneck-diagnostics
Jul 22, 2026
Merged

feat(cli): add an opt-in tool/approval wall-time bottleneck report for unattended runs (#220)#221
qwen-code-dev-bot merged 1 commit into
mainfrom
issue/220-run-bottleneck-diagnostics

Conversation

@qwen-code-dev-bot

Copy link
Copy Markdown
Owner

Summary

Adds an opt-in (--bottleneck) privacy-safe wall-time bottleneck report for unattended (-p) runs, decomposed from roadmap #38 (observable autonomous execution).

A long run could look healthy in the aggregate run summary (#40) while one slow tool or one long approval gate dominated its wall-time, with no way to tell where the time went short of parsing raw logs. This report ranks tools and approval gates by wall-time and call count so an operator can target the real bottleneck.

Design

  • New src/run-bottleneck.ts: a BottleneckCollector accumulates per-tool execution wall-time and per-approval-gate wait wall-time; build ranks entries by wall-time (desc), head-bounds to 16, and reports the truncated count. Mirrors the run-summary.ts schema/redaction conventions.
  • src/agent.ts: executeToolCall times the approval gate (requestApproval) and the tool execution (tool.execute) separately, recording into an optional collector threaded through AgentOptions.
  • src/headless-protocol.ts: new bottleneck NDJSON event.
  • src/index.ts: opt-in --bottleneck flag wired into both the NDJSON and plain-text headless paths.

The report is metadata only — tool names, wall-time, and counts. It has no channel for prompts, file contents, secrets, or raw tool payloads.

Testing

  • tests/unit/run-bottleneck.test.ts (13 tests): ranking, tool/approval separation, tie-breaks, head bound + truncation, name sanitization, empty inventory, formatting.
  • tests/integration/run-bottleneck.test.ts (5 tests): text/JSON emission, a deliberately slow tool ranked first, secret-shaped arguments kept out of the report, empty inventory.

Gates: typecheck, build, unit (1598), integration (433 + desktop), smoke (51) all pass.

Closes #220

…r unattended runs (#220)

A long autonomous run could look healthy in the aggregate run summary while one slow tool or one long approval gate dominated its wall-time, with no way to tell where the time went short of parsing raw logs. Add a privacy-safe, bounded bottleneck report (opt-in --bottleneck) that ranks tools and approval gates by wall-time and call count, in both the NDJSON headless stream and the plain-text path. The report is metadata only (tool names, wall-time, counts) and has no channel for prompts, file contents, secrets, or raw tool payloads.
@qwen-code-dev-bot

Copy link
Copy Markdown
Owner Author

E2E verification

  • Repository: qwen-code-dev-bot/oh-my-cli
  • Pull request: #221
  • Commit: 293fa8096c10cbea8d31fbb4a3d0743e8509ea89
  • Evidence mode: terminal
  • Result: PASS
Scenario Command Exit Duration
integration npm run test:integration 0 28.31s
smoke npm run smoke 0 3.017s

E2E evidence

Full immutable report

@qwen-code-dev-bot
qwen-code-dev-bot merged commit e8dffb3 into main Jul 22, 2026
2 checks passed
@qwen-code-dev-bot
qwen-code-dev-bot deleted the issue/220-run-bottleneck-diagnostics branch July 22, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run diagnostics: identify the tool and approval wall-time bottlenecks of one unattended run, redacted and bounded

1 participant