Skip to content

refactor(workflow): consolidate runtime contexts and state snapshots - #7992

Draft
c121914yu wants to merge 4 commits into
labring:mainfrom
c121914yu:codex/workflow-context-refactor
Draft

c121914yu wants to merge 4 commits into
labring:mainfrom
c121914yu:codex/workflow-context-refactor

Conversation

@c121914yu

@c121914yu c121914yu commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

变更

  • 将工作流文件、资源、变量、节点响应及运行控制统一收敛到 dispatch/context,通过 getChildContext 派生并显式激活作用域。
  • ChatDispatchProps 更名为 WorkflowDispatchProps;入口使用 Pick 声明依赖,停止检查、预算、深度和工具标记从节点 props 移到 Context。
  • 将 WorkflowQueue 拆到 queue.ts,runWorkflow 只消费上层准备好的变量及独立响应 Scope,避免重复初始化和响应摘要重复累计。
  • 用 WorkflowRunStateSnapshot 实例统一变量 clone、起点快照、差量提交与丢弃,迁移 ToolCall、Loop、Parallel、Workflow Tool runner;按完成情况立即提交,不按调用顺序排队。
  • 保留各执行路径不同的成功/失败/交互 checkpoint 策略;快照不承诺多字段原子提交或外部副作用回滚。
  • 更新 App、Skill、MCP、定时运行、外链入口与测试;删除未使用的内部 runtime 节点。

Review 与验证

  • 已 rebase 到 upstream/main(30a50c4c5e),保留原有三个业务提交并补充合并后的导入与测试夹具修正;无部署 YAML 改动。
  • 保留上游模型按需加载与鉴权:命中资源快照直接使用;未命中时按运行人所属团队与成员鉴权;保留系统模型默认回退、跨团队隔离和权限错误不降级规则。模型权限与目录核心实现未修改,资源加载服务仅调整 Context 导入路径。
  • 受影响局部测试共 67 个文件、1153 个用例通过(Service 1092、App 50、Pro 11;失败的旧夹具已修复并复跑);未运行全量测试。
  • 69 个变更生产 TypeScript 文件定向检查无错误(Service 61、App 6、Pro 2)。额外对比的两个存量测试文件类型诊断 33 → 31、无新增;不宣称整个仓库 tsc 全绿。
  • 测试复用真实 Workflow Context 夹具,未通过放宽生产 Context 校验来迁就旧 mock;ESLint、Prettier 与 diff whitespace 检查通过。

配套 PR

Copilot AI balanced review requested due to automatic review settings October 15, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 52.19% 4793 / 9182
🔵 Statements 51.87% 5069 / 9771
🔵 Functions 48.99% 929 / 1896
🔵 Branches 47.15% 2555 / 5418
File CoverageNo changed files found.
Generated in workflow #4385 for commit 74fa16b by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ Admin Preview Image Ready!

ghcr.io/labring/fastgpt-pr:admin_74fa16ba8cb749b0061424c737288a5bbd6a9578

🕒 Time: 2026-10-15 19:15:42 (UTC+8)

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ Build and publish successful - Preview fastgpt Image:

ghcr.io/labring/fastgpt-pr:fastgpt_74fa16ba8cb749b0061424c737288a5bbd6a9578

🕒 Time: 2026-10-15 19:17:39 (UTC+8)

Unify workflow context fixtures and remove redundant runtime tests. Add variable input precedence, runtime-only updates, and SSE lifecycle coverage.
Keep upstream on-demand model authorization and resource snapshot rules. Adapt runtime tool tests to real workflow contexts and clean up merged imports.
@c121914yu
c121914yu force-pushed the codex/workflow-context-refactor branch from 3d5b221 to 74fa16b Compare October 15, 2026 11:09
@c121914yu c121914yu self-assigned this Oct 19, 2026
@c121914yu
c121914yu marked this pull request as draft October 19, 2026 01:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants