docs(tasks): clarify admission lifecycle

This commit is contained in:
pku-xht
2026-08-11 23:13:35 +08:00
parent e3ac9e85e5
commit 38922cbbb9
14 changed files with 34 additions and 19 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/tasks/tasks-local/README.md
README.md: b486438eb2f73728361a6140fdec33603a2ace45
README.zh.md: ecc9104e4145add9448d43e1eb2565a3fc7e09c3
README.md: f558676b36bb5462453bde553eac27b458e1268e
README.zh.md: ed8f2b1220692a00c09b6605b18231f5263f00e5

View File

@@ -31,4 +31,4 @@ No direct invalidation; the named consumer owns any request-prefix changes.
## Known Limitations and Deferred Work
- **Tasks are process-local** — records die with the harness process; durable or cross-restart execution needs a separate backend implementing the seam.
- **A silently ineffective cancel can stall teardown** — only an explicit throw can be force-failed safely.
- **A silently ineffective cancel can stall teardown and hold capacity** — if `cancel` returns without settling `done`, the registry cannot distinguish it from a slow stop; the task keeps one bucket slot for the rest of the service lifetime, and only an explicit throw can be force-failed safely.

View File

@@ -31,4 +31,4 @@
## 已知限制与暂缓事项
- **任务只存在于进程本地**:记录会随 harness 进程终止而消失;持久或跨重启执行需要一个单独实现该 seam 的后端。
- **静默无效的取消可能使销毁过程停滞**只有显式抛出异常才能安全地强制标为失败。
- **静默无效的取消可能使销毁过程停滞并持续占用容量**:如果 `cancel` 返回后始终未结算 `done`,注册表就无法将其与缓慢停止区分开;该任务会在服务剩余生命周期内持续占用一个桶名额,只有显式抛出异常才能安全地强制标为失败。

View File

@@ -29,7 +29,10 @@ const DEFAULT_MAX_CONCURRENT_TASKS_PER_OWNER = 10
/** Configuration for the process-local task registry. */
export interface Config {
/** Maximum `running` plus `stopping` tasks per exact owner; omission defaults to 10. */
/**
* Maximum `running` plus `stopping` tasks per exact owner or in the shared unowned bucket;
* omission defaults to 10.
*/
maxConcurrentTasksPerOwner?: number
}

View File

@@ -15,8 +15,10 @@ export const name = 'tasks-local-invariant'
export const inject = ['invariants']
/**
* No runtime invariant: the Service Definition companion in `@deepseek-ai/dsh-tasks` already
* validates every registry snapshot this implementation publishes.
* No runtime invariant: the Service Definition companion in `@deepseek-ai/dsh-tasks` validates
* every published snapshot. `LocalTaskService.start()` enforces this provider's configured
* admission limit synchronously before producer execution; repeating that aggregate check here
* would expose provider-private configuration solely to this companion.
*/
const install: InvariantInstaller = () => {}