docs(03-02): complete approval handler and progress monitor plan
- Created 03-02-SUMMARY.md with: - Approval workflow with confirm/reject card buttons - Progress monitoring with 60-second throttled updates - 15 tests across approval and progress modules - Updated STATE.md with decisions and metrics - Updated ROADMAP.md with plan progress - Marked BRDG-04, BRDG-05 requirements complete Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
---
|
||||
phase: 03-orchestration
|
||||
plan: 02
|
||||
subsystem: orchestration
|
||||
tags: [approval, progress, callbacks, feishu-cards, throttling]
|
||||
|
||||
# Dependency graph
|
||||
requires:
|
||||
- phase: 02-integration-layer
|
||||
provides: FeishuResponseFormatter, CardButton for card creation
|
||||
- phase: 01-core-infrastructure
|
||||
provides: StateManager for persistence
|
||||
provides:
|
||||
- ApprovalHandler class for approval workflow state management
|
||||
- ApprovalState dataclass for approval data
|
||||
- ProgressMonitor class for progress detection and update logic
|
||||
- ProgressInfo dataclass for progress data
|
||||
affects: [03-03, 04-full-command-support]
|
||||
|
||||
# Tech tracking
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns:
|
||||
- Pattern matching for approval request detection
|
||||
- Content-hash based progress pattern extraction
|
||||
- Time-based throttling for progress updates
|
||||
- In-memory approval cache with UUID-based IDs
|
||||
|
||||
key-files:
|
||||
created:
|
||||
- src/gsd_openclaw/approval_handler.py
|
||||
- src/gsd_openclaw/progress_monitor.py
|
||||
- tests/test_approval_handler.py
|
||||
- tests/test_progress_monitor.py
|
||||
modified:
|
||||
- src/gsd_openclaw/__init__.py
|
||||
|
||||
key-decisions:
|
||||
- "No timeout limit for approvals - wait for user response or session end"
|
||||
- "60 second default interval for progress updates (from CONTEXT.md)"
|
||||
- "Fraction pattern allows content after fraction (e.g., [3/5 tasks])"
|
||||
|
||||
patterns-established:
|
||||
- "ApprovalState dataclass with approval_id, session_id, project_name, context, created_at"
|
||||
- "ProgressInfo dataclass with type, value, current, total fields"
|
||||
- "CardButton with value dict containing action, approval_id, project for callbacks"
|
||||
|
||||
requirements-completed: [BRDG-04, BRDG-05]
|
||||
|
||||
# Metrics
|
||||
duration: 5min
|
||||
completed: 2026-03-11
|
||||
---
|
||||
|
||||
# Phase 3 Plan 2: Approval Handler and Progress Monitor Summary
|
||||
|
||||
**Approval workflow with confirm/reject card buttons and progress monitoring with 60-second throttled updates**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** 5 min
|
||||
- **Started:** 2026-03-11T07:57:20Z
|
||||
- **Completed:** 2026-03-11T08:05:00Z
|
||||
- **Tasks:** 3
|
||||
- **Files modified:** 4
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- Implemented ApprovalHandler with approval pattern detection (AskUserQuestion, ExitPlanMode, 需要确认, Please confirm)
|
||||
- Implemented approval card creation with confirm/reject buttons using CardButton
|
||||
- Implemented callback handling for approve/reject actions
|
||||
- Implemented ProgressMonitor with progress extraction (percentage, fraction, phase, completion)
|
||||
- Implemented 60-second throttled progress updates
|
||||
- Created comprehensive test suite with 15 tests (326 lines total)
|
||||
|
||||
## Task Commits
|
||||
|
||||
Each task was committed atomically:
|
||||
|
||||
1. **Task 1: Create test scaffolds** - `99f7536` (test)
|
||||
2. **Task 2: Implement ApprovalHandler class** - `af43b28` (feat)
|
||||
3. **Task 3: Implement ProgressMonitor class** - `a8631dc` (feat)
|
||||
|
||||
**Plan metadata:** `8ed8823` (feat: export classes from package)
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `src/gsd_openclaw/approval_handler.py` - Approval workflow state management with ApprovalState and ApprovalHandler
|
||||
- `src/gsd_openclaw/progress_monitor.py` - Progress detection and update logic with ProgressInfo and ProgressMonitor
|
||||
- `tests/test_approval_handler.py` - 8 tests for approval handling
|
||||
- `tests/test_progress_monitor.py` - 7 tests for progress monitoring
|
||||
- `src/gsd_openclaw/__init__.py` - Added exports for new classes
|
||||
|
||||
## Decisions Made
|
||||
|
||||
- Used UUID for approval IDs to ensure uniqueness across sessions
|
||||
- Approval buttons use primary (confirm) and danger (reject) button types
|
||||
- No timeout for approvals - wait indefinitely for user response
|
||||
- Progress patterns checked in order: percentage, fraction, phase, completion
|
||||
- should_send_update returns False on first call (no previous update)
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 1 - Bug] Fixed test assertions to use kwargs**
|
||||
- **Found during:** Task 2 (ApprovalHandler tests)
|
||||
- **Issue:** Tests accessed positional args (call_args[0][0]) but implementation uses keyword args
|
||||
- **Fix:** Changed to call_args.kwargs.get("title") pattern
|
||||
- **Files modified:** tests/test_approval_handler.py, tests/test_progress_monitor.py
|
||||
- **Verification:** All 15 tests pass
|
||||
- **Committed in:** af43b28, a8631dc (Task 2 and 3 commits)
|
||||
|
||||
**2. [Rule 1 - Bug] Fixed fraction pattern to allow content after fraction**
|
||||
- **Found during:** Task 3 (ProgressMonitor tests)
|
||||
- **Issue:** Pattern `\[(\d+)/(\d+)\]` didn't match `[3/5 tasks]` with extra content
|
||||
- **Fix:** Changed to `\[(\d+)/(\d+)(?:[^\]]*)\]` to allow optional content
|
||||
- **Files modified:** src/gsd_openclaw/progress_monitor.py
|
||||
- **Verification:** Test test_extract_progress_returns_fraction passes
|
||||
- **Committed in:** a8631dc (Task 3 commit)
|
||||
|
||||
**3. [Rule 1 - Bug] Fixed should_send_update to return False on first call**
|
||||
- **Found during:** Task 3 (ProgressMonitor tests)
|
||||
- **Issue:** should_send_update returned True when last_update_time=0 because elapsed time was huge
|
||||
- **Fix:** Added check for last_update_time == 0.0 to return False on first call
|
||||
- **Files modified:** src/gsd_openclaw/progress_monitor.py
|
||||
- **Verification:** Test test_should_send_update_returns_false_immediately passes
|
||||
- **Committed in:** a8631dc (Task 3 commit)
|
||||
|
||||
---
|
||||
|
||||
**Total deviations:** 3 auto-fixed (all Rule 1 - Bug fixes)
|
||||
**Impact on plan:** All auto-fixes necessary for correctness. No scope creep.
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
- pytest not installed in venv - reinstalled with `pip install pytest libtmux pyyaml`
|
||||
|
||||
## User Setup Required
|
||||
|
||||
None - no external service configuration required.
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
- Approval and progress modules complete, ready for orchestrator integration
|
||||
- ApprovalHandler and ProgressMonitor can be used by Phase 3 Plan 3 for command routing
|
||||
- All 143 tests pass across the project
|
||||
|
||||
---
|
||||
*Phase: 03-orchestration*
|
||||
*Completed: 2026-03-11*
|
||||
Reference in New Issue
Block a user