Commit 0950630
committed
Mcp(fix[pane]): Stop reporting tmux failures as success
Two defects on the same seam: an operation failed and the server told
the agent something that was not true.
`send_keys` dropped any payload starting with `-` and returned
`Keys sent to pane %N`. tmux read the payload as flags and rejected the
command; `Pane.send_keys` builds the argv with no `--` separator and
discards tmux's result, and the wrapper returned a hardcoded success
string. Reachable with ordinary input — `--help` typed into a REPL, a
negative number, a pasted diff line. The argv now ends flag parsing
with `--` and a failed send raises with tmux's own stderr. All three
call sites built argv separately and shared none of it; they now share
one builder, which also fixes the timed batch path (it surfaced the
error but still failed to deliver).
`wait_for_text` crashed with `ValueError: invalid literal for int() with
base 10: ''` when its pane died mid-wait. tmux expands every field of a
vanished pane to the empty string and three `int()` calls on the poll
path took it raw — the same degrade-don't-fail rule the comment three
lines above already states for `alternate_on`.
Fixing only the `int()` calls would have swapped the crash for a wrong
answer: `pane_dead` is itself blanked, so it reads back as `"0"` and
cannot report the death. A killed pane would then have failed the pid
comparison and been reported as *respawned*. A live pane always has a
`pane_pid`, so an empty one is the reliable gone signal, and the wait
now ends with `pane %N died`.
`_read_history_limit` had the same defect one call over — its guard
covered an empty list but not an empty string.
There were no tests for `_parse_pane_state` at all, which is why both
defects survived. The three history tests that asserted on
`Pane.send_keys` calls now observe the argv boundary, which is where
every path already goes.1 parent 517d0da commit 0950630
5 files changed
Lines changed: 263 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
11 | 44 | | |
12 | 45 | | |
13 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
53 | 136 | | |
54 | 137 | | |
55 | 138 | | |
| |||
67 | 150 | | |
68 | 151 | | |
69 | 152 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 153 | + | |
73 | 154 | | |
74 | 155 | | |
75 | 156 | | |
| |||
80 | 161 | | |
81 | 162 | | |
82 | 163 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
98 | 171 | | |
99 | 172 | | |
100 | 173 | | |
| |||
161 | 234 | | |
162 | 235 | | |
163 | 236 | | |
164 | | - | |
| 237 | + | |
| 238 | + | |
165 | 239 | | |
166 | 240 | | |
167 | | - | |
168 | 241 | | |
| 242 | + | |
169 | 243 | | |
170 | 244 | | |
171 | 245 | | |
| |||
266 | 340 | | |
267 | 341 | | |
268 | 342 | | |
269 | | - | |
| 343 | + | |
| 344 | + | |
270 | 345 | | |
271 | 346 | | |
272 | | - | |
273 | 347 | | |
| 348 | + | |
274 | 349 | | |
275 | 350 | | |
276 | 351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
| |||
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
76 | 94 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
80 | 98 | | |
81 | | - | |
| 99 | + | |
82 | 100 | | |
83 | 101 | | |
84 | 102 | | |
| |||
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
133 | | - | |
| 151 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
670 | | - | |
| 669 | + | |
| 670 | + | |
671 | 671 | | |
672 | | - | |
673 | | - | |
674 | 672 | | |
675 | 673 | | |
676 | | - | |
| 674 | + | |
677 | 675 | | |
678 | 676 | | |
679 | 677 | | |
| |||
684 | 682 | | |
685 | 683 | | |
686 | 684 | | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
695 | 688 | | |
696 | 689 | | |
697 | 690 | | |
698 | 691 | | |
| 692 | + | |
699 | 693 | | |
700 | 694 | | |
701 | 695 | | |
| |||
721 | 715 | | |
722 | 716 | | |
723 | 717 | | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
730 | 724 | | |
731 | 725 | | |
732 | 726 | | |
| |||
735 | 729 | | |
736 | 730 | | |
737 | 731 | | |
738 | | - | |
739 | | - | |
| 732 | + | |
| 733 | + | |
740 | 734 | | |
741 | | - | |
742 | | - | |
743 | 735 | | |
744 | 736 | | |
745 | | - | |
| 737 | + | |
746 | 738 | | |
747 | 739 | | |
748 | 740 | | |
| |||
753 | 745 | | |
754 | 746 | | |
755 | 747 | | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
764 | 751 | | |
765 | 752 | | |
766 | 753 | | |
767 | 754 | | |
| 755 | + | |
768 | 756 | | |
769 | 757 | | |
770 | 758 | | |
| |||
793 | 781 | | |
794 | 782 | | |
795 | 783 | | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
801 | 789 | | |
802 | 790 | | |
803 | 791 | | |
| |||
806 | 794 | | |
807 | 795 | | |
808 | 796 | | |
809 | | - | |
810 | | - | |
| 797 | + | |
| 798 | + | |
811 | 799 | | |
812 | 800 | | |
813 | 801 | | |
| |||
859 | 847 | | |
860 | 848 | | |
861 | 849 | | |
862 | | - | |
863 | | - | |
| 850 | + | |
| 851 | + | |
864 | 852 | | |
865 | | - | |
| 853 | + | |
866 | 854 | | |
867 | 855 | | |
868 | 856 | | |
| |||
0 commit comments