fix: ralph wizard agent files not found + JSON parse errors #5
+200
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problems Fixed
1. Agent files not found for linked cases
When clicking on agent windows in the Ralph Loop wizard, users see "File not found" and "No result file found" errors for all agents.
Root cause: The ralph-wizard file endpoints only looked in
~/claudeman-cases/{name}, ignoring linked cases (external folders linked via "Link Existing").Fix: All three endpoints now check linked cases first:
/api/generate-plan-detailed(for saving files)/api/cases/:caseName/ralph-wizard/files/api/cases/:caseName/ralph-wizard/file/:filePath2. Execution optimizer agentType mismatch
SSE events were sent with
agentType: 'execution'but files were saved to folderexecution-optimizer/.Fix: Consistent naming - SSE events now use
'execution-optimizer', frontend updated to match.3. JSON parse "Bad control character" errors
Root cause: The
tryParseJSONhelper only escaped\n,\r,\tbut Claude's responses can contain other control characters.Fix: Enhanced
tryParseJSONto escape ALL control characters (0x00-0x1F) using proper JSON escaping.4. Prompts not visible while agents are running
Clicking on a running agent showed "File not found" because prompts were only saved on completion.
Fix: Prompts are now saved immediately when each agent starts, not when it completes. This allows viewing prompts while agents are still running.
Files Changed
src/plan-orchestrator.ts- agentType fix, JSON repair, save prompts on startsrc/web/server.ts- linked cases support for ralph-wizard endpointssrc/web/public/app.js- frontend typeLabels/typeIcons updateTesting
🤖 Generated with Claude Code