# OpenHands Integration - Next Steps ## Status Summary ✅ **Completed:** - Tested both API and CLI approaches - Identified technical blockers (network namespace + TTY issues) - Created 3 n8n workflow configurations - Built Python wrapper scripts - Comprehensive documentation ⏳ **Ready for Testing:** - `/home/bam/openhands-pty.py` - Pseudo-TTY wrapper (needs verification) - `/home/bam/claude/mvp-factory/openhands-n8n-workflow.json` - Complete workflow ## Immediate Actions Required ### 1. Test the pty-based wrapper (CRITICAL) ```bash # Run this manually to verify it works: python3 /home/bam/openhands-pty.py "Create a file named final-test.txt with content: Success!" # Check if file was created: ls -la /home/bam/final-test.txt cat /home/bam/final-test.txt ``` ### 2. If wrapper works, proceed with n8n integration ```bash # The workflow file to use: /home/bam/claude/mvp-factory/openhands-n8n-workflow.json # Import via n8n UI: # 1. Open https://n8n.oky.sh # 2. Credentials → Add SSH credentials (ai-dev-localhost) # 3. Import from file → Select openhands-n8n-workflow.json # 4. Activate workflow ``` ### 3. Test webhook endpoint ```bash # Test manually: curl -X POST https://n8n.oky.sh/webhook/openhands-task \ -H "Content-Type: application/json" \ -d '{ "repository": {"full_name": "test/repo"}, "commits": [{"message": "Test build task"}] }' ``` ## Files Reference **Python Wrappers:** - `/home/bam/run-openhands.py` - Original wrapper (may have TTY issues) - `/home/bam/openhands-pty.py` - **BEST CANDIDATE** (uses pseudo-TTY) **n8n Workflows:** - `/home/bam/claude/mvp-factory/openhands-n8n-workflow.json` - **USE THIS** (complete workflow) - `/home/bam/claude/mvp-factory/openhands-cli-tmux-workflow.json` - Alternative with tmux **Documentation:** - `/home/bam/claude/mvp-factory/OPENHANDS_INTEGRATION_STATUS.md` - Full status report - `/home/bam/claude/mvp-factory/NEXT_STEPS.md` - This file ## If pty wrapper doesn't work: **Option A: Debug and improve** - Check logs from pty wrapper run - Adjust timing in openhands-pty.py - Try pexpect library if available **Option B: Use tmux approach** - Update n8n workflow to use tmux commands - More reliable for long-running tasks **Option C: API approach with fixed runtime** - Debug network namespace issue - Requires Docker networking expertise - May take significant time ## Decision Matrix | Approach | Reliability | Complexity | Time to Implement | |----------|------------|------------|------------------| | pty wrapper | Medium | Low | Immediate | | tmux in n8n | High | Medium | 1-2 hours | | Fixed API | High | High | Unknown | | Manual CLI | N/A | High | Not viable | ## Gitea Webhook Configuration Once n8n workflow works: ``` URL: https://n8n.oky.sh/webhook/openhands-task Method: POST Content-Type: application/json Secret: [generate random string] Events: Push events ``` Test by pushing to any repository: ```bash echo "Test" > test.txt git add . && git commit -m "Test webhook" && git push ``` ## Success Criteria - [ ] Python wrapper creates file successfully - [ ] n8n workflow imports without errors - [ ] Webhook triggers workflow - [ ] OpenHands executes task - [ ] File is created and verified - [ ] End-to-end test passes ## Contact/Support See `/home/bam/claude/mvp-factory/OPENHANDS_INTEGRATION_STATUS.md` for: - Detailed error analysis - Technical root causes - Alternative solutions - Complete testing procedures --- **Last Updated:** 2025-11-30 22:07 **Ready for:** User testing and validation