Skip to content

Commit d8c15c3

Browse files
于晓彤claude
authored andcommitted
feat(refiner+workflow): 6 fixes — workflow_pattern + reject_reason + chinese summary + batch undo + drop execution-pipeline + checkpoint-refine
Address user-reported issues: - A1: surface workflow_pattern kind in the UI (was missing from CORE_KINDS on the frontend so user-told-orchestrator workflow exps fell back to raw IDs). Add 套路 label + palette mapping. Tighten the refine prompt with a workflow-kind classification rule so 节点顺序/因果/缺工具/节点序列+ 恢复路径 guidance lands in workflow_rule/gap/pattern instead of the catch-all know_how bucket. - anomalyco#9: refiner prompt rejects single-statement facts / public knowledge / one-shot context. Adds an optional reject_reason field to the refine output schema; when set, the attach path short-circuits and writes the attempt to rejected.ndjson (stage=llm_reject) so the user can audit. - anomalyco#11: confirm checkpoint.failed already triggers observeWorkflowCompletion in workflow/index.ts:1885. No code change. - anomalyco#2: workflow_update tool description now demands Chinese single-sentence summary so the timeline view shows what the agent is doing at a glance. - A2: time-windowed batch undo. New Refiner.undoRefinementsSince(ms) + POST /refiner/global-rerefine/undo route. UI button in the global re-refine modal prompts the user for a window in minutes, reverse- applies any experience whose last refinement is within it. - anomalyco#7: delete the Execution Pipeline plugin entirely. Workflow event timeline + node attempt_history.summary already cover this. Co-Authored-By: Claude Opus 4.7 <[email protected]>
1 parent bb573a9 commit d8c15c3

7 files changed

Lines changed: 168 additions & 308 deletions

File tree

‎packages/app/src/pages/session/refiner-page.tsx‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import "./refiner-page.css"
3434
const CORE_KINDS = [
3535
"workflow_rule",
3636
"workflow_gap",
37+
"workflow_pattern",
3738
"know_how",
3839
"constraint_or_policy",
3940
"domain_knowledge",
@@ -268,6 +269,7 @@ type PaletteName =
268269
const KIND_PALETTE: Record<CoreKind, PaletteName> = {
269270
workflow_rule: "cobalt",
270271
workflow_gap: "amber",
272+
workflow_pattern: "blue",
271273
know_how: "mint",
272274
constraint_or_policy: "ember",
273275
domain_knowledge: "blue",
@@ -291,6 +293,7 @@ const PALETTE_HUE: Record<PaletteName, number> = {
291293
const KIND_LABEL: Record<CoreKind, string> = {
292294
workflow_rule: "流程规则",
293295
workflow_gap: "流程缺口",
296+
workflow_pattern: "工作流套路",
294297
know_how: "操作指导",
295298
constraint_or_policy: "硬约束",
296299
domain_knowledge: "领域知识",
@@ -4269,6 +4272,8 @@ function ReRefineModal(props: {
42694272
onMerge: (ids: string[]) => Promise<void> | void
42704273
onDelete: (id: string, reason: string) => Promise<void> | void
42714274
onReload: () => void
4275+
onUndoRecent: () => Promise<void> | void
4276+
undoBusy: boolean
42724277
onClose: () => void
42734278
}) {
42744279
// ESC closes — same UX contract as the logs modal.
@@ -4340,6 +4345,17 @@ function ReRefineModal(props: {
43404345
>
43414346
{props.loading ? "刷新中…" : "↻ 刷新"}
43424347
</button>
4348+
<button
4349+
type="button"
4350+
class="rune-btn"
4351+
data-size="xs"
4352+
data-variant="danger"
4353+
onClick={() => props.onUndoRecent()}
4354+
disabled={props.undoBusy}
4355+
title="撤销最近的整理动作(按时间窗口反向逐条 refine_history)"
4356+
>
4357+
{props.undoBusy ? "回退中…" : "↩ 撤销最近整理"}
4358+
</button>
43434359
<button
43444360
type="button"
43454361
class="rf-logs-close"
@@ -5739,6 +5755,48 @@ export default function RefinerPage() {
57395755
await reloadReRefine()
57405756
}
57415757

5758+
// Time-windowed batch undo. The user picks a window (5 / 15 / 60 min)
5759+
// via the native prompt; we then walk every experience whose last
5760+
// refinement happened within that window and reverse-apply it. Merge /
5761+
// delete actions can't be undone via this path (they leave no history
5762+
// entry on the survivor) — the response summarises what was reverted
5763+
// vs skipped so the user knows what's still in flight.
5764+
const [undoBusy, setUndoBusy] = createSignal(false)
5765+
const onUndoRecentRefine = async () => {
5766+
const b = apiBase()
5767+
if (!b) return
5768+
const choice = window.prompt(
5769+
"撤销最近多少分钟内的整理动作?\n(merge/delete 不会被回退,只回退 refine。)",
5770+
"15",
5771+
)
5772+
if (choice === null) return
5773+
const minutes = Number.parseInt(choice, 10)
5774+
if (!Number.isFinite(minutes) || minutes <= 0) {
5775+
flash("无效输入")
5776+
return
5777+
}
5778+
setUndoBusy(true)
5779+
try {
5780+
const res = await apiRequest<{
5781+
ok: boolean
5782+
reverted: Array<{ id: string; title: string }>
5783+
skipped: Array<{ id: string; title: string; reason: string }>
5784+
total_examined: number
5785+
}>(b, "/experimental/refiner/global-rerefine/undo", {
5786+
method: "POST",
5787+
json: { since_ms: Date.now() - minutes * 60_000 },
5788+
})
5789+
flash(`已回退 ${res.reverted.length} 条 · 跳过 ${res.skipped.length}`)
5790+
refreshAll()
5791+
await reloadReRefine()
5792+
} catch (err) {
5793+
console.warn("undo recent refine failed", err)
5794+
flash("回退失败:详见 console")
5795+
} finally {
5796+
setUndoBusy(false)
5797+
}
5798+
}
5799+
57425800
// Each resource is wrapped in `stableFetcher` so polling refetches don't
57435801
// produce new object references when the server returned an identical
57445802
// payload — that would otherwise re-key every <For> row and re-run every
@@ -6883,6 +6941,8 @@ export default function RefinerPage() {
68836941
}
68846942
}}
68856943
onReload={() => void reloadReRefine()}
6944+
onUndoRecent={() => onUndoRecentRefine()}
6945+
undoBusy={undoBusy()}
68866946
onClose={() => setShowReRefine(false)}
68876947
/>
68886948
</Show>

‎packages/app/src/pages/session/retrieve-page.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ const TRIGGER_HUE: Record<TriggerRole, number> = {
257257
const KIND_HUE: Record<string, number> = {
258258
workflow_rule: 250,
259259
workflow_gap: 35,
260+
workflow_pattern: 200,
260261
know_how: 155,
261262
constraint_or_policy: 295,
262263
domain_knowledge: 200,
@@ -267,6 +268,7 @@ const KIND_HUE: Record<string, number> = {
267268
const KIND_NAME: Record<string, string> = {
268269
workflow_rule: "流程",
269270
workflow_gap: "缺口",
271+
workflow_pattern: "套路",
270272
know_how: "操作",
271273
constraint_or_policy: "约束",
272274
domain_knowledge: "领域",

0 commit comments

Comments
 (0)