fix(assistant): close review gaps in delivery and action recovery
Address PR4 comments 66-69 with safe delivery retries, capacity stops, preserved effect evidence and stale proposal rejection. Prevent archived queue snapshots from resurrecting cancelled reminders.
This commit is contained in:
1 parent
1d5dcead84
commit
5ceffb935a
24 files changed
+1425
-125
No files matched your search
@@ -369,10 +369,13 @@ class AssistantService {
|
||||
throw fail('操作审计不可用,未执行。', 503);
|
||||
}
|
||||
const task = (async () => {
|
||||
let result;
|
||||
let operationStarted = false;
|
||||
try {
|
||||
let result;
|
||||
const runner = action.kind === 'repair_code' ? this.repairRunner(principal) : null;
|
||||
operationStarted = true;
|
||||
if (action.kind === 'repair_code')
|
||||
result = await this.repairRunner(principal).run({
|
||||
result = await runner.run({
|
||||
actor: principal.user.id,
|
||||
isAdmin: true,
|
||||
files: action.files,
|
||||
@@ -445,23 +448,36 @@ class AssistantService {
|
||||
Object.assign(a, { status: 'success', result, finishedAt: new Date().toISOString() }),
|
||||
);
|
||||
} catch (e) {
|
||||
const uncertain = operationStarted || e.mutationApplied === true;
|
||||
const status = uncertain ? 'needs_review' : 'error';
|
||||
const message = uncertain
|
||||
? '操作可能已产生影响,请到原功能页面核实;请勿重复执行。'
|
||||
: e.status
|
||||
? redact(e.message)
|
||||
: '操作未完成,请核实结果。';
|
||||
try {
|
||||
this.record(
|
||||
action.id,
|
||||
principal,
|
||||
'execute',
|
||||
'error',
|
||||
redact(e.status ? e.message : '操作失败,请核验结果'),
|
||||
status,
|
||||
JSON.stringify({
|
||||
message,
|
||||
...(result !== undefined ? { result } : {}),
|
||||
}),
|
||||
);
|
||||
} catch {}
|
||||
this.store.action(conversationId, principal.user.id, actionId, (a) =>
|
||||
Object.assign(a, {
|
||||
status: 'error',
|
||||
error: redact(e.status ? e.message : '操作未完成,请在原功能页面核实结果。'),
|
||||
status,
|
||||
error: message,
|
||||
...(result !== undefined ? { result } : {}),
|
||||
finishedAt: new Date().toISOString(),
|
||||
}),
|
||||
);
|
||||
throw fail(e.status ? redact(e.message) : '操作未完成,请核实结果。', e.status || 502);
|
||||
throw Object.assign(fail(message, e.status || 502), {
|
||||
outcome: uncertain ? 'uncertain' : 'rejected',
|
||||
});
|
||||
}
|
||||
})();
|
||||
this.actions.add(task);
|
||||
|
||||
Reference in new issue
Block a user