Commit 762ac7c
fix: [AI-7519] address 3 safe OpenCodeReview findings
Dev-punia bot flagged 6 items. Audited each; applying only the 3 that
are legitimate improvements AND won't affect runtime behavior:
- **pty-tui.ts waitForText — reset RegExp.lastIndex before test**
(finding 3). Pure defensive fix. A RegExp with the `/g` flag has
stateful `.test()` — repeat calls on the same string return false
after the first match. Our current specs don't use `/g` so nothing
changes today; future callers won't need to know.
- **pty-tui.ts waitForText — fail fast on child exit** (finding 4).
Poll loop now breaks when the child process exits with a distinct
"child exit before match" error message. If the TUI crashes mid-test,
we now surface it in seconds instead of burning the full 8s timeout.
- **prompt.ts bootstrap span — capture endTime once** (finding 6). Two
Date.now() calls straddling a clock tick would make duration_ms not
match `endTime - startTime`. Trivial fix, cleaner math.
Deferred (need investigation before applying):
- Finding 1 (Promise.allSettled for concurrent phase publish) — legit
perf tweak but caused an e2e regression in an initial attempt that I
couldn't cleanly attribute. Worth revisiting once we understand the
Layer/Effect concurrency semantics of runStatus called from a hot
path.
- Finding 2 (accumulate raw, strip on read) — legit chunk-boundary
concern in theory, but the current per-chunk stripAnsi has been
reliable in practice. Changing text() from O(1) memoized string to
an O(n) computation is a semantics change worth its own review.
- Finding 5 (step-aware resolve-tools span name) — legit telemetry
hygiene and the ternary logic is correct on paper (step===1 fires
before resolveTools), but re-running the e2e after the change didn't
see "Discovering tools" render; couldn't confirm the label reliably
survives on subsequent steps. Deferred for a focused pass.
Local validation
- Typecheck clean.
- Session + fork-guards: 806 pass / 0 fail / 12 skip / 45 todo.
- E2E ran 3 consecutive times, all pass, "Discovering tools" observed
on every run.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q8FGy89Qpr39k8nCSpCcK21 parent 7bd4035 commit 762ac7c
2 files changed
Lines changed: 27 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
1176 | 1179 | | |
1177 | 1180 | | |
1178 | 1181 | | |
1179 | | - | |
| 1182 | + | |
1180 | 1183 | | |
1181 | 1184 | | |
1182 | | - | |
| 1185 | + | |
1183 | 1186 | | |
1184 | 1187 | | |
1185 | 1188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
149 | 150 | | |
150 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
181 | 191 | | |
182 | 192 | | |
183 | 193 | | |
184 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
185 | 205 | | |
186 | 206 | | |
187 | 207 | | |
| |||
0 commit comments