fix: address greptile feedback
This commit is contained in:
parent
22b38b1956
commit
a0a28fce38
4 changed files with 37 additions and 3 deletions
|
|
@ -607,6 +607,9 @@ function isTrackedLocalChildProcessAdapter(adapterType: string) {
|
||||||
return SESSIONED_LOCAL_ADAPTERS.has(adapterType);
|
return SESSIONED_LOCAL_ADAPTERS.has(adapterType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A positive liveness check means some process currently owns the PID.
|
||||||
|
// On Linux, PIDs can be recycled, so this is a best-effort signal rather
|
||||||
|
// than proof that the original child is still alive.
|
||||||
function isProcessAlive(pid: number | null | undefined) {
|
function isProcessAlive(pid: number | null | undefined) {
|
||||||
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return false;
|
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return false;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,19 @@ describe("assignee selection helpers", () => {
|
||||||
),
|
),
|
||||||
).toBe("user:board-user");
|
).toBe("user:board-user");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("skips the current agent when choosing a suggested commenter assignee", () => {
|
||||||
|
expect(
|
||||||
|
suggestedCommentAssigneeValue(
|
||||||
|
{ assigneeUserId: "board-user" },
|
||||||
|
[
|
||||||
|
{ authorUserId: "board-user" },
|
||||||
|
{ authorAgentId: "agent-self" },
|
||||||
|
{ authorAgentId: "agent-123" },
|
||||||
|
],
|
||||||
|
null,
|
||||||
|
"agent-self",
|
||||||
|
),
|
||||||
|
).toBe("agent:agent-123");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,14 @@ export function suggestedCommentAssigneeValue(
|
||||||
issue: CommentAssigneeSuggestionInput,
|
issue: CommentAssigneeSuggestionInput,
|
||||||
comments: CommentAssigneeSuggestionComment[] | null | undefined,
|
comments: CommentAssigneeSuggestionComment[] | null | undefined,
|
||||||
currentUserId: string | null | undefined,
|
currentUserId: string | null | undefined,
|
||||||
|
currentAgentId?: string | null | undefined,
|
||||||
): string {
|
): string {
|
||||||
if (comments && comments.length > 0 && currentUserId) {
|
if (comments && comments.length > 0 && (currentUserId || currentAgentId)) {
|
||||||
for (let i = comments.length - 1; i >= 0; i--) {
|
for (let i = comments.length - 1; i >= 0; i--) {
|
||||||
const comment = comments[i];
|
const comment = comments[i];
|
||||||
if (comment.authorAgentId) return assigneeValueFromSelection({ assigneeAgentId: comment.authorAgentId });
|
if (comment.authorAgentId && comment.authorAgentId !== currentAgentId) {
|
||||||
|
return assigneeValueFromSelection({ assigneeAgentId: comment.authorAgentId });
|
||||||
|
}
|
||||||
if (comment.authorUserId && comment.authorUserId !== currentUserId) {
|
if (comment.authorUserId && comment.authorUserId !== currentUserId) {
|
||||||
return assigneeValueFromSelection({ assigneeUserId: comment.authorUserId });
|
return assigneeValueFromSelection({ assigneeUserId: comment.authorUserId });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -497,6 +497,8 @@ export function Inbox() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [retryingRunIds, setRetryingRunIds] = useState<Set<string>>(new Set());
|
||||||
|
|
||||||
const retryRunMutation = useMutation({
|
const retryRunMutation = useMutation({
|
||||||
mutationFn: async (run: HeartbeatRun) => {
|
mutationFn: async (run: HeartbeatRun) => {
|
||||||
const payload: Record<string, unknown> = {};
|
const payload: Record<string, unknown> = {};
|
||||||
|
|
@ -517,11 +519,22 @@ export function Inbox() {
|
||||||
}
|
}
|
||||||
return { newRun: result, originalRun: run };
|
return { newRun: result, originalRun: run };
|
||||||
},
|
},
|
||||||
|
onMutate: (run) => {
|
||||||
|
setRetryingRunIds((prev) => new Set(prev).add(run.id));
|
||||||
|
},
|
||||||
onSuccess: ({ newRun, originalRun }) => {
|
onSuccess: ({ newRun, originalRun }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(originalRun.companyId) });
|
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(originalRun.companyId) });
|
||||||
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(originalRun.companyId, originalRun.agentId) });
|
queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(originalRun.companyId, originalRun.agentId) });
|
||||||
navigate(`/agents/${originalRun.agentId}/runs/${newRun.id}`);
|
navigate(`/agents/${originalRun.agentId}/runs/${newRun.id}`);
|
||||||
},
|
},
|
||||||
|
onSettled: (_data, _error, run) => {
|
||||||
|
if (!run) return;
|
||||||
|
setRetryingRunIds((prev) => {
|
||||||
|
const next = new Set(prev);
|
||||||
|
next.delete(run.id);
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [fadingOutIssues, setFadingOutIssues] = useState<Set<string>>(new Set());
|
const [fadingOutIssues, setFadingOutIssues] = useState<Set<string>>(new Set());
|
||||||
|
|
@ -739,7 +752,7 @@ export function Inbox() {
|
||||||
issueLinkState={issueLinkState}
|
issueLinkState={issueLinkState}
|
||||||
onDismiss={() => dismiss(`run:${item.run.id}`)}
|
onDismiss={() => dismiss(`run:${item.run.id}`)}
|
||||||
onRetry={() => retryRunMutation.mutate(item.run)}
|
onRetry={() => retryRunMutation.mutate(item.run)}
|
||||||
isRetrying={retryRunMutation.isPending}
|
isRetrying={retryingRunIds.has(item.run.id)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue