feat(agent): budget reminders, usage while waiting, budget-exceeded status and dedupe

- tool results carry a budget reminder near limits; text before the last tool
  call is dropped as report when cut by budget/abort
- usage persisted when a run suspends, so waiting sessions show spent tokens
- task page shows budget_exceeded via business.outcome instead of completed
- budget-exceeded decisions merge by root cause (decision / schedule / goal
  template); new summaries added to investigate allowlist

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 01:58:28 +08:00
1 parent 4cd9ec8390
commit a00a9eaf5d
14 files changed
+205 -21

No files matched your search

+16
View File
@@ -69,6 +69,22 @@ const RUN_STATUS: Record<string, { label: string; tone: StatusTone }> = {
canceled: { label: "已取消", tone: "warning" },
};
export const runStatus = (s: string) => RUN_STATUS[s] ?? { label: s, tone: "neutral" as StatusTone };
/**
* 任务行状态:引擎 run 正常结束但业务结果不是成功时以业务结果为准(Agent 会话超出预算 / 失败 / 已停止),
* 不把"引擎跑完"显示成「完成」
*/
const OUTCOME_STATUS: Record<string, { label: string; tone: StatusTone }> = {
budget_exceeded: { label: "超出预算", tone: "warning" },
failed: { label: "失败", tone: "destructive" },
cancelled: { label: "已停止", tone: "warning" },
waiting: { label: "等待", tone: "neutral" },
};
export function engineRunStatus(r: Pick<EngineRun, "status" | "business">) {
const outcome = r.business?.outcome;
if (outcome && (r.status === "completed" || r.status === "succeeded") && OUTCOME_STATUS[outcome])
return OUTCOME_STATUS[outcome];
return runStatus(r.status);
}
export const RUN_STATUS_OPTIONS = ["pending", "running", "completed", "failed", "canceled"].map((value) => ({
value,
label: runStatus(value).label,