Commit 2a83596
fix: prevent session restart loops from process lifecycle races (#379)
Four fixes for race conditions that could cause sessions to repeatedly
exit with SIGTERM (code 143) and burn through auto-restart attempts:
- Broaden pkill orphan cleanup to match both --resume and --session-id
flags, and replace unreliable \b with POSIX-safe (\s|$)
- Switch setProvider to stopClaudeAndWait instead of fire-and-forget
stopClaude with a 500ms delay
- Clear pending _restartTimer in setModel/setProvider/setPermissionMode
to prevent stale crash timers from spawning duplicate processes
- Wrap _isStarting flag in try/finally in sendInput to prevent permanent
session lockout if startClaude throws
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent cf04937 commit 2a83596
2 files changed
+28
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | | - | |
| 225 | + | |
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
1115 | | - | |
1116 | | - | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1117 | 1120 | | |
1118 | 1121 | | |
1119 | 1122 | | |
| |||
1203 | 1206 | | |
1204 | 1207 | | |
1205 | 1208 | | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1206 | 1212 | | |
1207 | 1213 | | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1212 | 1219 | | |
1213 | 1220 | | |
1214 | | - | |
| 1221 | + | |
1215 | 1222 | | |
1216 | 1223 | | |
1217 | 1224 | | |
| |||
1221 | 1228 | | |
1222 | 1229 | | |
1223 | 1230 | | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1224 | 1234 | | |
1225 | 1235 | | |
1226 | 1236 | | |
| |||
1242 | 1252 | | |
1243 | 1253 | | |
1244 | 1254 | | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
1245 | 1258 | | |
1246 | 1259 | | |
1247 | 1260 | | |
| |||
0 commit comments