Commit 66a959d
fix(agent): address RDM message handling review feedback (#1647)
Addresses review comments on PR for RDM message handling and pipe
passthrough logic.
## Safety & Correctness
- **Integer overflow**: Use `saturating_mul` for timeout_ms calculation
(prevents overflow when timeout_secs is large)
- **Race condition**: Replace check-then-set pattern with
`compare_exchange` in `process_app_start` to atomically transition
Disconnected→Connecting
- **State recovery**: Reset `connection_state` to Disconnected when
`process_app_start_impl` fails, allowing retry
- **Channel closure**: Explicitly handle `None` from `dvc_rx.recv()` to
avoid busy loop when channel closes
- **Path comparison**: Use `eq_ignore_ascii_case` for RDM process
detection (Windows paths are case-insensitive)
## Code Quality
- **Error visibility**: Log errors when READY notification fails instead
of silent `let _ =`
- **Documentation**: Clarify capabilities negotiation semantics
(negotiated subset vs. downgraded)
- **Magic numbers**: Document 0x700 offset in RDM MSI version encoding
(empirically derived)
- **Dead code**: Remove unused environment block creation and HashMap
import
## Example: Race Condition Fix
```rust
// Before: Non-atomic check-then-set allows duplicate spawns
match current_state {
Disconnected => {
self.connection_state.store(Connecting, Ordering::Release);
}
}
// After: Atomic transition prevents race
loop {
match current_state {
Disconnected => {
match self.connection_state.compare_exchange(
Disconnected, Connecting, Ordering::AcqRel, Ordering::Acquire
) {
Ok(_) => break, // Won the race
Err(actual) => current_state = actual; continue, // Retry
}
}
}
}
```
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vnikonov-devolutions <246051166+vnikonov-devolutions@users.noreply.github.com>1 parent 3146dc4 commit 66a959d
3 files changed
+73
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
92 | | - | |
| 91 | + | |
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
| |||
207 | 206 | | |
208 | 207 | | |
209 | 208 | | |
210 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| |||
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
312 | 321 | | |
313 | 322 | | |
314 | 323 | | |
| |||
420 | 429 | | |
421 | 430 | | |
422 | 431 | | |
423 | | - | |
| 432 | + | |
424 | 433 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
442 | 476 | | |
443 | 477 | | |
444 | 478 | | |
| |||
451 | 485 | | |
452 | 486 | | |
453 | 487 | | |
454 | | - | |
| 488 | + | |
455 | 489 | | |
456 | 490 | | |
| 491 | + | |
| 492 | + | |
457 | 493 | | |
458 | 494 | | |
459 | 495 | | |
| |||
587 | 623 | | |
588 | 624 | | |
589 | 625 | | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | 626 | | |
606 | 627 | | |
607 | 628 | | |
| |||
693 | 714 | | |
694 | 715 | | |
695 | 716 | | |
696 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
697 | 721 | | |
698 | 722 | | |
699 | 723 | | |
| |||
0 commit comments