12 Commits
Author SHA1 Message Date
rays ceb1d7b2fe feat(pipeline): unify llm context construction 2026-04-26 19:28:22 +08:00
rays 63b7770c27 fix(imports): guard absolute fallback paths 2026-04-26 19:04:24 +08:00
rays 01568bf8a8 fix(startup): harden prestartup encoding and non-ui console output 2026-04-04 17:23:22 +08:00
rays 8f99daa282 fix(imports): harden package-safe startup loading 2026-04-04 16:27:47 +08:00
rookiestar28 280a37ff7f feat(analyzer): refactor into A6 plugin-based pipeline architecture with community plugin support 2026-01-06 13:13:52 +08:00
rookiestar28 1ce8ed6130 feat(f4): add error statistics dashboard with pattern tracking, category breakdown, and resolution rate (14/18 E2E tests passing) 2026-01-04 20:24:48 +08:00
rookiestar28 096692eb23 feat: add missing_input error pattern and fix ERROR_KEYS mapping
Changes:
1. Added new pattern for "Required input is missing" error
   - Pattern ID: missing_input
   - Regex: "Required input is missing: (.+)"
   - Priority: 80 (workflow-level)
   - Captures input name dynamically

2. Updated i18n.py for all 9 languages
   - Added ERROR_KEYS["MISSING_INPUT"]
   - Added translations: en, zh_TW, zh_CN, ja, de, fr, it, es, ko
   - Format: "輸入源資訊遺失:{0}。請檢查上游節點輸出是否正常連接。"

3. Fixed analyzer.py ERROR_KEYS mapping bug (CRITICAL)
   - PatternLoader returns uppercase keys (e.g., "MISSING_INPUT")
   - get_suggestion() expects lowercase keys (e.g., "missing_input")
   - Added mapping: suggestion_key = ERROR_KEYS.get(error_key, error_key)
   - This fix applies to ALL patterns, not just missing_input

Testing:
- PatternLoader tests: ✅ All 9 tests pass (22 patterns total)
- Manual test: ✅ Pattern matches "text_int_float" correctly
- Analyzer test: ✅ Returns correct suggestion with captured group
2026-01-03 04:55:37 +08:00
rookiestar28 12d3b8e285 feat(patterns): implement PatternLoader with JSON-based pattern management (STAGE 2)
Integrate PatternLoader into analyzer.py to enable JSON-based error pattern
management with hot-reload capability, while preserving fallback to hardcoded
patterns for reliability.

Features:
- JSON-based pattern definitions with schema validation
- Hot-reload capability without restart
- Priority-based pattern matching (higher priority checked first)
- Multi-directory support (builtin, community, custom)
- Backward compatible with fallback to hardcoded PATTERNS

Implementation:
- pattern_loader.py: Core PatternLoader class (309 lines)
  - load(): Load patterns from JSON files with schema validation
  - match(): Match error against patterns (priority-sorted)
  - reload_if_changed(): Hot-reload on file modification
  - get_stats(): Pattern statistics and categorization
- patterns/schema.json: JSON schema definition
  - Required fields: id, regex, error_key, priority, category
  - Optional fields: has_groups, tags, notes
  - Validation: unique IDs, valid priority range (0-100), valid categories
- patterns/builtin/core.json: Migrated 21 existing patterns
  - Priority distribution: 9 high (80-100), 12 medium (50-79)
  - Category distribution: 7 data_type, 3 memory, 3 workflow, 2 model_loading, etc.
- tests/test_pattern_loader.py: Comprehensive test suite (9 tests)
  - All tests passed ✅

Integration with analyzer.py:
- Updated ErrorAnalyzer.analyze():
  - Try PatternLoader first (JSON patterns)
  - Fallback to hardcoded PATTERNS on any error
  - Ensures error analysis always works
- Added ErrorAnalyzer.reload_patterns():
  - Public API for hot-reload
  - Returns True if patterns reloaded

Test Results:
✅ All 9 unit tests passed
✅ Manual integration test passed
✅ 21 patterns loaded from core.json
✅ Error detection working correctly (CUDA OOM, validation errors)
✅ Hot-reload functionality verified
✅ Zero performance regression (<1ms pattern matching)

Architecture:
- Preserves fallback mechanism (learned from STAGE 1)
- Priority-based sorting prevents false positives
- Schema validation catches errors early
- Graceful error handling (never crashes)

Next Steps:
- STAGE 3: F12 Pattern Expansion (35+ community patterns)
- After STAGE 1+2 stable for 3+ days

References:
- Planning: .planning/STAGE2_F2_INTEGRATION_PLAN.md
- Implementation Record: .planning/STAGE2_IMPLEMENTATION_RECORD.md
- Original F2 Design: .planning/FAILURE-F12_F2_T8_IMPLEMENTATION_PLAN.md
2026-01-03 04:55:18 +08:00
rookiestar28 7f43fb6ad7 feat(logger): implement SafeStreamWrapper architecture to fix error capture failure (STAGE 1)
BREAKING CHANGE: Complete logger architecture redesign to resolve catastrophic
error capture failure from previous F12/F2/T8 implementation.

Problem Summary:
- Previous implementation relied on ComfyUI's LogInterceptor on_flush callbacks
- ComfyUI's LogInterceptor.flush() clears _logs_since_flush after EACH callback
- TerminalService (registered first) got data, Doctor (registered second) got empty array
- Result: Complete error capture failure in both frontend and backend
- Required emergency rollback to stable version

Solution (v1.3.0):
- SafeStreamWrapper: Zero-lock write() with immediate pass-through + queue.put_nowait()
- DoctorLogProcessor: Independent background thread processes queued messages
- Complete decoupling from LogInterceptor's callback mechanism
- Non-blocking queue with graceful overflow handling

Architecture Changes:
- logger.py: Complete rewrite (453 lines)
  - SafeStreamWrapper class (lines 103-158)
  - DoctorLogProcessor class (lines 160-350)
  - Updated install() and uninstall() functions (lines 363-422)
  - Preserved SmartLogger backward compatibility wrapper (lines 428-445)
- analyzer.py: Added import fallback for test compatibility
- tests/test_logger_safety.py: New comprehensive test suite (278 lines)
  - 8 test cases covering all critical scenarios
  - All tests passed ✅
- ROADMAP.md: Added Phase 4B with STAGE 1/2/3 breakdown

Test Results:
✅ All 8 unit tests passed
✅ No deadlock under burst load (15+ rapid validation errors)
✅ Error capture functionality verified
✅ Concurrent write safety confirmed
✅ LogInterceptor compatibility tested
✅ Queue overflow handling working
✅ Buffer timeout mechanism functional
✅ API backward compatibility preserved
✅ User-confirmed: Frontend & backend error capture working correctly

Key Design Decisions:
- write() holds ZERO locks → prevents deadlock
- Immediate pass-through → preserves original stream behavior
- Non-blocking queue.put_nowait() → never blocks main thread
- Background DoctorLogProcessor → completely independent analysis
- Graceful error handling → never crashes, always degrades gracefully

References:
- Implementation Plan: .planning/STAGE1_LOGGER_FIX_PLAN.md
- Implementation Record: .planning/STAGE1_IMPLEMENTATION_RECORD.md
- Failure Analysis: .planning/FAILURE-ERROR_CAPTURE_FAILURE_ANALYSIS.md
- Failed Implementation: .planning/FAILURE-F12_F2_T8_IMPLEMENTATION_PLAN.md

Next Steps:
- STAGE 2: F2 Integration (PatternLoader)
- STAGE 3: F12 Pattern Expansion (35+ new patterns)
- Merge to main after all stages complete and stable (1+ week)
2026-01-03 04:54:56 +08:00
rookiestar28 976e3fa3a0 fix: adjust and fix the interface components of the error panel. 2025-12-31 18:15:25 +08:00
rookiestar28 24b2ab0e74 fix: improve validation error capture to collect all failed outputs instead of only the last one 2025-12-31 11:57:09 +08:00
rookiestar28 1ee7cc0529 Initial commit: ComfyUI-Doctor with Frontend UI and LLM integration 2025-12-28 12:57:26 +08:00