Repository navigation
Commit 8026405
wp7: report the actual reason a proxy refused to stop (#4067)
* fix(cli): report the reason a proxy refused to stop
/api/stop answers 409 for two different reasons. The original one is a
scheduler wrapper under another CODEX_HOME that would respawn the proxy
anyway; #4023 added a second, the proxy being the installed launchd or systemd
job itself. stopProxy reported the first unconditionally, so an operator whose
proxy is simply the service was told "a service installed under a different
CODEX_HOME/OPENCODEX_HOME owns it. Run the stop from that home" and sent to a
home that does not exist.
The server already sends a precise message for each case. It is now carried
through to the thrown error, with the previous text kept as the fallback when
the body is unreadable.
Found by the main-to-dev regression review for the 2.49.0 promotion. It needs a
receipt-write failure plus a surviving managed proxy to reach, which is why
neither the #4023 review nor its CI caught it.
* test(xai): assert the 409 invariant without pinning the exact line
The source oracle matched `if (res.status === 409) return "refused"` verbatim,
so capturing the server's refusal reason first broke it even though the
invariant it protects — a 409 returns "refused" and never falls through to the
forced-kill path — still holds.
It now locates the 409 branch inside stopProxyGracefully and asserts the
ordering: "refused" is returned before the !res.ok fallthrough. Removing that
return still turns the test red, so the oracle is no weaker than before.
---------
Co-authored-by: t <[email protected]>1 parent 02bc10e commit 8026405
3 files changed
Lines changed: 79 additions & 6 deletions
File tree
- src/lib
- tests
- lib
- providers/xai
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
75 | 93 | | |
76 | 94 | | |
77 | 95 | | |
| |||
111 | 129 | | |
112 | 130 | | |
113 | 131 | | |
114 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
115 | 141 | | |
116 | 142 | | |
117 | 143 | | |
| |||
140 | 166 | | |
141 | 167 | | |
142 | 168 | | |
143 | | - | |
144 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
145 | 172 | | |
146 | 173 | | |
147 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
512 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
513 | 524 | | |
514 | 525 | | |
515 | 526 | | |
| |||
0 commit comments