Commit d9b36fe
authored
fix(cli): surface cloud-exec stream failures instead of silent success (#804)
## What
Cloud `exec` streams stdout/stderr over a WebSocket. When that attach
fails
(e.g. a 401 on the upgrade), the client recovered the exit code via a
status
probe and reported a silent `exit 0` with no output — indistinguishable
from a
command that genuinely produced none.
## Changes
- `emit_or_fallback` now carries the disconnect cause in
`ExecResult.error_message`
(was `None`); it is only reached when the output stream failed.
- `StreamManager::start()` surfaces a non-empty `error_message` as an
error
(exit 1 + message) instead of dropping it.
- REST `401`/`403` mapping reads `unauthorized (HTTP 401)` / `forbidden
(HTTP 403)`
instead of a bare `auth: <body>`.
- Adds `debug!`/`trace!` to the previously-uninstrumented WS attach path
(connect, per-frame, stdout/stderr, exit-frame, status-probe fallback).
## Verification
- Real cloud `exec`: before = silent `exit 0`, empty; after = `exit 1` +
clear cause.
- Unit reproducer
`terminal::tests::stream_manager_surfaces_exec_error_message_as_error`
verified RED→GREEN.
- 4 WS attach unit tests still pass.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Distinguished error messages for authentication (HTTP 401) versus
authorization (HTTP 403) failures
* Improved error reporting when process execution streaming is
interrupted
* **Chores**
* Enhanced diagnostic logging for WebSocket connection handling
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 011e52a commit d9b36fe
3 files changed
Lines changed: 93 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
494 | 497 | | |
| 498 | + | |
495 | 499 | | |
496 | 500 | | |
497 | 501 | | |
| |||
631 | 635 | | |
632 | 636 | | |
633 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
634 | 651 | | |
635 | 652 | | |
636 | 653 | | |
637 | 654 | | |
638 | 655 | | |
639 | 656 | | |
| 657 | + | |
640 | 658 | | |
641 | 659 | | |
642 | 660 | | |
| 661 | + | |
643 | 662 | | |
644 | 663 | | |
645 | 664 | | |
| |||
650 | 669 | | |
651 | 670 | | |
652 | 671 | | |
| 672 | + | |
653 | 673 | | |
654 | 674 | | |
655 | 675 | | |
| |||
681 | 701 | | |
682 | 702 | | |
683 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
684 | 708 | | |
685 | 709 | | |
686 | 710 | | |
| |||
826 | 850 | | |
827 | 851 | | |
828 | 852 | | |
| 853 | + | |
829 | 854 | | |
830 | 855 | | |
831 | 856 | | |
| |||
834 | 859 | | |
835 | 860 | | |
836 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
837 | 869 | | |
838 | 870 | | |
839 | | - | |
| 871 | + | |
840 | 872 | | |
841 | 873 | | |
842 | 874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
235 | 244 | | |
236 | 245 | | |
237 | 246 | | |
| |||
460 | 469 | | |
461 | 470 | | |
462 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
463 | 514 | | |
0 commit comments