merge: fix/chatflow-orchestration-boundary

This commit is contained in:
weichen
2026-09-15 13:15:57 +00:00
7 changed files with 119 additions and 16 deletions
@@ -0,0 +1,39 @@
---
title: "D7b chat 编排剩余批次"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/chatflow-orchestration-boundary
worktree: "-"
mutex: chat
---
# D7b chat 编排剩余批次
## 目标
`internal/chat` 生产代码不再 import bizdev;任务请求走 stageflow 类型别名。
## 范围
- action_executor 去掉 Bizdev 字段
- 收紧 chat import allowlist
- 表征测试保留
## 非目标
- 不搬空测试 import
- 不把 taskrun 签名从 bizdev 别名拷成独立结构
- 不切事件 live
## 步骤
1. [x] action_executor 改 stageflow 类型
2. [x] 收紧 yaml
3. [x] 报告合入
## 验收标准
- [x] chat 生产无 bizdev import
- [x] [S4b 报告](../../test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md)
+3 -2
View File
@@ -5,7 +5,7 @@
## 焦点
1. **TRACK-S**: [D4 locator 已删](../test-reports/2026-09-15-bizdev-locator-removal-test-report.md);下一步 D7b chat 生产 import
1. **TRACK-S**: Phase 2 D4–D7b 已合入([D7b](../test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md))
2. **CHAT-INTENT**: [对话意图运行时状态](../test-reports/2026-09-13-conversation-intent-runtime-state-test-report.md)(双标签 busy 已签:项目 **6275** / `DOC_BUSY` 单 run;不删 `sess-p143-u9` 探针)
3. **CHAT**: [对话历史刷新活验已补](../test-reports/2026-09-13-chat-history-refresh-test-report.md)(项目 6252 闲聊刷新同集 + guest 403;编制任务链仍开放)
@@ -68,6 +68,7 @@
| Cursor | intent-bizdev-boundary | fix/intent-bizdev-boundary | - | intent | done |
| Cursor | stageflow-type-ownership | fix/stageflow-type-ownership | - | stageflow | done |
| Cursor | bizdev-locator-removal | fix/bizdev-locator-removal | - | bizdev | done |
| Cursor | chatflow-orchestration-boundary | fix/chatflow-orchestration-boundary | - | chat | done |
> 新任务开始前登记。`branch` 必须为 `feature/<slug>` 或 `fix/<slug>`,**禁止** `dev` / `test` / `main`。同一 `mutex` 同时仅一个 `in_progress`。
@@ -79,7 +80,7 @@
| holder | phase | since | scope | queue |
|--------|-------|-------|-------|-------|
| Cursor | merging | 2026-09-15 | D4 bizdev locator removal;mode=off | - |
| - | idle | - | - | - |
**phase**: `idle` | `merging` | `smoke` | `e2e`
+1 -1
View File
@@ -27,7 +27,7 @@
| PI Runner / 配置链 | pi-agent + MiniMax 真实链路 | done | [test piagent](../test-reports/2026-09-13-codex-audit-p0-remediation-test-report.md);[container-env](../test-reports/2026-09-13-container-env-configuration-test-report.md) | — | `pi-agent` |
| 三环境运维 | dev/test/main + 共享 KB | done | [PROJECT.md](../../PROJECT.md) §4;四环境 healthy | — | `infra` |
| CI / E2E | PG 集成 + 真实 PI E2E | partial | [gap-matrix BUG-08](../remediation/gap-matrix.md);[test pg-ci](../test-reports/2026-09-12-pg-ci-soak-e2e-test-report.md);[运行时 UI Round20](../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md) | CI `TEST_DATABASE_URL` 隔离库仍缺;文档运行时真实 UI 已按 UI_PHASE 分文件且 post-restart 断言最终 A1 正文。`-race` 全包并行 TempDir flake 为基建残留 | `ci` |
| 模块解耦与可靠事件 | 文档可靠性纵向试点、PG 持久事件交付与选择性模块化 | partial | [架构](../system-design/2026-09-14-module-decoupling-architecture.md);[ADR](../adr/2026-09-14-modular-monolith-decoupling.md);[Phase 1](../remediation/2026-09-14-module-decoupling-refactor-plan.md);[Phase 2 审阅](../audit/2026-09-15-module-decoupling-phase2-plan-review.md);[Phase 2 修订计划](../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md);[E0A](../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md);[E0B](../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md);[E1A](../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md);[E1B](../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md);[E1C](../test-reports/2026-09-15-event-e1c-projection-test-report.md);[E2](../test-reports/2026-09-15-event-e2-hook-guard-test-report.md);[复盘](../ops/research/2026-09-15-track-e-retrospective.md);[D6](../test-reports/2026-09-15-doccontent-canonical-boundary-test-report.md);[D7a](../test-reports/2026-09-15-intent-bizdev-boundary-test-report.md);[D5](../test-reports/2026-09-15-stageflow-type-ownership-test-report.md);[D4](../test-reports/2026-09-15-bizdev-locator-removal-test-report.md) | E0A–E2 隔离库已过;dispatcher 默认 off。D4–D7a 与 D7b 首批已合入。删除闭包 API 须等 live。`internal/chat` 生产仍 import bizdev(D7b 剩余)。Track P 实现、FAV 另列。HTTP/PI 已有独立 remediation(Phase 2 只立项) | `architecture-docs` |
| 模块解耦与可靠事件 | 文档可靠性纵向试点、PG 持久事件交付与选择性模块化 | partial | [架构](../system-design/2026-09-14-module-decoupling-architecture.md);[ADR](../adr/2026-09-14-modular-monolith-decoupling.md);[Phase 1](../remediation/2026-09-14-module-decoupling-refactor-plan.md);[Phase 2 审阅](../audit/2026-09-15-module-decoupling-phase2-plan-review.md);[Phase 2 修订计划](../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md);[E0A](../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md);[E0B](../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md);[E1A](../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md);[E1B](../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md);[E1C](../test-reports/2026-09-15-event-e1c-projection-test-report.md);[E2](../test-reports/2026-09-15-event-e2-hook-guard-test-report.md);[复盘](../ops/research/2026-09-15-track-e-retrospective.md);[D6](../test-reports/2026-09-15-doccontent-canonical-boundary-test-report.md);[D7a](../test-reports/2026-09-15-intent-bizdev-boundary-test-report.md);[D5](../test-reports/2026-09-15-stageflow-type-ownership-test-report.md);[D4](../test-reports/2026-09-15-bizdev-locator-removal-test-report.md);[D7b](../test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md) | E0A–E2 隔离库已过;dispatcher 默认 off。D4–D7b 已合入。删除闭包 API 须等 live。Track P 实现、FAV 另列。HTTP/PI 已有独立 remediation(Phase 2 只立项) | `architecture-docs` |
---
+1 -1
View File
@@ -29,7 +29,7 @@ imports:
- workflowdef
chat:
- app/chatflow
- bizdev
- app/stageflow
- coordinator
- ctxmgr
- docgov
@@ -0,0 +1,67 @@
# D7b chat 编排剩余批次测试报告
## 一、 测试背景 (Background)
D7b 首批只把 `app/chatflow` assembler 的阶段常量迁到 `maturity`。`internal/chat` 生产包仍通过 `ActionServices.Bizdev` 和 `bizdev.TaskRunRequest` 绑在编排根上。D4 已提供 Server 端口后,本批去掉 chat 生产对 bizdev 的 import。
## 二、 测试目标 (Test Objectives)
- `internal/chat` 生产代码不再 import `bizdev`。
- 任务续跑/重启走 `stageflow.TaskRunRequest` 别名;`CreateAndStart` 类型身份不变。
- 去掉 `ActionServices.Bizdev`;仅要求 `TaskRuns`。
- arch-check 收紧 chat allowlist(去掉 bizdev,加入 app/stageflow)。
- 既有 `TestExecuteAction_DocGovReviewApprove` 与 chat 表征仍过。
## 三、 测试方案与环境 (Test Plan & Environment)
| 项 | 值 |
|----|-----|
| OS | Linux 7.0.0-31-generic |
| Go | go1.27.1 linux/amd64 |
| 分支 | `fix/chatflow-orchestration-boundary` |
| 层级 | 表征/短测 + arch-check |
| 项目 143 | 只读 |
## 四、 预期结果 (Expected Results)
| 用例 | 期望 |
|------|------|
| 生产 import | chat 无 bizdev |
| 审核动作 | `TestExecuteAction_DocGovReviewApprove` PASS |
| 短测 | `go test -short ./...` PASS |
| arch-check | block 通过 |
## 五、 实际测试结果与判定 (Actual Results & Evaluation)
### 5.1 表征
- **测试输入 (Input)**:`go test -short -count=1 ./internal/chat ./internal/server ./internal/archtest ./internal/app/stageflow`
- **实际输出 (Actual Output)**:上述包全部 `ok`(server 9.950s)
- **评价判定 (Evaluation / Verdict)**:**PASS**
- **性能与耗时 (Duration & Latency)**:约 11.6s
### 5.2 arch-check
- **测试输入 (Input)**:`./scripts/arch-check.sh --mode block`
- **实际输出 (Actual Output)**:`arch-check block: production gate passed`
- **评价判定 (Evaluation / Verdict)**:**PASS**
- **性能与耗时 (Duration & Latency)**:~0.22s
### 5.3 短测全量
- **测试输入 (Input)**:`go test -short -count=1 ./...`
- **实际输出 (Actual Output)**:各包 `ok`(server 10.007s,cli 2.327s)
- **评价判定 (Evaluation / Verdict)**:**PASS**
- **性能与耗时 (Duration & Latency)**:约 12.6s
## 六、 自动化测试套件汇总 (Test Suite Execution)
| 命令 | 结果 |
|------|------|
| chat/server/archtest/stageflow | PASS |
| `./scripts/arch-check.sh --mode block` | PASS |
| `go test -short -count=1 ./...` | PASS |
## 七、 测试结论与后续优化建议 (Conclusion & Next Steps)
D7b 剩余批次 **PASS**。chat 生产不再 import bizdev。测试仍可用 bizdev 构造夹具。taskrun 签名仍是 bizdev 类型别名,未机械复制字段。Track P 仍只立项;不切 shared consumer live。
+4 -5
View File
@@ -7,7 +7,7 @@ import (
"strings"
"time"
"chat-agent-system/internal/bizdev"
"chat-agent-system/internal/app/stageflow"
"chat-agent-system/internal/coordinator"
"chat-agent-system/internal/docgov"
"chat-agent-system/internal/taskrun"
@@ -16,7 +16,6 @@ import (
// ActionServices 对话层执行 PendingAction 所需的后端服务。
type ActionServices struct {
DocGov *docgov.GovernanceEngine
Bizdev bizdev.BizdevService
TaskRuns *taskrun.Manager
}
@@ -95,7 +94,7 @@ func (s *Session) executeAction(ctx context.Context, action *coordinator.Pending
return &ActionExecResult{DocState: string(doc.CurrentState), Message: "驳回完成"}, nil
case "taskrun.resume", "taskrun.restart":
if s.Actions.TaskRuns == nil || s.Actions.Bizdev == nil {
if s.Actions.TaskRuns == nil {
return nil, fmt.Errorf("task run services not available")
}
taskKey := action.TaskKey
@@ -107,7 +106,7 @@ func (s *Session) executeAction(ctx context.Context, action *coordinator.Pending
if action.Kind == "taskrun.resume" {
resumeDir = action.WorkDir
}
taskReq := bizdev.TaskRunRequest{
taskReq := stageflow.TaskRunRequest{
TaskKey: taskKey,
ProjectName: userCtx.Project.Name,
UserID: uid,
@@ -122,7 +121,7 @@ func (s *Session) executeAction(ctx context.Context, action *coordinator.Pending
TaskKey: taskKey,
Status: "running",
}
created, err := s.Actions.TaskRuns.CreateAndStart(ctx, runID, record, taskReq, bizdev.StageRunRequest{}, resumeDir)
created, err := s.Actions.TaskRuns.CreateAndStart(ctx, runID, record, taskReq, stageflow.StageRunRequest{}, resumeDir)
if err != nil {
return nil, err
}
+4 -7
View File
@@ -500,13 +500,10 @@ func (s *Server) getOrCreateSession(
sess := chat.NewSession(sessionID, userCtx, s.rec, s.engine)
sess.ChatLog = s.chatLog
if s.svc != nil {
sess.CtxMgr = s.ctxMgr
sess.Actions = &chat.ActionServices{
DocGov: s.gov,
Bizdev: s.svc,
TaskRuns: s.taskRuns,
}
sess.CtxMgr = s.ctxMgr
sess.Actions = &chat.ActionServices{
DocGov: s.gov,
TaskRuns: s.taskRuns,
}
// 若从持久层恢复了会话历史,回填消息列表、事实黑板与近期对话 (G3)。