Commit 28d1285
plan-06: turn 生命周期收敛 — 取消传播 + 后台任务收割 + 出站配额 (#503)
* feat(runtime): add current turn context to AppState
* feat(daemon): bound turn interaction waits behind TurnScope
* feat(runtime): owner-aware background task registry with real stop
* feat(runtime): owned, stoppable background agents and shells
* feat(daemon): single finish_turn path with scoped child harvest
Interaction-timeout smoke coverage shipped as the late-resolve-rejection
variant (daemon_rejects_resolve_after_turn_finished) plus the Task 2 TurnScope
unit tests, per the plan's fallback; the mock SSE stream was not extended to
emit AskUserQuestion tool_use.
* feat(runtime): per-turn outbound budget and turn-id origin stamping
* fix(desktop): remove double-layer resolver no-ops and silent frontend fallback
Rust corbina suite green (112 passed incl. REGISTERED_TAURI_COMMANDS meta-test).
Playwright E2E not run here (needs a built frontend + browsers); the change is
behavior-preserving for the fake-daemon tests, which already exercised the
error-propagation path since canInvokeTauri() is false in the browser context.
* refactor(runtime): drop redundant cancel and dead BackgroundTaskManager::stop
finish_turn shared the turn's CancelToken with its TurnScope, and
TurnScope::finish already flips the token for every non-Complete reason,
so the explicit handle.cancel.cancel() in finish_turn was dead
duplication — removed, with cancellation ownership documented on scope.
BackgroundTaskManager::stop had no production callers: real stops route
through request_stop / stop_scoped_by_turn -> stop_one (which cancels the
token and kills the process). The bare stop only flipped status, orphaning
the worker/process — a footgun the owner-aware system replaced. Removed it
and reworked the two unit tests that relied on it to exercise the real
convergence paths (request_stop + complete -> Stopped; complete frees a slot).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8f59a40 commit 28d1285
26 files changed
Lines changed: 1488 additions & 1087 deletions
File tree
- apps/puffer-desktop
- src-tauri/src
- src/lib/api
- crates
- puffer-cli
- src
- tests
- puffer-core
- runtime
- claude_tools
- workflow
- tests/tool_execution
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
| |||
2323 | 2325 | | |
2324 | 2326 | | |
2325 | 2327 | | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
2326 | 2344 | | |
2327 | 2345 | | |
2328 | 2346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | | - | |
439 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
440 | 442 | | |
441 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
442 | 454 | | |
443 | 455 | | |
444 | 456 | | |
445 | 457 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
450 | 464 | | |
451 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
452 | 477 | | |
453 | 478 | | |
454 | 479 | | |
| |||
0 commit comments