Commit e8e42c7
fix(tui): pass workspace on yolo auto-approve and stop duplicate replies
Two defects introduced by the previous review round, found by CodeRabbit.
The workspace was never sent on the flush path. `set()` took an optional
workspace argument, but the app.tsx caller did not pass one, so replies from
flushPendingPermissions went out with `workspace: undefined` while the session
permission UI sends `project.workspace.current()` on every reply. Fixed at the
source instead of at the call site — sync already has the project context, and
threading the value through each caller is how it went missing in the first
place.
Replies could be sent twice for one request. flushPendingPermissions does not
remove requests from the store; removal waits for the server's
`permission.replied` event. Toggling yolo off and on again, or two set() calls,
therefore replied to an already-settled id. The server rejects the second reply
and autoApprove treated that rejection as a lost reply, putting a prompt back on
screen for a request that was already answered. Now guarded by an in-flight set
for concurrent duplicates plus optimistic removal on success for sequential
ones — the event handler's removal stays idempotent.
Adds a regression test for the double-enable path.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01964Prd1Sz5JwWZmNTrFdiU1 parent c5b7001 commit e8e42c7
2 files changed
Lines changed: 64 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
285 | 309 | | |
286 | 310 | | |
287 | 311 | | |
288 | 312 | | |
289 | 313 | | |
290 | 314 | | |
291 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
292 | 320 | | |
| 321 | + | |
| 322 | + | |
293 | 323 | | |
294 | 324 | | |
295 | | - | |
| 325 | + | |
296 | 326 | | |
297 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
298 | 333 | | |
299 | 334 | | |
300 | 335 | | |
301 | 336 | | |
302 | 337 | | |
303 | 338 | | |
304 | 339 | | |
| 340 | + | |
| 341 | + | |
305 | 342 | | |
306 | 343 | | |
307 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
223 | 249 | | |
224 | 250 | | |
225 | 251 | | |
| |||
0 commit comments