mvp-factory-openhands/TEST_COMMANDS.md

249 lines
5.5 KiB
Markdown

# Test Commands for n8n Workflows
**Date:** 2025-12-03
**Purpose:** Test the active workflows and verify TODO.md creation
---
## Test New Workflow (ID: p6Gt8h23NrsWIk4R)
### Webhook URL
```
https://n8n.oky.sh/webhook/real-todo-mvp
```
### Test Command
```bash
curl -X POST https://n8n.oky.sh/webhook/real-todo-mvp \
-H "Content-Type: application/json" \
-d '{
"repository": {
"name": "test-project",
"full_name": "gitadmin/test-project",
"clone_url": "https://git.oky.sh/gitadmin/test-project.git"
},
"ref": "refs/heads/main",
"after": "abc123def456",
"head_commit": {
"message": "MVP Prompt: Create a simple todo app with React and Node.js"
},
"pusher": {
"name": "test-user"
}
}'
```
### Expected Response
```json
{
"action": "todos_created",
"task_count": 6,
"status": "SUCCESS",
"message": "Created 6 todos from MVP prompt",
"should_continue": true
}
```
### What to Check
1. **Webhook responds:** Should get JSON response immediately
2. **Check workspace:** `ls -la /home/bam/workspace/test-project/`
3. **Check TODO.md:** `find /home/bam -name "TODO.md" -mmin -5`
4. **n8n execution logs:** `docker logs n8n --tail 50`
---
## Test Old Workflow (ID: eZ5zoeglwRrL7lOf)
### Webhook URL
```
https://n8n.oky.sh/webhook/todo-mvp-builder
```
### Test Command
```bash
curl -X POST https://n8n.oky.sh/webhook/todo-mvp-builder \
-H "Content-Type: application/json" \
-d '{
"repository": {
"name": "test-project-old",
"full_name": "gitadmin/test-project-old",
"clone_url": "https://git.oky.sh/gitadmin/test-project-old.git"
},
"ref": "refs/heads/main",
"after": "xyz789",
"head_commit": {
"message": "MVP Prompt: Create a React todo app"
},
"pusher": {
"name": "test-user"
}
}'
```
### Expected Response
```json
{
"action": "sdk_call",
"status": "CREATING_TODOS"
}
```
**Note:** This workflow lacks SSH node - will likely fail at execution
---
## Direct OpenHands SDK Test
### Command
```bash
/tmp/software-agent-sdk/.venv/bin/python3 \
/home/bam/openhands-sdk-wrapper.py \
"Create a TODO.md with 5 tasks for building a todo app" \
--json
```
### Expected Output
```json
{
"success": true,
"task": "Create a TODO.md with 5 tasks...",
"workspace": "/home/bam",
"timestamp": "2025-12-03T...",
"error": null,
"files_created": ["TODO.md", ...],
"files_copied": [],
"log_output": [...]
}
```
### Check Created File
```bash
cat /home/bam/TODO.md
```
---
## Check n8n Logs
### Recent Logs
```bash
docker logs n8n --tail 100 2>&1 | grep -E "(real-todo-mvp|todo-mvp-builder)" | tail -20
```
### Full Workflow Execution
```bash
docker logs n8n --tail 200 2>&1 | grep -A5 -B5 "workflow"
```
### Search for Errors
```bash
docker logs n8n --tail 200 2>&1 | grep -i error
```
---
## Verify Workflow Status
### List Active Workflows
```bash
curl -s -H "X-N8N-API-KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5YWM2MTg5ZC1kOWZiLTQ1N2UtODkzZS0yN2I5YWYzZmE3MzgiLCJpc3MiOiJuOG4iLCJhdWQiOiJwdWJsaWMtYXBpIiwiaWF0IjoxNzY0NjIxMTc4LCJleHAiOjE3NjcxMzIwMDB9.urB8gThO3nbFoLfXmvDs3BI6Qydx9JrTkWc9xU8iJQE" \
"https://n8n.oky.sh/api/v1/workflows" | \
python3 -c "import sys, json; data=json.load(sys.stdin); [print(f\"ID: {w['id']}, Name: {w['name']}, Active: {w['active']}\") for w in data.get('data', [])]"
```
---
## Search for Created TODO.md
### Find All TODO.md Files
```bash
find /tmp -name "TODO.md" -type f 2>/dev/null
find /home/bam -name "TODO.md" -type f -mmin -60 2>/dev/null
```
### Check Workspace Directories
```bash
ls -la /home/bam/workspace/ 2>/dev/null || echo "No workspace directory"
find /home/bam/workspace -name "*.md" -mmin -60 2>/dev/null
```
---
## Test Shell Wrapper Directly
### Command
```bash
sh /home/bam/openhands-sdk-wrapper-sh.sh "Create a test file named test-output.txt with content: Testing wrapper"
```
### Check Output
```bash
cat /home/bam/openhands-task.log
cat /home/bam/openhands-full.log
```
---
## Cleanup Test Files
### Remove Test Directories
```bash
rm -rf /home/bam/workspace/test-project
rm -rf /home/bam/workspace/test-project-old
```
### Clear Logs
```bash
rm -f /home/bam/openhands-task.log
rm -f /home/bam/openhands-full.log
```
---
## Workflow Execution Flow
### Expected Sequence (New Workflow)
1. **Webhook receives push** → Extract repo info
2. **Get Next Todo** → Detects initial push
3. **Execute Todo** → Prepares SSH command
4. **SSH SDK Call** → Executes OpenHands
5. **Process SDK Result** → Parses output
6. **Format Response** → Creates response
7. **HTTP Response** → Returns to client
8. **Loop** → Back to step 2
### Success Indicators
- ✅ Webhook responds immediately
- ✅ n8n logs show workflow execution
- ✅ SSH node executes successfully
- ✅ TODO.md created in workspace
- ✅ OpenHands log files generated
### Failure Indicators
- ❌ Webhook timeout
- ❌ n8n errors in logs
- ❌ SSH authentication fails
- ❌ No TODO.md created
- ❌ Empty workspace directory
---
## Debugging Workflow
### Check Node Execution
1. Go to n8n UI: https://n8n.oky.sh
2. Open workflow
3. Click "Executions"
4. View latest execution
5. Check each node for errors
### Common Issues
- **Array return required:** Code nodes must return `[{}]` not `{}`
- **Node references:** Use `$node["Node Name"].json`
- **SSH credentials:** localhost-ssh must be configured
- **Webhook path:** Must match exactly between client and workflow
---
**Ready to test!** Run the commands above and check for TODO.md creation.