Commit 9144be8
committed
fix!: file-reference prompt for oversized pastes (1-hour hang fix) (v0.4.10)
User repro'd a 1-hour silent hang on the phase 1 review stage:
\`(1484s, idle 1478s) phase 1 first review: reviewer running …\` —
6 seconds of activity at spawn, then ZERO PTY bytes for 24+ minutes
until they Ctrl+C'd.
Root cause: the composite multi-dimension review prompt is ~5× a
normal iteration prompt (5 dimensions × full review_template ×
substituted agent_template body) — easily 30–50 KB. drive_agent
pasted it through bracketed-paste in a single write. claude's REPL
input handler either silently truncates / rejects / freezes on a
30 KB+ paste; the PTY then goes completely silent because claude
isn't processing any input.
Fix: drive_agent's protocol preamble now switches to file-reference
mode when the task prompt is >8 KiB (INLINE_PASTE_SOFT_CAP). The
agent gets a tiny (<1 KB) instruction pasted into the PTY:
RALPHTERM PROTOCOL …
1. Read your task instructions from this file:
/workspace/.ralphterm/iteration-output/<nonce>.prompt.txt
2. Perform the task it describes.
3. Write your response to /workspace/.ralphterm/iteration-output/<nonce>.md
between <<<BEGIN>>> and <<<END>>> markers.
The agent reads the prompt via its own Read tool — one short request
that fits any PTY buffer. We already wrote the full inline-form
prompt to .ralphterm/iteration-output/<nonce>.prompt.txt for the
fixtures' RALPHTERM_PROMPT_FILE env-var path, so the file is
guaranteed to be there.
Small prompts (implementer iterations, ~5–8 KB) keep the old
inline-paste path: no extra tool call, no behaviour change.
Tests:
- build_prompt_includes_path_and_task_text retained, updated for
the new 4-arg signature.
- NEW build_prompt_uses_file_reference_for_large_prompts asserts:
* pasted form < 1 KB
* contains the prompt_path
* does NOT contain the huge task body
* contains the output_path
build_inline_prompt_with_protocol extracted as a sibling helper
because both the always-written-to-disk path and the small-prompt
inline path use the same body.1 parent 2ccfe69 commit 9144be8
3 files changed
Lines changed: 82 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
126 | 130 | | |
| 131 | + | |
127 | 132 | | |
128 | 133 | | |
129 | 134 | | |
| |||
453 | 458 | | |
454 | 459 | | |
455 | 460 | | |
456 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
457 | 470 | | |
458 | 471 | | |
459 | 472 | | |
| |||
470 | 483 | | |
471 | 484 | | |
472 | 485 | | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
473 | 520 | | |
474 | 521 | | |
475 | 522 | | |
| |||
604 | 651 | | |
605 | 652 | | |
606 | 653 | | |
607 | | - | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
608 | 660 | | |
609 | 661 | | |
610 | 662 | | |
| |||
613 | 665 | | |
614 | 666 | | |
615 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
616 | 692 | | |
617 | 693 | | |
618 | 694 | | |
| |||
0 commit comments