Repository navigation
[v2] 补齐工作流失败注入、空目录/延迟模型水合与并发竞态修复 - #387
wanglongan587 wants to merge 5 commits into
Conversation
zhangxinhao
left a comment
There was a problem hiding this comment.
LGTM(12778dc)
@wanglongan587 我看了这个 PR,理解它是要补齐工作流重试和续跑的失败上下文注入,修复空模型目录、延迟水合及启动取消和流超时中的竞态。可以合并,建议补齐模型自动修复与撤销操作的交互。相关前端测试通过,数据库相关行为因缺少测试数据库未能验证。
- 💬 其他建议:P2-1 撤销操作会恢复已修复的失效模型
- 测试:
cd frontend-v2 && npx vitest run src/features/workflows/editor/workflow-model-hydration.test.tsx src/features/workflows/editor/workflow-inspector.test.tsx src/features/chat/workflow-run/server-run-adapter.test.ts src/features/chat/workflow-run/run-flow.test.tsx --maxWorkers=4通过;cd v2-server && go test -race -count=1 -timeout=5m ./internal/nodeservices ./internal/workflow ./internal/workflowhost ./internal/taskworkflow没跑(非数据库用例通过;依赖 PostgreSQL 的失败注入和启动竞态用例因未设置 TEST_DATABASE_URL 被跳过,未完成验证。);没跑全量和 e2e。
涉及对外 API/协议、并发核心,建议 owner 再看一眼。
以上都是建议,怎么处理由你决定。
自动检视 · 基于 12778dc · 第 1 轮(全量)
| if (historyHydrateEditGenerationRef.current === editGenerationRef.current) { | ||
| resetWorkflowHistory(workflowRef.current); | ||
| } |
There was a problem hiding this comment.
P2-1(建议) 这里在已有编辑时保留了历史栈,但历史快照仍包含修复前的执行器。已复现:打开含失效模型的草稿,目录返回前新增一个 Agent,目录到达并自动修复后点击“撤销”,原节点就恢复为失效模型;由于 modelHydratedWorkflowId 已设置,后续不会再次修复,发布也会保存失效值。建议同步修复历史快照中的对应执行器,或在恢复快照时重新应用未触碰执行器的修复,并补充实际撤销后的断言。
EricWvi
left a comment
There was a problem hiding this comment.
Owner acceptance, round 1, on 12778dc4, run on a trial merge into main acc80ecd. The merge has no conflicts. All gates pass: full race, npm run check, full e2e (82 passed), and the real-Node workflow-retry/agents/runs/model-hydration specs (15 passed). The production behaviour matches desktop. One change is needed before merge:
M-1. The scoping predicates of FindLastFailedWorkflowNodeAttempt (v2-server/internal/store/workflow_runs.go:492-512) are untested. Each of these mutants survives the store and workflowhost suites:
- dropping the
NOT EXISTS (… succeeded …)clause; - neutralising
iteration IS NOT DISTINCT FROM $4; - dropping
started_at IS NOT NULL.
If any of them regressed, the suites would stay green while a Loop round 2 attempt is told round 1's already-recovered failure, or Iteration item 1 receives item 0's failure. Please add a PostgreSQL store test for three cases: a recovered failure followed by a later round, an Iteration item mismatch, and an unstarted failed attempt. Desktop's equivalents are repository_tests.rs:1249 and retry_review_tests.rs:104.
Please also reword "same round" in the description. After resume-from-failure of a Loop, the failure is injected into replayed round 1, not the round that failed. That is the same as desktop, so describe it as desktop-parity semantics.
The non-blocking Lows go to #1181 follow-ups:
- undo after a late model repair restores and publishes the stale model;
- the user-edit guard of late repair is untested;
- prompt placement and output dropping for refusals are not pinned to desktop;
- a blank executor is accepted at publish and fails only at run time;
- the motion fix and the real injected-context render lack direct tests (the e2e seeds the DB text).
…drop desktop default
12778dc to
fd54d93
Compare
zhangxinhao
left a comment
There was a problem hiding this comment.
LGTM(fd54d93)
@wanglongan587 我看了这个 PR,理解它是要补齐工作流重试和续跑的失败上下文注入,修复空模型目录、延迟水合及启动取消和流超时中的竞态。未发现新的合并阻塞问题,可以合并。上轮 P2-1 的撤销恢复失效模型问题仍未处理,本轮不重复列出;数据库相关行为因缺少测试数据库未能验证。
- ⏳ 上轮还没处理的:P2-1(仍是建议,不影响合并)。
- 测试:
cd frontend-v2 && npx vitest run src/features/workflows/editor/workflow-model-hydration.test.tsx src/features/workflows/editor/workflow-inspector.test.tsx src/features/chat/workflow-run/server-run-adapter.test.ts src/features/chat/workflow-run/run-flow.test.tsx --maxWorkers=4通过;cd v2-server && go test -race -count=1 -timeout=5m ./internal/nodeservices ./internal/workflow ./internal/workflowhost ./internal/taskworkflow ./internal/store ./internal/server通过;cd v2-server && go test -v -count=1 -timeout=5m ./internal/store ./internal/taskworkflow ./internal/workflowhost ./internal/server -run 'TestLastFailedNodeAttempt|TestStartFailureRefuseStateRace|TestPrepareRefuseStateRace|TestRefuseRetryTransition|TestRetryInjectsPreviousFailure|TestResumeInjectsPreviousFailure|TestMatchingModelByName|TestWorkflowRunsOverHTTP'没跑(目标数据库用例均因未配置 TEST_DATABASE_URL 而跳过。);没跑全量和 e2e。
涉及对外 API/协议、并发核心,建议 owner 再看一眼。
以上都是建议,怎么处理由你决定。
自动检视 · 基于 fd54d93 · 第 2 轮(全量)
Summary
v2,不涉及 specs。
补齐 v2 工作流与运行时在重试注入、模型目录水合及并发竞态方面的第一批缺口:
injectLastFailure)v2-server/workflows.openapi.json的WorkflowRunCreate与生成的frontend-v2/src/lib/workflows/api/generated.ts新增可选字段injectLastFailure。payload,经UpdateInput/Start保留。FailureKind.InjectsIntoPrompt())与injectLastFailure提取上次可注入失败原因,筛选范围、跨轮次续跑回放和触发语义和 desktop 一致(已在store/workflow_last_failed_attempt_test.go覆盖已恢复失败排除、Iteration 作用域隔离、未启动尝试排除三个作用域条件),按 locale 注入 prompt 并写入payload.injected_failure_context,由前端运行节点详情展示。model.requested记录official/ora-space.codeagentcli/gpt-5的逻辑;目录为空时新 Agent 节点保持空执行器{ agentCli: "", modelId: "" },属性面板显示「加载中…」或「没有可用 Agent 模型」并隐藏「 · 」拼接与重复提示。payload.model.requested记录匹配名」的测试。taskworkflow拒收竞态与nodeservices超时测试抖动taskworkflow中refuse与startFailure在RefuseTaskWorkflow返回store.ErrWorkflowRunState时的竞态,确保取消已启动运行并在接管分支正确订阅观察直至进入review。nodeservices停止已结束流上的空闲/总时长定时器,清理limits_test.go真实时钟抖动并验证已取消流提前 EOF 仍上报中断原因。Refs ora-space/circus#1214