Skip to content

feat(runtime): add dynamic workflow execution - #564

Merged
kingfs merged 10 commits into
chaitin:mainfrom
kingfs:docs/dynamic-workflow-runtime-decisions
Aug 7, 2026
Merged

feat(runtime): add dynamic workflow execution#564
kingfs merged 10 commits into
chaitin:mainfrom
kingfs:docs/dynamic-workflow-runtime-decisions

Conversation

@kingfs

@kingfs kingfs commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a restricted JavaScript dynamic-workflow engine with agent, parallel, pipeline, scoped phases, nested workflows, budgets, cancellation, replay, and real Git worktree isolation
  • preserve legacy runtime behavior by keeping stateRoot unchanged and assigning isolated sessionRoot directories only to workflow child agents
  • add UTF-8-safe incremental workflow event/result decoding, protocol validation, and typed failures to @chaitin/agent-compose-runtime-sdk
  • persist nested workflow snapshots, validate linked worktrees before cache reuse, and interpret abandoned state as interrupted
  • document the runtime contract, persistence layout, cache identity, failure semantics, and compatibility guarantees

Testing

  • task lint
  • task build
  • npm test (runtime/javascript: 223 passed, 87.87% statement coverage)
  • npm test (runtime/agent-compose-runtime-sdk: 41 passed)
  • TEST_SHAPE=integration npm test (runtime/javascript: 61.11% statement coverage)
  • TEST_SHAPE=e2e npm test (runtime/javascript: 62.07% statement coverage)
  • task docs:build
  • task test (workflow unit/integration/e2e shapes pass; the full command currently fails in the unrelated existing pkg/agentcompose/app/TestProjectAgentModelResolverUsesCurrentRevisionAndDaemonDefault, where seeded gemini-3.1-pro-preview overrides the test's expected daemon default)
  • git diff --check

Checklist

  • Documentation updated for the new runtime and SDK behavior.
  • Unit, integration, E2E, compatibility, cancellation, replay, and worktree tests added.
  • Existing non-workflow stateRoot and session behavior remains compatible.
  • No secrets, private endpoints, certificates, or local runtime state included.

Sample

@kingfs kingfs changed the title docs(runtime): clarify dynamic workflow execution semantics feat(runtime): add dynamic workflow execution Aug 5, 2026
@monkeyscan

monkeyscan Bot commented Aug 5, 2026

Copy link
Copy Markdown

评审任务执行失败。

@kingfs

kingfs commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@monkeyscan review pr

@monkeyscan

monkeyscan Bot commented Aug 5, 2026

Copy link
Copy Markdown

评审任务执行失败:任务执行超时。

@monkeyscan

monkeyscan Bot commented Aug 5, 2026

Copy link
Copy Markdown

评审任务执行失败:任务执行超时。

@kingfs

kingfs commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

@monkeyscan review pr

@monkeyscan

monkeyscan Bot commented Aug 6, 2026

Copy link
Copy Markdown

评审任务执行失败:任务执行超时。

@kingfs

kingfs commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@monkeyscan review pr

@monkeyscan

monkeyscan Bot commented Aug 7, 2026

Copy link
Copy Markdown

@kingfs wrote:
@monkeyscan review pr

处理失败,请稍后重试。

@eetoc

eetoc commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

已基于 PR #564 当前 HEAD(254f7358)完成本地回归验证。

验证时使用该 PR 代码实际构建 daemon 和 guest 镜像,通过真实 daemon、Docker guest、持久化存储、Git 仓库和 worktree 生命周期运行。LLM 调用边界使用协议兼容的可控 stub,以稳定控制返回结果和取消时序;本次验证不包含外部 LLM 服务端行为。

实际结果:

  1. 连续在两个 scoped phase 中调用 agent,或在 scoped phase 后继续调用 agent,后续调用会重复生成 root/agent:0,工作流报错:

    duplicate workflow invocationKey: root/agent:0
    
  2. 在 child controller 创建前取消父 signal,观察到:

    parentAborted=true
    childAborted=false
    

    在准备阶段触发该取消窗口后,provider 仍会继续执行,agent 最终可被记录为 done。provider 已启动后的常规取消路径可以正常停止。

  3. 使用同一个 worktree agent 连续执行三个独立 run:

    Run A: 首次执行
    Run B: resume Run A
    Run C: resume Run B
    

    实际结果:

    provider calls = [1, 0, 1]
    statuses       = [done, cached, done]
    

    Run B 成功命中缓存,但其记录缺少 worktreeHead;Run C resume Run B 时缓存校验失败,重新执行 provider 并创建了新的 worktree。

基础测试结果:

Runtime SDK:        41/41 passed
Runtime JavaScript: 223/224 passed

以上三个问题均已通过实际运行或可控时序验证确认。基于当前结果,建议修复并补充对应回归测试后再合入。

@monkeyscan

monkeyscan Bot commented Aug 7, 2026

Copy link
Copy Markdown

评审任务执行失败。

@monkeyscan

monkeyscan Bot commented Aug 7, 2026

Copy link
Copy Markdown

评审任务执行失败:任务执行超时。

@monkeyscan

monkeyscan Bot commented Aug 7, 2026

Copy link
Copy Markdown

评审任务执行失败:任务执行超时。

@eetoc eetoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kingfs
kingfs merged commit 2949b09 into chaitin:main Aug 7, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants