diff --git a/.devagent/plugins/ralph/runs/fix-cursor-logs-pr-feedback-2026-01-31.json b/.devagent/plugins/ralph/runs/fix-cursor-logs-pr-feedback-2026-01-31.json new file mode 100644 index 00000000..64e46fd5 --- /dev/null +++ b/.devagent/plugins/ralph/runs/fix-cursor-logs-pr-feedback-2026-01-31.json @@ -0,0 +1,71 @@ +{ + "$schema": "../core/schemas/loop.schema.json", + "run": { + "git": { + "base_branch": "main", + "working_branch": "feature/fix-cursor-agent-logs" + }, + "execution": { + "max_iterations": 5, + "log_dir": ".devagent/plugins/ralph/logs/fix-cursor-logs-pr-feedback" + } + }, + "epic": { + "id": "devagent-pr94-feedback", + "title": "PR #94 CodeRabbit Feedback Fixes", + "description": "Address the 4 actionable review comments from CodeRabbit on PR #94 (fix-cursor-agent-logs).\n\nPR: https://github.com/lambda-curry/devagent/pull/94\n\nBranch: feature/fix-cursor-agent-logs" + }, + "availableAgents": ["engineering"], + "tasks": [ + { + "id": "1", + "title": "Skip ensureLogDirectoryExists when stored path exists", + "role": "engineering", + "description": "In api.logs.$taskId.stream.ts, skip the ensureLogDirectoryExists() call when storedLogPath is available.\n\nCurrently the route always creates the default log directory before using the stored path, which can throw and fail the stream even when the stored path is valid elsewhere.\n\n**Fix:** Only call ensureLogDirectoryExists() when we don't have a storedLogPath override.\n\nBranch: feature/fix-cursor-agent-logs", + "acceptance_criteria": [ + "ensureLogDirectoryExists is only called when no storedLogPath is present", + "Stream route works correctly when stored path points to a different location than default" + ], + "dependencies": [], + "labels": ["bugfix", "pr-feedback"] + }, + { + "id": "2", + "title": "Move resolveLogPathForRead inside validation try/catch", + "role": "engineering", + "description": "In api.logs.$taskId.ts, move the resolveLogPathForRead call inside the validation try/catch block.\n\nCurrently it can throw INVALID_TASK_ID before validation and produce a 500 instead of the intended 400 response.\n\n**Fix:** Call resolveLogPathForRead only after taskId is validated.\n\nBranch: feature/fix-cursor-agent-logs", + "acceptance_criteria": [ + "Invalid task IDs return 400 response, not 500", + "resolveLogPathForRead is only called after taskId is validated" + ], + "dependencies": [], + "labels": ["bugfix", "pr-feedback"] + }, + { + "id": "3", + "title": "Add optional logPath param to logFileExists", + "role": "engineering", + "description": "In logs.server.ts, update logFileExists to accept an optional logPath parameter instead of always recalculating.\n\n**Signature:** `logFileExists(taskId: string, logPath?: string)`\n**Implementation:** `pathToCheck = logPath || getLogFilePath(taskId)`\n\nBranch: feature/fix-cursor-agent-logs", + "acceptance_criteria": [ + "logFileExists accepts optional logPath parameter", + "When logPath is provided, it uses that path directly", + "When logPath is not provided, it calculates path as before", + "All call sites updated to pass resolved path where available" + ], + "dependencies": [], + "labels": ["refactor", "pr-feedback"] + }, + { + "id": "4", + "title": "Update docs metadata and fix markdown formatting", + "role": "engineering", + "description": "Update Last Updated to 2026-01-31 in task AGENTS.md, and fix markdown table formatting (MD060) in the plan doc.\n\n**Files:**\n- .devagent/workspace/tasks/active/2026-01-30_fix-cursor-agent-logs/AGENTS.md\n- .devagent/workspace/tasks/active/2026-01-30_fix-cursor-agent-logs/plan/2026-01-30_fix-cursor-agent-logs-plan.md\n\n**Fixes:**\n- Change Last Updated date to 2026-01-31\n- Ensure table separator row has spaces around pipes (MD060)\n\nBranch: feature/fix-cursor-agent-logs", + "acceptance_criteria": [ + "Last Updated shows 2026-01-31", + "Markdown tables pass MD060 lint" + ], + "dependencies": [], + "labels": ["docs", "pr-feedback"] + } + ] +} diff --git a/.devagent/plugins/ralph/runs/ralph-iteration-hooks-2026-01-31.json b/.devagent/plugins/ralph/runs/ralph-iteration-hooks-2026-01-31.json new file mode 100644 index 00000000..69e1a2f9 --- /dev/null +++ b/.devagent/plugins/ralph/runs/ralph-iteration-hooks-2026-01-31.json @@ -0,0 +1,84 @@ +{ + "$schema": "../core/schemas/loop.schema.json", + "run": { + "git": { + "base_branch": "main", + "working_branch": "feature/ralph-iteration-hooks" + }, + "execution": { + "max_iterations": 6, + "log_dir": ".devagent/plugins/ralph/logs/ralph-iteration-hooks" + } + }, + "epic": { + "id": "devagent-iteration-hooks", + "title": "Add completion and iteration hooks to Ralph", + "description": "Add callback hooks to Ralph for loop completion and per-iteration updates.\n\nBranch: feature/ralph-iteration-hooks" + }, + "availableAgents": ["engineering"], + "tasks": [ + { + "id": "1", + "title": "Add --on-complete CLI arg to ralph.sh", + "role": "engineering", + "description": "Add a new --on-complete argument to ralph.sh that accepts a path to a script.\n\n**File:** .devagent/plugins/ralph/tools/ralph.sh\n\n**Changes:**\n1. Add ON_COMPLETE_HOOK variable parsing\n2. Accept --on-complete in the CLI args loop\n3. Pass it to ralph.ts via --on-complete flag\n\nBranch: feature/ralph-iteration-hooks", + "acceptance_criteria": [ + "ralph.sh accepts --on-complete ", + "The value is passed to bun ralph.ts" + ], + "dependencies": [], + "labels": ["feature"] + }, + { + "id": "2", + "title": "Add --on-complete support to ralph.ts", + "role": "engineering", + "description": "Modify ralph.ts to call the on-complete hook when the loop finishes.\n\n**File:** .devagent/plugins/ralph/tools/ralph.ts\n\n**Changes:**\n1. Parse --on-complete CLI arg\n2. At the end of the loop (after all iterations complete or max reached), call the hook\n3. Payload should include: status, epicId, iterations, maxIterations, exitReason, durationSec, branch, logTail\n\n**Example:**\n```typescript\nif (onCompleteHook) {\n const payload = JSON.stringify({\n status: allTasksComplete ? 'completed' : 'blocked',\n epicId,\n iterations: currentIteration,\n maxIterations,\n exitReason,\n durationSec: (Date.now() - startTime) / 1000,\n branch: currentBranch,\n logTail: getLastNCharsOfLog(3000)\n });\n try {\n execSync(`echo '${payload}' | ${onCompleteHook}`, { stdio: 'inherit' });\n } catch (e) {\n console.error('Warning: on-complete hook failed:', e);\n }\n}\n```\n\nBranch: feature/ralph-iteration-hooks", + "acceptance_criteria": [ + "ralph.ts parses --on-complete argument", + "Hook is called when loop ends with proper JSON payload", + "Hook failures are logged but don't crash Ralph" + ], + "dependencies": ["1"], + "labels": ["feature"] + }, + { + "id": "3", + "title": "Add --on-iteration CLI arg to ralph.sh", + "role": "engineering", + "description": "Add a new --on-iteration argument to ralph.sh that accepts a path to a script.\n\n**File:** .devagent/plugins/ralph/tools/ralph.sh\n\n**Changes:**\n1. Add ON_ITERATION_HOOK variable parsing (similar to --on-complete)\n2. Accept --on-iteration in the CLI args loop\n3. Pass it to ralph.ts via --on-iteration flag\n\nBranch: feature/ralph-iteration-hooks", + "acceptance_criteria": [ + "ralph.sh accepts --on-iteration ", + "The value is passed to bun ralph.ts" + ], + "dependencies": ["1"], + "labels": ["feature"] + }, + { + "id": "4", + "title": "Add --on-iteration support to ralph.ts", + "role": "engineering", + "description": "Modify ralph.ts to call the on-iteration hook after each iteration completes.\n\n**File:** .devagent/plugins/ralph/tools/ralph.ts\n\n**Changes:**\n1. Parse --on-iteration CLI arg\n2. After each iteration (when a task completes), call the hook with JSON payload\n3. Payload: epicId, iteration, maxIterations, taskId, taskTitle, taskStatus, tasksCompleted, tasksRemaining, iterationDurationSec\n\n**Example:**\n```typescript\nif (onIterationHook) {\n const payload = JSON.stringify({\n epicId,\n iteration: currentIteration,\n maxIterations,\n taskId: task.id,\n taskTitle: task.title,\n taskStatus: taskResult.status, // 'completed' | 'failed' | 'blocked'\n tasksCompleted,\n tasksRemaining,\n iterationDurationSec\n });\n try {\n execSync(`echo '${payload}' | ${onIterationHook}`, { stdio: 'inherit' });\n } catch (e) {\n console.error('Warning: on-iteration hook failed:', e);\n }\n}\n```\n\nBranch: feature/ralph-iteration-hooks", + "acceptance_criteria": [ + "ralph.ts parses --on-iteration argument", + "Hook is called after each iteration with proper JSON payload", + "Hook failures are logged but don't stop the loop" + ], + "dependencies": ["2", "3"], + "labels": ["feature"] + }, + { + "id": "5", + "title": "Test hooks work end-to-end", + "role": "engineering", + "description": "Verify both hooks work by running a quick test.\n\n**Steps:**\n1. Create a test hook script that appends to a file\n2. Run ralph with both --on-iteration and --on-complete pointing to that hook\n3. Verify the file contains both iteration and completion payloads\n\nBranch: feature/ralph-iteration-hooks", + "acceptance_criteria": [ + "Both hooks are called during loop execution", + "Payloads contain all expected fields", + "Loop continues even if hooks fail" + ], + "dependencies": ["4"], + "labels": ["test"] + } + ] +} diff --git a/.devagent/plugins/ralph/runs/wake-hook-test-2026-02-03.json b/.devagent/plugins/ralph/runs/wake-hook-test-2026-02-03.json new file mode 100644 index 00000000..370f632f --- /dev/null +++ b/.devagent/plugins/ralph/runs/wake-hook-test-2026-02-03.json @@ -0,0 +1,56 @@ +{ + "extends": "generic-ralph-loop.json", + "run": { + "git": { + "base_branch": "main", + "working_branch": "feature/wake-hook-test" + }, + "execution": { + "max_iterations": 10, + "log_dir": "logs/ralph" + } + }, + "epic": { + "id": "devagent-wake-hook-test", + "title": "Wake Hook E2E Test", + "description": "Minimal loop to validate that Ralph iteration/completion hooks correctly wake the main Clawdbot agent via /hooks/wake." + }, + "tasks": [ + { + "id": "1", + "title": "Create test marker file", + "description": "Create a file at .devagent/workspace/tests/wake-hook-test/marker.txt with the content: 'Wake hook test - task 1 complete'. This validates that the on-iteration hook fires after a simple file creation task.", + "role": "engineering", + "acceptance_criteria": [ + "File exists at .devagent/workspace/tests/wake-hook-test/marker.txt", + "File contains the expected text" + ], + "dependencies": [], + "labels": ["test"] + }, + { + "id": "2", + "title": "Create verification script", + "description": "Create a script at .devagent/workspace/tests/wake-hook-test/verify.sh that reads marker.txt and exits 0 if it contains the expected text, 1 otherwise. Make it executable.", + "role": "engineering", + "acceptance_criteria": [ + "Script exists and is executable", + "Running it returns exit code 0" + ], + "dependencies": ["1"], + "labels": ["test"] + }, + { + "id": "3", + "title": "Run verification and document results", + "description": "Run the verify.sh script and create a summary file at .devagent/workspace/tests/wake-hook-test/results.md documenting that all tasks passed. This is the final task — the on-complete hook should fire after this.", + "role": "engineering", + "acceptance_criteria": [ + "verify.sh exits 0", + "results.md exists with pass summary" + ], + "dependencies": ["2"], + "labels": ["test"] + } + ] +} diff --git a/.devagent/plugins/ralph/tools/config.json b/.devagent/plugins/ralph/tools/config.json index f655cdb2..eff7f083 100644 --- a/.devagent/plugins/ralph/tools/config.json +++ b/.devagent/plugins/ralph/tools/config.json @@ -15,7 +15,7 @@ "beads_payload": ".devagent/plugins/ralph/output/beads-payload.json", "git": { "base_branch": "main", - "working_branch": "feat/multi-project-support" + "working_branch": "feature/wake-hook-test" }, "roles": { "engineering": "Code Wizard", @@ -34,7 +34,7 @@ }, "execution": { "require_confirmation": false, - "max_iterations": 25 + "max_iterations": 10 }, "agents": { "engineering": "engineering-agent.json", @@ -42,4 +42,4 @@ "design": "design-agent.json", "project-manager": "project-manager-agent.json" } -} +} \ No newline at end of file diff --git a/.devagent/plugins/ralph/tools/verify-on-iteration-e2e.sh b/.devagent/plugins/ralph/tools/verify-on-iteration-e2e.sh new file mode 100755 index 00000000..c79ddc54 --- /dev/null +++ b/.devagent/plugins/ralph/tools/verify-on-iteration-e2e.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# E2E verification for --on-iteration: run ralph with the test hook and verify the output file. +# Requires: repo root, epic devagent-iteration-hooks exists, branch feature/ralph-iteration-hooks, +# at least one ready task for the hook to be called. +# Usage: from repo root: .devagent/plugins/ralph/tools/verify-on-iteration-e2e.sh + +set -e +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../../.." && pwd)" +cd "$REPO_ROOT" + +OUT_FILE="$(mktemp)" +trap 'rm -f "$OUT_FILE"' EXIT + +SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")" +RUN_FILE="${SCRIPT_DIR}/../runs/ralph-iteration-hooks-2026-01-31.json" +HOOK_SCRIPT="${SCRIPT_DIR}/test-on-iteration-hook.sh" + +if [ ! -f "$RUN_FILE" ]; then + echo "Error: Run file not found at $RUN_FILE" >&2 + exit 1 +fi +if [ ! -x "$HOOK_SCRIPT" ]; then + echo "Error: Hook script not executable at $HOOK_SCRIPT" >&2 + exit 1 +fi + +export OUT_FILE +export RALPH_MAX_ITERATIONS=1 + +echo "Running ralph with --on-iteration (max_iterations=1)..." +"${SCRIPT_DIR}/ralph.sh" --run "$RUN_FILE" --on-iteration "$HOOK_SCRIPT" || true + +# Ralph may exit non-zero (e.g. no ready tasks, or agent failure); we only care that the hook was called +if [ ! -s "$OUT_FILE" ]; then + echo "Error: Hook output file is empty or missing. Ensure epic has at least one ready task." >&2 + exit 1 +fi + +EXPECTED_KEYS='epicId,iteration,maxIterations,taskId,taskTitle,taskStatus,tasksCompleted,tasksRemaining,iterationDurationSec' +while IFS= read -r line; do + [ -z "$line" ] && continue + for key in epicId iteration maxIterations taskId taskTitle taskStatus tasksCompleted tasksRemaining iterationDurationSec; do + if ! echo "$line" | jq -e ".$key" >/dev/null 2>&1; then + echo "Error: Payload missing key '$key': $line" >&2 + exit 1 + fi + done +done < "$OUT_FILE" + +echo "OK: Hook was called; payload(s) contain all expected fields ($EXPECTED_KEYS)." diff --git a/.devagent/plugins/ralph/tools/vitest.config.ts b/.devagent/plugins/ralph/tools/vitest.config.ts new file mode 100644 index 00000000..b3d260e8 --- /dev/null +++ b/.devagent/plugins/ralph/tools/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + globals: true, + environment: 'node', + include: ['**/*.test.ts'], + exclude: ['**/node_modules/**'], + }, +}); diff --git a/.devagent/workspace/reviews/2026-02-03_devagent-mobile-epic-activity-2026-02-03-improvements.md b/.devagent/workspace/reviews/2026-02-03_devagent-mobile-epic-activity-2026-02-03-improvements.md new file mode 100644 index 00000000..04a3a3fb --- /dev/null +++ b/.devagent/workspace/reviews/2026-02-03_devagent-mobile-epic-activity-2026-02-03-improvements.md @@ -0,0 +1,104 @@ +# Epic Revise Report — Mobile Epic Activity View + +**Date:** 2026-02-03 +**Epic ID:** devagent-mobile-epic-activity-2026-02-03 +**Status:** closed +**Branch:** codex/2026-02-03-mobile-epic-activity-view + +--- + +## Executive Summary + +The Mobile Epic Activity View epic delivered a mobile-friendly epic detail surface in ralph-monitoring: aggregated activity feed (execution, comment, status), epic metadata (PR + repo links), Activity/Commits/PR cards, and epic-level log access. All 11 implementation, QA, design, and final-review tasks closed successfully. Quality gates (typecheck, lint, test) pass. Key learnings center on process: isolating typecheck for task-scoped validation, handling pre-existing gate failures via blocker tasks, documenting URLSearchParams/Request realm issues in Vitest, and keeping docs in sync with features. + +--- + +## Traceability Matrix + +| Task ID | Title | Status | Commit | +| :--- | :--- | :--- | :--- | +| devagent-mobile-epic-activity-2026-02-03.1 | Aggregate Epic Activity Data | closed | `cb53ab3e` - feat(ralph-monitoring): add epic activity feed (execution, comment, status) | +| devagent-mobile-epic-activity-2026-02-03.1-qa | QA: Aggregate Epic Activity Data | closed | `d6f8decd` - fix(ralph-monitoring): guard vitest init for typecheck | +| devagent-mobile-epic-activity-2026-02-03.2 | Surface Epic Metadata (PR + Repo Links) | closed | `82b013c0` - feat(ralph-monitoring): expose pr_url and repo URL in epic loader | +| devagent-mobile-epic-activity-2026-02-03.2-qa | QA: Epic Metadata (PR + Repo Links) | closed | (see task comments) | +| devagent-mobile-epic-activity-2026-02-03.3 | Add Mobile-Friendly Epic Activity UI | closed | `cbc16ee5` - feat(ralph-monitoring): add Activity, Commits, and PR cards to epic detail | +| devagent-mobile-epic-activity-2026-02-03.3-design | Design Review: Epic Activity UI | closed | (doc/design only) | +| devagent-mobile-epic-activity-2026-02-03.3-qa | QA: Epic Activity UI | closed | (see task comments) | +| devagent-mobile-epic-activity-2026-02-03.4 | Add Epic-Level Log Access | closed | `a695afb9` - feat(ralph-monitoring): add epic log panel for task logs | +| devagent-mobile-epic-activity-2026-02-03.4-qa | QA: Epic-Level Log Access | closed | `ca5499b5` - chore(qa): verify epic-level log access | +| devagent-mobile-epic-activity-2026-02-03.5 | Fix ralph-monitoring typecheck, lint, and failing tests | closed | `708632eb` - fix(ralph-monitoring): resolve typecheck, lint, and test gate failures | +| devagent-mobile-epic-activity-2026-02-03.final-review | Final Review & Documentation | closed | `65cbcc5c` - docs(ralph-monitoring): final review and documentation update | +| devagent-mobile-epic-activity-2026-02-03.close | Wrap up & Close Epic | closed | `48bada06` - chore: update lockfile | +| devagent-mobile-epic-activity-2026-02-03.setup-pr | Run Setup & PR Finalization | open → closed | N/A (prerequisites met) | +| devagent-mobile-epic-activity-2026-02-03.teardown-report | Generate Epic Revise Report | open → closed | This report | + +--- + +## Evidence & Screenshots + +- **Screenshot directory:** No dedicated screenshot directory was required for this epic; QA used component and route tests plus DOM assertions. +- **Evidence:** Implementation in `apps/ralph-monitoring/app/utils/epic-activity.server.ts`, `epic-metadata.server.ts`, `EpicActivity.tsx`, `EpicCommitList.tsx`, `EpicMetaCard.tsx`, `EpicLogPanel.tsx`; tests in `app/utils/__tests__/epic-activity.server.test.ts`, `EpicLogPanel.test.tsx`, `epics.$epicId.test.tsx`. + +--- + +## Improvement Recommendations + +### Process (Low–Medium) + +1. **Typecheck isolation (Low)** + - **Issue:** Repo typecheck fails in unrelated modules (Comments.tsx, settings.projects.tsx). Engineering could not run full typecheck as a gate for backend-only task .1. + - **Recommendation:** Fix or isolate typecheck (e.g. typecheck only under `app/db` and `app/utils`) or document that typecheck is not a required gate for backend-only changes until root cause is fixed. + - **Files/Rules:** apps/ralph-monitoring package.json, tsconfig, CI quality gates. + +2. **QA close when feature verified but project gates fail (Low)** + - **Issue:** QA cannot close when the feature under test is fully verified but project-wide gates fail in unrelated code. + - **Recommendation:** Allow QA to close with "Verified with scope: ; full project gates blocked by " when the implemented feature's tests pass and failures are outside the changed area; or run feature-scoped gates. + - **Files/Rules:** Ralph validation checklist, QA workflow. + +3. **Test setup files in typecheck (Low)** + - **Issue:** Full project typecheck can fail on test setup files (e.g. vitest.setup.ts) with strict TS options. + - **Recommendation:** Include test setup in typecheck scope and fix narrow type issues (optional chaining, conditional spread). + - **Files/Rules:** apps/ralph-monitoring/vitest.setup.ts, Ralph validation checklist. + +4. **URLSearchParams / Request realm in Vitest (Medium)** + - **Issue:** In Node (undici), `new Request(url, { body: urlSearchParams })` fails when urlSearchParams comes from a different realm (e.g. Vite bundle), with "Expected init.body to be an instance of URLSearchParams". + - **Recommendation:** Document in testing-best-practices or ralph-monitoring README: use vitest.setup.ts to patch/normalize URLSearchParams body to string; do not normalize FormData so route actions using request.formData() keep working. + - **Files/Rules:** apps/ralph-monitoring/vitest.setup.ts, ai-rules/testing-best-practices.md. + +5. **Documentation sync with features (Low)** + - **Issue:** Final review combined "final review" with "documentation update"; README and component-specs were updated in one batch at the end. + - **Recommendation:** Add a doc-update checkpoint after each feature task (or a single "docs: update README/component-specs" subtask) so docs stay in sync with code. + - **Files/Rules:** README.md, docs/component-specs.md; Ralph task-setup / final-review workflow. + +6. **Epic close vs setup-pr / teardown-report (Low)** + - **Issue:** Epic close task assumes setup-pr may be deferred when branch is already in use; teardown-report is blocked by .close. + - **Recommendation:** Clarify in setup-ralph-loop or epic templates whether setup-pr must be closed before "Wrap up & Close Epic" or can be closed as "prerequisites met". + - **Files/Rules:** Ralph epic lifecycle, task dependency ordering. + +### Tech Architecture / Testing (Low) + +7. **Radix Select in jsdom (Low)** + - **Issue:** Opening the dropdown (userEvent.click(combobox)) triggers hasPointerCapture errors; options live in a portal, so "switch task via select" was not asserted with real interaction. + - **Recommendation:** For components that only need "selector present + default value" verified, avoid testing full open/click-option in jsdom; rely on default-selection tests and QA for interaction. + - **Files/Rules:** EpicLogPanel.test.tsx. + +8. **Epic-level log QA scope (Low)** + - **Issue:** Epic-level log access QA relied on DOM assertions on epic detail URL; full task-switcher interaction was not exercised in browser. + - **Recommendation:** DOM assertions on epic detail URL as primary evidence; task-switcher behavior covered by EpicLogPanel unit tests; optional agent-browser click/select only if needed for regression. + - **Files/Rules:** .devagent/plugins/ralph/skills/agent-browser/SKILL.md, QA workflow for epic log panel. + +--- + +## Action Items + +| Priority | Action | +| :--- | :--- | +| Medium | Document Vitest URLSearchParams/Request realm workaround in testing-best-practices or ralph-monitoring README. | +| Low | Consider typecheck isolation or feature-scoped gates for backend-only tasks. | +| Low | Consider QA close semantics when feature is verified but project gates fail elsewhere. | +| Low | Add doc-update checkpoint after feature tasks in epic plans. | +| Low | Clarify epic lifecycle: setup-pr and teardown-report ordering relative to "Wrap up & Close Epic". | + +--- + +*Report generated by Project Manager Agent (Chaos Coordinator) for epic devagent-mobile-epic-activity-2026-02-03. Signed: Project Manager Agent — Chaos Coordinator* diff --git a/.devagent/workspace/reviews/2026-02-03_devagent-wake-hook-test-improvements.md b/.devagent/workspace/reviews/2026-02-03_devagent-wake-hook-test-improvements.md new file mode 100644 index 00000000..18cd257c --- /dev/null +++ b/.devagent/workspace/reviews/2026-02-03_devagent-wake-hook-test-improvements.md @@ -0,0 +1,58 @@ +# Epic Revise Report - Wake Hook E2E Test + +**Date:** 2026-02-03 +**Epic ID:** devagent-wake-hook-test +**Status:** open (report generated; epic to be closed after teardown task closes) + +## Executive Summary + +The Wake Hook E2E Test epic executed a minimal loop to validate that Ralph iteration/completion hooks correctly wake the main Clawdbot agent via `/hooks/wake`. Four implementation tasks completed successfully with three commits; all acceptance criteria were met. Revision learnings are limited to low-priority process improvements (marker-file verification and test-file mutation patterns). No quality gate failures or screenshots were recorded. The epic is ready for closure once the teardown report task is closed. + +## Traceability Matrix + +| Task ID | Title | Status | Commit | +| :--- | :--- | :--- | :--- | +| devagent-wake-hook-test.1 | Create test marker file | closed | `f283ec55` - chore(wake-hook): add marker file for on-iteration hook test [skip ci] | +| devagent-wake-hook-test.2 | Create verification script | closed | `fcc7a12c` - chore(wake-hook-test): add verify script for marker.txt (devagent-wake-hook-test.2) | +| devagent-wake-hook-test.3 | Run verification and document results | closed | `81446a13` - chore(wake-hook-test): add verification results summary (devagent-wake-hook-test.3) [skip ci] | +| devagent-wake-hook-test.teardown-report | Generate Epic Revise Report | in_progress | *Pending* (this report) | + +## Evidence & Screenshots + +- **Screenshot Directory**: N/A (no UI or browser verification in this epic) +- **Screenshots Captured**: 0 screenshots +- **Key Artifacts**: + - `.devagent/workspace/tests/wake-hook-test/marker.txt` — marker file for on-iteration hook + - `.devagent/workspace/tests/wake-hook-test/verify.sh` — verification script + - `.devagent/workspace/tests/wake-hook-test/results.md` — pass summary + +## Improvement Recommendations + +### Documentation + +No documentation-specific revision learnings were captured. + +### Process + +- [ ] **[Low]** Marker-file verification: Simple file-creation task had no repo quality gates (lint/typecheck/test); validation was manual file check only. For similar “marker file” tasks, consider a one-line script or bd/ralph step that asserts file existence and content so the loop has a repeatable verification command. **Source:** devagent-wake-hook-test.1 +- [ ] **[Low]** Test mutation of shared files: Test run temporarily overwrote marker.txt; restore was done manually. For future tests that mutate shared files, use a temp copy or subshell to avoid leaving repo dirty. In scripts that test “failure” paths, prefer redirecting to a temp file or using a copy (e.g. `marker.txt.test`) and cleaning up in a trap. **Files/Rules Affected:** `.devagent/workspace/tests/wake-hook-test/verify.sh` (note for future test patterns). **Source:** devagent-wake-hook-test.2 +- [ ] **[Low]** Task devagent-wake-hook-test.3 reported no revision learning (straightforward run-script-and-document task). + +### Rules & Standards + +No rules or standards revision learnings were captured. + +### Tech Architecture + +No tech architecture revision learnings were captured. + +## Action Items + +1. [ ] **[Low]** Add repeatable verification (script or bd/ralph step) for marker-file tasks to assert file existence and content — Process (devagent-wake-hook-test.1) +2. [ ] **[Low]** Document pattern for verify scripts: use temp copy or trap when testing failure paths to avoid mutating real files — Process (devagent-wake-hook-test.2) + +## Quality Gate Summary + +- No lint/typecheck/test commands were required for the marker/script/results tasks; verification was manual and script-based. +- All three implementation tasks closed with commits and revision learning comments. +- No quality gate failures were reported in task comments. diff --git a/.devagent/workspace/reviews/README.md b/.devagent/workspace/reviews/README.md index fcd5b885..cc13f838 100644 --- a/.devagent/workspace/reviews/README.md +++ b/.devagent/workspace/reviews/README.md @@ -65,6 +65,7 @@ Follow `.devagent/plugins/ralph/workflows/generate-revise-report.md` ``` **Recent Reports:** +- [2026-02-03_devagent-wake-hook-test-improvements.md](2026-02-03_devagent-wake-hook-test-improvements.md) - Wake Hook E2E Test - [2026-01-31_devagent-multi-project-support-improvements.md](2026-01-31_devagent-multi-project-support-improvements.md) - Multi-Project Support Epic - [2026-01-20_devagent-07a7-improvements.md](2026-01-20_devagent-07a7-improvements.md) - Audit Design System Improvements Plan - [2026-01-20_devagent-712c-improvements.md](2026-01-20_devagent-712c-improvements.md) - Ralph E2E Run 2026-01-20 — Memory Match Arcade diff --git a/.devagent/workspace/tasks/active/2026-01-30_loop-completion-hooks/AGENTS.md b/.devagent/workspace/tasks/active/2026-01-30_loop-completion-hooks/AGENTS.md new file mode 100644 index 00000000..65dc7747 --- /dev/null +++ b/.devagent/workspace/tasks/active/2026-01-30_loop-completion-hooks/AGENTS.md @@ -0,0 +1,99 @@ +# Loop Completion Hooks Progress Tracker + +- Owner: Jake Ruesink +- Last Updated: 2026-01-30 +- Status: Active +- Task Hub: `.devagent/workspace/tasks/active/2026-01-30_loop-completion-hooks/` + +## Summary + +Implement **completion triggers/hooks** for Ralph loops so users (or orchestrating scripts) can reliably react when a loop finishes, fails, or gets blocked. + +### Problem Statement + +Currently, when a Ralph loop runs (via `delegate-agent.ts` or similar orchestration), there's no reliable way to get notified when it completes. This forces upstream systems (like Clawdbot) to rely on polling/heartbeats to detect loop status changes—a blunt and expensive approach. + +We need a **push-based mechanism** where the loop execution script can invoke a configurable callback on exit, passing structured data about the loop outcome. + +### Proposed Approach + +When the Ralph loop exits (success, failure, or blocked), the orchestration script invokes a configurable callback with structured data: + +```json +{ + "loopId": "uuid", + "title": "MI-1234: Add payment validation", + "repo": "~/projects/medusa-app", + "status": "completed | blocked | failed", + "iterations": 4, + "summary": "Implemented validation, added tests, PR ready", + "branch": "feature/payment-validation", + "exitReason": "All acceptance criteria met", + "durationSec": 342 +} +``` + +### Configuration Options + +1. **Shell script hook**: `--on-complete ./my-hook.sh` — receives JSON on stdin +2. **URL webhook**: `--webhook-url https://...` — POSTs the payload +3. **Built-in Clawdbot wake**: `--notify-clawdbot` — calls `cron wake` with the summary + +### Implementation Sketch + +Modify `scripts/delegate-agent.ts` (in `~/clawd`) to accept `--on-complete `: +- Capture loop outcome + metadata during execution +- On exit, serialize payload → invoke the hook +- Built-in default: if running under Clawdbot, auto-wake the session + +## Agent Update Instructions +- Always update "Last Updated" to today's date (ISO: YYYY-MM-DD) when editing this file. **Get the current date by explicitly running `date +%Y-%m-%d` first, then use the output for the "Last Updated" field.** +- Progress Log: Append a new entry at the end in the form `- [YYYY-MM-DD] Event: concise update, links to files`. Do not rewrite or delete prior entries. +- Implementation Checklist: Mark items as `[x]` when complete, `[~]` for partial with a short note. Add new items if discovered; avoid removing items—strike through only when obsolete. +- Key Decisions: Record important decisions as `- [YYYY-MM-DD] Decision: rationale, links`. +- References: Keep links current to latest spec, research, and tasks. Add additional references as they are created. +- Scope: Edits here should reflect coordination/progress only; do not include application code changes. Preserve history. + +## Key Decisions +- [2026-01-30] Decision: Start with shell script hook (`--on-complete`) as the primary mechanism; webhook and Clawdbot-native options can follow as extensions. +- [2026-01-30] Decision: Invoke hook synchronously with a 30s timeout (per research); hook exit code does not override process exit code. + +## Progress Log +- [2026-01-30] Initiated: Task hub created from voice discussion about reliable status updates when loops complete. Core payload shape and configuration options defined. +- [2026-01-30] Event: Completed devagent research — patterns for completion hooks, two boundaries (delegate run vs Ralph loop), payload availability, sync-with-timeout recommendation. Research: `research/2026-01-30_completion-hooks-and-callbacks-research.md`. +- [2026-01-30] Event: Completed devagent create-plan — implementation plan with Phase 1 (delegate-agent.ts minimal payload) and Phase 2 (Ralph loop rich payload). Plan: `plan/2026-01-30_loop-completion-hooks-plan.md`. +- [2026-01-30] Event: Completed devagent research — CLI completion hook patterns and delegate-agent.ts integration context. Research: `research/2026-01-30_delegate-agent-completion-hook-context.md`. Plan updated with insertion point, payload build, and optional lib.ts helper; references new research in Task 1 and Implementation Guidance. + +## Implementation Checklist +- [ ] Add `--on-complete