taskflow: run extensions through one dispatcher and tell them which phase they run in
维护者通常 1 天内回复
评估
调研方向
Start with the two call sites that run extensions, CompleteTaskStep and SaveDraft, and the stopOnError and go func() logic they each duplicate. The issue asks for an extensions.Invocation context value, an orchestrator.Dispatcher with WithDispatcher, and an internal fire that handles guard and notify phases. Work is already under way in open PR #397, so coordinate there before starting. Done means both existing phases behave as before and POST_RESUME goes through the dispatcher.
由索引模型根据 Issue 内容生成。
描述
Current Limitation
The orchestrator runs extensions from two call sites, CompleteTaskStep and SaveDraft. Each call site deep-copies the record and payload itself, and each decides for itself whether the run blocks or is asynchronous, using a stopOnError bool and a hand-written go func(). Adding the lifecycle phases in #395 this way would copy that logic into every new call site.
It also leaves two gaps:
- An extension can't tell which phase it is running in, or recognise a repeat of an event it already handled.
POST_RESUMEalways runs in a bare goroutine. A host can't bound its concurrency, recover its panics, or run it inline in tests, which currently need aWaitGroupto wait for it.
Suggested Improvement
Route every extension run through one dispatcher, with no behaviour change for the two existing phases:
extensions.Invocation{Phase, IdempotencyKey}on the context passed toExecute, read withextensions.InvocationFrom(ctx). The key is<task id>/<step id>/<seq>/<phase>and names the run of the step, whatever seq the row has moved on to.TaskExtensionis unchanged.orchestrator.Dispatcher(with aDispatcherFuncadapter) runs notify phases, set withWithDispatcher. The default is one goroutine per dispatch, as today.- An internal
fire(phase, …)looks up the phase's policy. A guard (PRE_RESUME) runs inline and returns the first error. A notify (POST_RESUME) is handed to the dispatcher with a context that is never cancelled. Deep copies are made in one place.
Version
53b0bd3
Additional Context
This is PR 1 of the rollout in #395. Telling a draft save apart from a submission (#327) stays separate.
- 主要语言
- Go
- 星标
- 6
- 派生
- 8
- 平均合并
- 21 小时 36 分钟
- 30 天内合并 PR
- 42
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenNSW/core 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholders未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
nsw-sl cleanup Type/Improvement
难度 3/5 1-2 天 新手友好度 48/100
维护者通常 1 天内回复
-
remote: let the host inject a logger, and log with one consistent policy可能已有人在做 @mushrafmim 于 5 天前认领。 未关闭Type/Improvement
难度 4/5 3-5 天 新手友好度 22/100
维护者通常 1 天内回复
相似的 Issue
-
agent-research-finding chore
难度 2/5 1-3 小时 新手友好度 78/100
jordansmall/spindrift#7370 ·
维护者通常 1 天内回复
-
☢️ Bug v3
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
The repo's gates check is clean and runs need no swaps可能已有人在做 @turbot-agent-fleet 今天认领。 未关闭agent:ready
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
needs-kind needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
crossplane-contrib/provider-keycloak#806 ·
维护者通常 1 天内回复