diff --git a/gsd-openclaw/.planning/REQUIREMENTS.md b/gsd-openclaw/.planning/REQUIREMENTS.md index d441e32..ca7a757 100644 --- a/gsd-openclaw/.planning/REQUIREMENTS.md +++ b/gsd-openclaw/.planning/REQUIREMENTS.md @@ -22,8 +22,8 @@ Requirements for initial release. Each maps to roadmap phases. - [ ] **BRDG-01**: User can send any GSD slash command through chat (e.g., /gsd:new-project) - [x] **BRDG-02**: Command output is captured and returned to user through chat - [x] **BRDG-03**: User receives clear error messages when commands fail -- [ ] **BRDG-04**: User can approve/reject GSD workflow gates through chat responses -- [ ] **BRDG-05**: User receives periodic progress updates during long-running operations +- [x] **BRDG-04**: User can approve/reject GSD workflow gates through chat responses +- [x] **BRDG-05**: User receives periodic progress updates during long-running operations - [ ] **BRDG-06**: All GSD slash commands are supported (no command left behind) ### OpenClaw Integration @@ -82,8 +82,8 @@ Which phases cover which requirements. Updated during roadmap creation. | BRDG-01 | Phase 3 | Pending | | BRDG-02 | Phase 3 | Complete | | BRDG-03 | Phase 3 | Complete | -| BRDG-04 | Phase 3 | Pending | -| BRDG-05 | Phase 3 | Pending | +| BRDG-04 | Phase 3 | Complete | +| BRDG-05 | Phase 3 | Complete | | BRDG-06 | Phase 4 | Pending | | OCLW-01 | Phase 2 | Complete | | OCLW-02 | Phase 2 | Complete | diff --git a/gsd-openclaw/.planning/STATE.md b/gsd-openclaw/.planning/STATE.md index d9a4e26..85ad148 100644 --- a/gsd-openclaw/.planning/STATE.md +++ b/gsd-openclaw/.planning/STATE.md @@ -3,14 +3,14 @@ gsd_state_version: 1.0 milestone: v1.0 milestone_name: milestone status: executing -stopped_at: Completed 03-01-PLAN.md -last_updated: "2026-03-11T07:55:08.315Z" +stopped_at: Completed 03-02-PLAN.md +last_updated: "2026-03-11T08:09:45.581Z" last_activity: 2026-03-11 - Completed 02-03 prompt templates progress: total_phases: 4 completed_phases: 2 total_plans: 10 - completed_plans: 8 + completed_plans: 9 percent: 100 --- @@ -53,6 +53,7 @@ Progress: [██████████] 100% *Updated after each plan completion* | Phase 02-integration-layer P03 | 5 | 3 tasks | 6 files | | Phase 03-orchestration P01 | 5 | 3 tasks | 3 files | +| Phase 03-orchestration P02 | 5 | 3 tasks | 4 files | ## Accumulated Context @@ -81,6 +82,9 @@ Recent decisions affecting current work: - [Phase 03-orchestration]: 60 second default timeout for command execution (from CONTEXT.md user decision) - [Phase 03-orchestration]: 3 consecutive polls with same output hash for stabilization detection - [Phase 03-orchestration]: Word-boundary regex for ASCII error keywords, simple substring for Chinese +- [Phase 03-02]: No timeout limit for approvals - wait for user response or session end +- [Phase 03-02]: 60 second default interval for progress updates (from CONTEXT.md) +- [Phase 03-02]: Fraction pattern allows content after fraction (e.g., [3/5 tasks]) ### Pending Todos @@ -96,8 +100,8 @@ None yet. ## Session Continuity -Last session: 2026-03-11T07:55:08.313Z -Stopped at: Completed 03-01-PLAN.md +Last session: 2026-03-11T08:09:45.579Z +Stopped at: Completed 03-02-PLAN.md Resume file: None --- diff --git a/gsd-openclaw/.planning/phases/03-orchestration/03-02-SUMMARY.md b/gsd-openclaw/.planning/phases/03-orchestration/03-02-SUMMARY.md new file mode 100644 index 0000000..e97f41e --- /dev/null +++ b/gsd-openclaw/.planning/phases/03-orchestration/03-02-SUMMARY.md @@ -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*