Commit c9f865d
authored
fix(batches): resolve batch ids beyond the 100-batch cap (#825)
## Summary
- Add `conductor.find_batch_by_prefix` (SQL `LIKE 'prefix%'`, no cap, escapes LIKE metachars) so `cf work batch status/stop/resume/follow` can resolve batches beyond the newest 100 — same fix class as #743/#824 for tasks.
- Replace the four `list_batches(limit=100)` + Python `startswith` resolution sites with the uncapped SQL lookup.
- Add `len(matching) > 1` → "Multiple batches match" + `typer.Exit(1)` ambiguity guard to all four commands (mutating `stop`/`resume` previously acted silently / warned-then-proceeded), matching the task-side pattern — closes the widened-collision-surface gap the cross-family review flagged.
- Regression tests: 6 core tests for `find_batch_by_prefix` + a parametrized `CliRunner` test proving each command rejects an ambiguous prefix.
## Validation
- Tests: All passing (10/10 locally + full CI green)
- Lint: Clean (ruff + mypy)
- Test mutation check: Passed — ambiguity test fails without the guard
- Internal review: Completed (advisory, Claude, 2 rounds)
- Cross-family review: opencode (zai/glm-5.2) — initial REQUEST_CHANGES (Critical on batch_stop) resolved; GLM CI re-review + Claude follow-up confirm no new defects
- Final feedback triage: cutoff 2026-07-20T18:48:39Z, all items triaged (2 non-blocking deferred with justification)
- Demo: All acceptance criteria verified with real-CLI outcome evidence on a 156-batch workspace
Closes #8251 parent d793672 commit c9f865d
3 files changed
Lines changed: 222 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4017 | 4017 | | |
4018 | 4018 | | |
4019 | 4019 | | |
4020 | | - | |
4021 | | - | |
4022 | | - | |
| 4020 | + | |
| 4021 | + | |
4023 | 4022 | | |
4024 | 4023 | | |
4025 | 4024 | | |
4026 | 4025 | | |
4027 | 4026 | | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
4028 | 4033 | | |
4029 | 4034 | | |
4030 | 4035 | | |
| |||
4162 | 4167 | | |
4163 | 4168 | | |
4164 | 4169 | | |
4165 | | - | |
4166 | | - | |
4167 | | - | |
| 4170 | + | |
| 4171 | + | |
4168 | 4172 | | |
4169 | 4173 | | |
4170 | 4174 | | |
4171 | 4175 | | |
4172 | 4176 | | |
| 4177 | + | |
| 4178 | + | |
| 4179 | + | |
| 4180 | + | |
| 4181 | + | |
| 4182 | + | |
4173 | 4183 | | |
4174 | 4184 | | |
4175 | 4185 | | |
| |||
4231 | 4241 | | |
4232 | 4242 | | |
4233 | 4243 | | |
4234 | | - | |
4235 | | - | |
4236 | | - | |
| 4244 | + | |
| 4245 | + | |
4237 | 4246 | | |
4238 | 4247 | | |
4239 | 4248 | | |
4240 | 4249 | | |
4241 | 4250 | | |
4242 | 4251 | | |
4243 | | - | |
| 4252 | + | |
4244 | 4253 | | |
4245 | | - | |
4246 | | - | |
| 4254 | + | |
| 4255 | + | |
4247 | 4256 | | |
4248 | 4257 | | |
4249 | 4258 | | |
| |||
4430 | 4439 | | |
4431 | 4440 | | |
4432 | 4441 | | |
4433 | | - | |
4434 | | - | |
4435 | | - | |
| 4442 | + | |
| 4443 | + | |
4436 | 4444 | | |
4437 | 4445 | | |
4438 | 4446 | | |
4439 | 4447 | | |
4440 | 4448 | | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
4441 | 4455 | | |
4442 | 4456 | | |
4443 | 4457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
830 | 872 | | |
831 | 873 | | |
832 | 874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 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 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 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 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
0 commit comments