mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-02 20:01:51 +08:00
fix(findings): address Grok review r1 (Codex gpt-6-astra)
Authored by Codex CLI (gpt-6-astra, reasoning high) after 3 gpt-6.1-sol capacity failures. Scope sweep aggregates per suggestion, veto only kept suggestion members on exclusion, refresh finding-case tool schemas on existing DBs, clarify weak tier wording, keep card state across reloads, filter stale exclusions, always reload after confirm, guard task-switch toasts.
This commit is contained in:
1 parent
09e90b4170
commit
5b342f9f78
6 files changed
+109
-24
No files matched your search
@@ -196,15 +196,25 @@ function FindingMergeSuggestionCard({
|
||||
}) {
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
const [busy, setBusy] = React.useState(false);
|
||||
const ids = Array.isArray(s.finding_ids) && s.finding_ids.length > 0 ? s.finding_ids : [s.left_id, s.right_id];
|
||||
const ids = React.useMemo(
|
||||
() => (Array.isArray(s.finding_ids) && s.finding_ids.length > 0 ? s.finding_ids : [s.left_id, s.right_id]),
|
||||
[s.finding_ids, s.left_id, s.right_id],
|
||||
);
|
||||
const [excluded, setExcluded] = React.useState<string[]>([]);
|
||||
const included = ids.filter((id) => !excluded.includes(id));
|
||||
React.useEffect(() => {
|
||||
setExcluded((current) => {
|
||||
const next = current.filter((id) => ids.includes(id));
|
||||
return next.length === current.length ? current : next;
|
||||
});
|
||||
}, [ids]);
|
||||
const validExcluded = excluded.filter((id) => ids.includes(id));
|
||||
const included = ids.filter((id) => !validExcluded.includes(id));
|
||||
async function resolve(accept: boolean) {
|
||||
if (busy) return;
|
||||
if (accept && included.length < 2) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
await onResolve(s, accept, accept ? excluded : []);
|
||||
await onResolve(s, accept, accept ? validExcluded : []);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -294,13 +304,20 @@ export function FindingCaseReviewPanel({ taskId, onChange }: { taskId?: string;
|
||||
const taskKey = taskId ?? "";
|
||||
const taskKeyRef = React.useRef(taskKey);
|
||||
taskKeyRef.current = taskKey;
|
||||
const previousTaskKey = React.useRef(taskKey);
|
||||
React.useEffect(() => {
|
||||
if (previousTaskKey.current === taskKey) return;
|
||||
previousTaskKey.current = taskKey;
|
||||
setSuggestions([]);
|
||||
setRuns([]);
|
||||
setError("");
|
||||
}, [taskKey]);
|
||||
React.useEffect(() => {
|
||||
const seq = ++requestSeq.current;
|
||||
const requestedTask = taskKey;
|
||||
void reload;
|
||||
let active = true;
|
||||
let timer: ReturnType<typeof setTimeout>;
|
||||
setSuggestions([]);
|
||||
async function load() {
|
||||
try {
|
||||
const [s, r] = await Promise.all([api.findingCaseSuggestions(taskId), api.findingCaseReviewRuns()]);
|
||||
@@ -328,18 +345,23 @@ export function FindingCaseReviewPanel({ taskId, onChange }: { taskId?: string;
|
||||
const requestedTask = taskKey;
|
||||
try {
|
||||
const result = await api.resolveFindingCaseSuggestion(s.id, accept, excludeIds);
|
||||
if (seq !== requestSeq.current || requestedTask !== taskKeyRef.current) return;
|
||||
setSuggestions((v) => v.filter((x) => x.id !== s.id));
|
||||
setReload((v) => v + 1);
|
||||
if (accept && result.case_id !== "0") {
|
||||
toast.success("已归并,请进入文件夹生成统一报告");
|
||||
} else {
|
||||
toast.success("已否决,不会自动再次归并");
|
||||
if (requestedTask === taskKeyRef.current) {
|
||||
setReload((v) => v + 1);
|
||||
if (seq === requestSeq.current) {
|
||||
setSuggestions((v) => v.filter((x) => x.id !== s.id));
|
||||
if (accept && result.case_id !== "0") {
|
||||
toast.success("已归并,请进入文件夹生成统一报告");
|
||||
} else {
|
||||
toast.success("已否决,不会自动再次归并");
|
||||
}
|
||||
onChange?.();
|
||||
}
|
||||
}
|
||||
onChange?.();
|
||||
} catch (e) {
|
||||
if (seq === requestSeq.current && requestedTask === taskKeyRef.current) setReload((v) => v + 1);
|
||||
toast.error((e as Error).message);
|
||||
if (requestedTask === taskKeyRef.current) {
|
||||
setReload((v) => v + 1);
|
||||
if (seq === requestSeq.current) toast.error((e as Error).message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user