Skip to content

fix: ralph wizard agent files not found + JSON parse errors - #5

Closed
eYdr1en wants to merge 2 commits into
Ark0N:masterfrom
eYdr1en:fix/ralph-agent-file-paths
Closed

fix: ralph wizard agent files not found + JSON parse errors#5
eYdr1en wants to merge 2 commits into
Ark0N:masterfrom
eYdr1en:fix/ralph-agent-file-paths

Conversation

@eYdr1en

@eYdr1eneYdr1en commented Jan 29, 2026

Copy link
Copy Markdown

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/:filePath

2. Execution optimizer agentType mismatch

SSE events were sent with agentType: 'execution' but files were saved to folder execution-optimizer/.

Fix: Consistent naming - SSE events now use 'execution-optimizer', frontend updated to match.

3. JSON parse "Bad control character" errors

[PlanOrchestrator] Execution optimizer JSON parse failed: Bad control character in string literal

Root cause: The tryParseJSON helper only escaped \n, \r, \t but Claude's responses can contain other control characters.

Fix: Enhanced tryParseJSON to 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 start
  • src/web/server.ts - linked cases support for ralph-wizard endpoints
  • src/web/public/app.js - frontend typeLabels/typeIcons update

Testing

  • TypeScript compiles without errors
  • Tested with linked case - prompts visible while agents run
  • Results saved correctly on completion

🤖 Generated with Claude Code

Two bugs were causing "File not found" and "No result file found" errors
when clicking on agent windows in the Ralph Loop wizard:
1. **Linked cases not checked**: The ralph-wizard file endpoints only
looked in `~/claudeman-cases/{name}`, ignoring linked cases stored
in `~/.claudeman/linked-cases.json`. Now all three endpoints check
linked cases first:
- `/api/generate-plan-detailed` (for saving files)
- `/api/cases/:caseName/ralph-wizard/files`
- `/api/cases/:caseName/ralph-wizard/file/:filePath`
2. **Execution optimizer agentType mismatch**: SSE events were sent with
`agentType: 'execution'` but files were saved to folder
`execution-optimizer/`. Fixed to use consistent naming:
- SSE events now use `'execution-optimizer'`
- Frontend typeLabels/typeIcons updated to match
3. **JSON parse errors from control characters**: Enhanced tryParseJSON
to escape ALL control characters (0x00-0x1F), not just newlines.
This fixes "Bad control character in string literal" errors when
Claude's response contains backspace, form feed, or other control chars.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@eYdr1en
eYdr1enforce-pushed the fix/ralph-agent-file-paths branch from 503ca11 to bdf003fCompareJanuary 29, 2026 00:55
@eYdr1eneYdr1en changed the title fix: ralph wizard agent files not found for linked casesfix: ralph wizard agent files not found + JSON parse errorsJan 29, 2026
Previously, prompt.md files were only saved when agents completed.
This caused "File not found" errors when clicking on running agents
in the UI.
Now prompts are saved immediately when each agent starts:
- Research agent
- Analysis subagents (requirements, architecture, testing, risks)
- Verification agent
- Execution optimizer
- Final review agent
The result.json is still saved on completion as before.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Ark0N

Copy link
Copy Markdown
Owner

Fixed in 50b1718 — linked case resolution added to ralph-wizard endpoints, JSON repair for control characters.

@Ark0NArk0N closed this Feb 18, 2026
michael-ltm pushed a commit to michael-ltm/Codeman that referenced this pull request Jul 4, 2026
- Ark0N#2: drop the "本机"/"(本机)" special-case labels in the fleet device
panel, device <select>, and welcome device row — show the real device
name (local = os.hostname()). A remote viewer sees the true machine name.
- Ark0N#4: persist closed fleet tabs to localStorage (codeman:fleet-hidden-tabs)
so a close survives reloads; prune keys whose session is gone (bounded
set); add a reopen path — clicking a device-panel session row calls
openFleetSessionTab() to unhide + selectSession.
- Ark0N#5: submitFleetCreateSession now opens + selects the new session as a tab
(mirrors _quickStartRemote) and toasts "已在 <设备名> 创建并打开".
Local (non-fleet) session close/behavior is byte-identical: the persistent
hidden set is fleet-key-only (isFleetKey/_looksLikeFleetKey guards), and
requestCloseSession still routes local keys to the confirm modal untouched.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@eYdr1en@Ark0N