Repository navigation
Commit f4efe71
fix(runner): a file reaches the Pilot — a tool result keeps its lines and is capped per tool, not collapsed to 240 chars (#700)
`toolResult()` in `headless.ts` did two things to every engine `tool_result` before the
pane existed: collapsed `\s+` to a single space, and cut it to 240 characters. The
consequence is not that results were short — it is that the SHAPE of a result no longer
depended on the command that produced it. `cat`, `sed -n '1,50p'`, `cat -n | head -60` and
"print every character" all arrived identically sized, on one line, indentation gone.
So a Pilot that could not see a file had no move left. Live run `csess_6ce3627a`: twelve of
sixteen instructions were one file being asked for twelve ways, each a full BYOK Claude
decision round, and step 9292 concluded "the CLI is summarizing file contents rather than
showing raw output" — the correct reading of the evidence in front of it, and the wrong
diagnosis, because the evidence had been destroyed upstream. Measured across 20 sessions:
150 of 251 tool-result lines (59.8%) hit the cap, 43 of them `Read`.
WHAT CHANGED, and what each costs
- **Line structure survives.** `transcript-lines.ts` keeps newlines; every line after the
first carries ` │ `. This is the half that matters most and costs 4 characters a line:
`cat -n` output is unreadable space-joined at ANY length, so the collapse made the cap
worse than its size alone implies. The prefix also means a result can no longer FORGE the
framing — a file containing a line starting `⚙ ` would otherwise parse as a call the
engine never made.
- **The cap is per tool, deliberately not one raised number.** 1,500 characters over 60
lines for `Read`/`Bash`/`Grep`/`Glob`/`BashOutput`/`NotebookRead`; the historical 240 for
everything else, because an `Edit`'s "has been updated successfully" was never near the
cap and widening it would spend pane and buy nothing. An unknown tool takes the
conservative budget.
- **A cut states its own size** — `…[cut: 1,500 of 18,432 chars]` — so "ask for a slice
that fits" is a strategy rather than a guess.
WHAT IT COSTS THE PANE, stated rather than implied
A `terminal` row stores 8,000 characters and one Pilot decision reads 6,000, so every
character bought here is bought by evicting history. 1,500 is derived from that, not
picked: a quarter of the Pilot's window in content, and `RESULT_RENDERED_MAX` (~1,840) once
per-line framing and the disclosure are paid for — under a third of the window, so three
consecutive content results coexist with the `⚙`/`↳` framing and the narrative instead of
replacing them. Both figures are pinned as arithmetic in `transcript-lines.test.ts`; anyone
raising the cap has to argue with them.
TWO CONSEQUENCES ELSEWHERE, both fixed here because leaving either would make this a net loss
- `parseEngineToolCalls` read the arrow line only, so a 34-line result would have been
reported as its first line, and `outputCut` (which keyed on a trailing `…`) would have
read a cut result as a complete one — the #503 shape. It now reads ` │ ` continuations,
bounded by an `inResult` flag so a stranded tail whose arrow line fell outside the
8,000-char window is dropped rather than attributed to the wrong call.
- `FEED_TOOLCALL_BYTES` 12,000 → 24,000. That knee was measured against 240-char results;
at the new cap the same mean production row (12.05 calls) serialises to ~25,000 B, and a
call dropped by that cap is gone for good — no cursor reaches it. 24,000 is one of the two
numbers the original measurement showed behaviour-identical on that corpus.
THE PROMPT NOW STATES A MECHANISM, NOT A NUMBER
`coding-loop.ts` said "cut to ~240 characters on a single line" and "NO shell command can
show you the contents of a file". True of every runner then published, false of an upgraded
one — the same defect pointing the other way, and the cloud cannot tell which machine it is
talking to. It now names the SIGNAL a Pilot can read on either: a cut result says it was
cut and by how much; ask for a slice that fits ONCE; if the next result is cut at the same
size and shape, the cap is on the result and re-asking is the same request. The untruncated
reply channel is still named, because it works on every runner ever published.
VERIFIED END TO END, not at the unit boundary
`headless.test.ts` drives a REAL spawned stream-json engine returning the same
~4,000-character file two ways. The `Read` route now delivers 34 numbered lines as lines
(`marker001`…`marker030` present, `marker092` absent, the cut figures stated) against ~5
lines space-joined before, with the `⚙ Read` and ` ↳✓` framing intact. That harness is the
one this issue's earlier round used to disprove the pane-window attribution, and it is the
level the claim has to hold at.
SHIPPING: `packages/cli` 0.4.54 → 0.4.55. The runner half reaches a machine only through a
published CLI, and 0.4.54 is already on npm so CI's publish step has been skipping. This one
bump also carries #636 (a stopped application lands under Cancelled) and #641 (a handoff
whose page was closed is lost, not solved), both of which have been sitting on `main`
finished and unshipped for exactly that reason.
Not run: `pnpm test:e2e`. This change touches no `store/`, console or `agents/coder/web`
code, so nothing Playwright exercises is in the diff.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 9c3d45e commit f4efe71
11 files changed
Lines changed: 691 additions & 117 deletions
File tree
- packages
- browser-runner/src/coding
- cli
- workers/api/src/lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
597 | | - | |
598 | | - | |
599 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
600 | 601 | | |
601 | | - | |
602 | | - | |
603 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
604 | 606 | | |
605 | 607 | | |
606 | 608 | | |
| |||
615 | 617 | | |
616 | 618 | | |
617 | 619 | | |
618 | | - | |
| 620 | + | |
619 | 621 | | |
620 | 622 | | |
621 | 623 | | |
| |||
624 | 626 | | |
625 | 627 | | |
626 | 628 | | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
638 | 648 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
643 | 657 | | |
644 | 658 | | |
645 | 659 | | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
646 | 669 | | |
647 | 670 | | |
648 | 671 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
194 | 204 | | |
195 | 205 | | |
196 | 206 | | |
| |||
669 | 679 | | |
670 | 680 | | |
671 | 681 | | |
672 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
673 | 688 | | |
674 | 689 | | |
675 | 690 | | |
676 | 691 | | |
677 | 692 | | |
678 | 693 | | |
679 | 694 | | |
680 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
681 | 701 | | |
682 | 702 | | |
683 | 703 | | |
| |||
703 | 723 | | |
704 | 724 | | |
705 | 725 | | |
| 726 | + | |
706 | 727 | | |
707 | 728 | | |
708 | 729 | | |
709 | 730 | | |
710 | 731 | | |
711 | 732 | | |
712 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
713 | 736 | | |
714 | 737 | | |
715 | 738 | | |
| |||
735 | 758 | | |
736 | 759 | | |
737 | 760 | | |
738 | | - | |
739 | | - | |
| 761 | + | |
| 762 | + | |
740 | 763 | | |
741 | 764 | | |
742 | 765 | | |
| |||
889 | 912 | | |
890 | 913 | | |
891 | 914 | | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | 915 | | |
923 | 916 | | |
924 | 917 | | |
| |||
0 commit comments