From 425c8ba7768f3c49934b1ebafc927aba5d469c89 Mon Sep 17 00:00:00 2001 From: weichen Date: Tue, 15 Sep 2026 13:15:48 +0000 Subject: [PATCH 1/2] feat(chat): drop production bizdev import from action executor Pending-action task runs now use stageflow request aliases and Server ports, so chat no longer reaches through the orchestration root. Co-authored-by: Cursor --- .doc/system-design/module-boundaries.yaml | 2 +- internal/chat/action_executor.go | 9 ++++----- internal/server/server.go | 11 ++++------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.doc/system-design/module-boundaries.yaml b/.doc/system-design/module-boundaries.yaml index 1a25ace9..9ff33724 100644 --- a/.doc/system-design/module-boundaries.yaml +++ b/.doc/system-design/module-boundaries.yaml @@ -29,7 +29,7 @@ imports: - workflowdef chat: - app/chatflow - - bizdev + - app/stageflow - coordinator - ctxmgr - docgov diff --git a/internal/chat/action_executor.go b/internal/chat/action_executor.go index d0cd15f9..d98c4e33 100644 --- a/internal/chat/action_executor.go +++ b/internal/chat/action_executor.go @@ -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 } diff --git a/internal/server/server.go b/internal/server/server.go index 8c56f188..68570335 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -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)。 From 9811ae3841d72c127118e322a112f053806fa705 Mon Sep 17 00:00:00 2001 From: weichen Date: Tue, 15 Sep 2026 13:15:48 +0000 Subject: [PATCH 2/2] docs(test): record D7b chatflow orchestration boundary S4b report and archive; chat production allowlist no longer includes bizdev. Co-authored-by: Cursor --- ...6-09-15-chatflow-orchestration-boundary.md | 39 +++++++++++ .doc/ops/CURRENT.md | 5 +- .doc/status/FEATURE-MATRIX.md | 2 +- ...flow-orchestration-boundary-test-report.md | 67 +++++++++++++++++++ 4 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 .doc/archive/ops/2026-09-15-chatflow-orchestration-boundary.md create mode 100644 .doc/test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md diff --git a/.doc/archive/ops/2026-09-15-chatflow-orchestration-boundary.md b/.doc/archive/ops/2026-09-15-chatflow-orchestration-boundary.md new file mode 100644 index 00000000..a4686001 --- /dev/null +++ b/.doc/archive/ops/2026-09-15-chatflow-orchestration-boundary.md @@ -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) diff --git a/.doc/ops/CURRENT.md b/.doc/ops/CURRENT.md index 6a71dc06..9a940578 100644 --- a/.doc/ops/CURRENT.md +++ b/.doc/ops/CURRENT.md @@ -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/` 或 `fix/`,**禁止** `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` diff --git a/.doc/status/FEATURE-MATRIX.md b/.doc/status/FEATURE-MATRIX.md index d583bfd3..91ef2342 100644 --- a/.doc/status/FEATURE-MATRIX.md +++ b/.doc/status/FEATURE-MATRIX.md @@ -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` | --- diff --git a/.doc/test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md b/.doc/test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md new file mode 100644 index 00000000..475191d9 --- /dev/null +++ b/.doc/test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md @@ -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。