Skip to content

feat(hooks,mcp): ZEPH_TOOL_DURATION_MS in PostToolUse hooks + parallel OAuth MCP connect#3361

Merged
bug-ops merged 1 commit intomainfrom
parallel-mcp-hook-duration
Apr 24, 2026
Merged

feat(hooks,mcp): ZEPH_TOOL_DURATION_MS in PostToolUse hooks + parallel OAuth MCP connect#3361
bug-ops merged 1 commit intomainfrom
parallel-mcp-hook-duration

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 24, 2026

Summary

Changes

File Change
crates/zeph-subagent/src/agent_loop.rs +4 lines: Instant::now() before executor, insert ZEPH_TOOL_DURATION_MS into hook_env after
crates/zeph-mcp/src/manager.rs connect_oauth_deferred refactored from sequential for loop to two-phase JoinSet pattern

Test plan

  • cargo +nightly fmt --check — pass
  • cargo clippy --workspace --lib --bins -- -D warnings — pass (0 warnings)
  • cargo nextest run --workspace --lib --bins — 8338 tests pass
  • Code review: approved, no blocking issues

Follow-up

…arallelize OAuth MCP connect

#3316: Record tool executor wall time and expose it as ZEPH_TOOL_DURATION_MS
in the env vars passed to post_tool_use hooks. Timer starts after PreToolUse
fires and stops before PostToolUse fires, matching the Claude Code v2.1.119
duration_ms semantics.

#3315: Refactor connect_oauth_deferred in zeph-mcp to use JoinSet for
parallel server handshakes, mirroring the existing connect_all pattern.
Per-server errors remain non-fatal; shared-state writes are committed in
separate guarded blocks after the drain phase to avoid holding a lock
across .await.

Closes #3316
Closes #3315
@bug-ops bug-ops force-pushed the parallel-mcp-hook-duration branch from 70c4267 to d2b2c6c Compare April 24, 2026 19:39
@bug-ops bug-ops enabled auto-merge (squash) April 24, 2026 19:39
@bug-ops bug-ops merged commit 6257a57 into main Apr 24, 2026
32 checks passed
@bug-ops bug-ops deleted the parallel-mcp-hook-duration branch April 24, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

1 participant