Repository navigation
feat(research): add per-step timing printouts to Phase 1.5 and Phase 2 - #355
Conversation
Thread TreeProgressDisplay through WideCoverageStrategy → DepthExplorationService and GapDetectionService. Each service gains an _emit_event helper and perf_counter() timing around every step, emitting gap_step events (▶) with per-step durations visible in the terminal progress tree. Also fixes from code review: - gap_stats["chunks_added"] now includes import_chunks_added, matching the completion event message - Step 2.10 / 1.5.6 import-resolution timing event always emits (previously silently dropped when resolve_and_fetch_imports returns []) - gaps_filled reuses the variable from step 2.7 instead of recomputing - total_before_dedup reuses chunks_from_fills instead of re-iterating gap_results - Add gap_step and fact_extraction symbols to TreeProgressDisplay Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…vent duplication GapDetectionService and DepthExplorationService had identical _emit_event implementations. Extracted to a shared ProgressEmitterMixin in the shared package. Also fixes depth_stats["chunks_added"] to include import_chunks_added, matching the semantics of gap_stats["chunks_added"] and the completion log message. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Fix I001: move ProgressEmitterMixin import to correct sorted position in depth_exploration.py - Fix E501: split long f-strings in _emit_event calls across two lines (depth_exploration, gap_detection) - Fix E501: shorten chunks_added inline comment in gap_detection stats dict - Fix blank line missing after TYPE_CHECKING block in gap_detection.py - Add _progress = None default to ProgressEmitterMixin to prevent AttributeError in future subclasses Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
ofriw
left a comment
There was a problem hiding this comment.
Note: This review was generated by an AI agent. If you'd like to talk with other humans, drop by our Discord!
Hey — nice work on the timing printouts and the stat fixes. The chunks_added including imports, the variable reuse in steps 2.7/2.8, and the fact_extraction symbol fix are all solid. The mixin extraction is the right idea.
One thing to address before merge:
The mixin creates a second _emit_event instead of unifying. PluggableResearchService still has its own version with a different signature (has node_id, uses a lock, different depth default). The PR description says "extract to eliminate duplication" — but right now you've got two parallel implementations of the same thing. Either have PluggableResearchService use the mixin too, or add a comment explaining why they need to stay different.
Everything else looks good — the TYPE_CHECKING usage, the consistent perf_counter() pattern with early-return handling, and the timing always emitting even when steps return nothing.
Attached is an agent optimized description of the changes in this PR - AGENT_REVIEW.md
…mitterMixin Extends the mixin to support node_id (BFS tree placement) and optional lock serialization via _progress_lock, then removes PluggableResearchService's duplicate _emit_event — eliminating the two-parallel-implementations issue flagged in code review. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The mixin's depth=2 default caused PluggableResearchService top-level events (main_start, synthesis_start, fact_extraction, etc.) to render indented at depth 2 instead of the top level — a regression from the service's original depth=None default. Fix: change the mixin default back to None, add a _default_depth class variable (None by default), and resolve it in _emit_event as: effective_depth = depth if depth is not None else self._default_depth GapDetectionService and DepthExplorationService set _default_depth = 2 so their gap_step calls stay at depth 2 without touching the call sites. Also moves the TYPE_CHECKING block in wide_coverage_strategy.py to after all regular imports (standard isort ordering). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
ofriw
left a comment
There was a problem hiding this comment.
Note: This review was generated by an AI agent. If you'd like to talk with other humans, drop by our Discord!
Nice work addressing the previous review — the mixin extraction is the right call, and the timing pattern with perf_counter() is clean. The stat fixes (chunks_added including imports, variable reuse in steps 2.7/2.8) are solid improvements.
One issue to fix before merge: the mixin's _emit_event has depth: int | None = 2 as the default, but the old PluggableResearchService._emit_event had depth: int | None = None. Since _render_event treats None as root-level (no prefix) and 2 as indented (│ ├── ), every existing call in PluggableResearchService that doesn't pass depth — main_start, main_info, evidence_ledger, synthesis_start, fact_extraction, main_complete, etc. — will now render indented 2 levels instead of at root. This is a visual regression in the terminal output. Fix is simple: change the mixin default to depth: int | None = None.
Attached is an agent optimized description of the changes in this PR - AGENT_REVIEW.md
|
@ofriw I think I've already handled the latest issue. please run your review again |
…CP read-only, and fixes Merge main into matryoshka-fix-6-26. main changes incorporated: - DuckDB compaction with atomic swap (#339) - PowerShell (#350) and Metal (#351) language parsers - MCP --read-only flag (#329) - Research per-step timing (#355) - Various fixes: websearch late-completion guard, quickresearch orphan cleanup, token literal counting, claude-cli auto-updater - openai_compatible in factory's supported_providers() Conflict resolution: chunkhound/services/realtime_indexing_service.py was deleted on main (dead code, no production callers). The branch's ModuleType __class__ hack + its test were removed to match.
Thread TreeProgressDisplay through WideCoverageStrategy → DepthExplorationService and GapDetectionService. Each service gains an _emit_event helper and perf_counter() timing around every step, emitting gap_step events (▶) with per-step durations visible in the terminal progress tree.
Also fixes from code review: