Repository navigation
Commit 2d9c3b0
fix(server): worktree cleanup no longer runs sweeps back to back
Every thread.deleted and provider-session.updated event queued another
full sweep, and the worker never merged them. Each eligible worktree also
re-read the full active and archived thread snapshot under its lease,
before and after measuring its size, so one sweep cost up to 2 + 4N
snapshot reads for N eligible worktrees.
- At most one automatic sweep waits at a time. The hourly schedule,
settings changes and domain events all request it; later requests join
it. Each manual run still gets its own sweep and report.
- Request a sweep only for session updates that reach "stopped" or
"error". Moves between live statuses cannot free a worktree.
- The under-lease recheck reads the project list, the threads that use
this path (new ProjectionStore.getThreadWorktreePaths), this thread's
shell and the live sessions. The snapshot is read once per sweep, and
recheck skips report the same reasons as before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent b9afba5 commit 2d9c3b0
6 files changed
Lines changed: 571 additions & 24 deletions
File tree
- apps/server/src
- orchestration-v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
330 | 395 | | |
331 | 396 | | |
332 | 397 | | |
| |||
553 | 618 | | |
554 | 619 | | |
555 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
556 | 625 | | |
557 | 626 | | |
558 | 627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
417 | 426 | | |
418 | 427 | | |
419 | 428 | | |
| |||
5610 | 5619 | | |
5611 | 5620 | | |
5612 | 5621 | | |
| 5622 | + | |
| 5623 | + | |
| 5624 | + | |
| 5625 | + | |
| 5626 | + | |
| 5627 | + | |
| 5628 | + | |
| 5629 | + | |
| 5630 | + | |
| 5631 | + | |
| 5632 | + | |
| 5633 | + | |
| 5634 | + | |
| 5635 | + | |
| 5636 | + | |
5613 | 5637 | | |
5614 | 5638 | | |
5615 | 5639 | | |
| |||
5946 | 5970 | | |
5947 | 5971 | | |
5948 | 5972 | | |
| 5973 | + | |
5949 | 5974 | | |
5950 | 5975 | | |
5951 | 5976 | | |
| |||
6094 | 6119 | | |
6095 | 6120 | | |
6096 | 6121 | | |
| 6122 | + | |
| 6123 | + | |
| 6124 | + | |
| 6125 | + | |
| 6126 | + | |
| 6127 | + | |
| 6128 | + | |
| 6129 | + | |
| 6130 | + | |
| 6131 | + | |
6097 | 6132 | | |
6098 | 6133 | | |
6099 | 6134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| |||
0 commit comments