Can't retry a user message when dev server is running (vibe-kanban) (#937)

* Done! The fix is complete and all checks pass. Here's what changed:

**Summary:**
- Replaced local `anyRunning` check with `isAttemptRunning` from `useAttemptExecution`
- Removed unused `useMemo` import
- Updated tooltip text for clarity

The retry button now correctly allows retrying when only the dev server is running, while still blocking during actual task executions (codingagent, setupscript, cleanupscript).

* Cleanup script changes for task attempt 80246ab7-5ae8-4b09-8020-839cca417fb6

* Update frontend/src/hooks/useProcessRetry.ts

Co-authored-by: Solomon <abcpro11051@disroot.org>

---------

Co-authored-by: Solomon <abcpro11051@disroot.org>
This commit is contained in:
Louis Knight-Webb
2025-10-06 12:49:20 +01:00
committed by GitHub
parent 73f49cae9f
commit 7bf4b12ddb

View File

@@ -1,5 +1,5 @@
// hooks/useProcessRetry.ts
import { useCallback, useMemo, useState } from 'react';
import { useCallback, useState } from 'react';
import { useAttemptExecution } from '@/hooks/useAttemptExecution';
import { useBranchStatus } from '@/hooks/useBranchStatus';
import { attemptsApi, executionProcessesApi } from '@/lib/api';
@@ -17,17 +17,11 @@ export function useProcessRetry(attempt: TaskAttempt | undefined) {
const attemptId = attempt?.id;
// Fetch attempt + branch state the same way your component did
const { attemptData } = useAttemptExecution(attemptId);
const { attemptData, isAttemptRunning } = useAttemptExecution(attemptId);
useBranchStatus(attemptId);
const [busy, setBusy] = useState(false);
// Any process running at all?
const anyRunning = useMemo(
() => (attemptData.processes || []).some((p) => p.status === 'running'),
[attemptData.processes?.map((p) => p.status).join(',')]
);
// Convenience lookups
const getProcessById = useCallback(
(pid: string): ExecutionProcess | undefined =>
@@ -43,14 +37,15 @@ export function useProcessRetry(attempt: TaskAttempt | undefined) {
(pid: string) => {
const proc = getProcessById(pid);
const isRunningProc = proc?.status === 'running';
const disabled = busy || anyRunning || isRunningProc;
const disabled = busy || isAttemptRunning || isRunningProc;
let reason: string | undefined;
if (isRunningProc) reason = 'Finish or stop this run to retry.';
else if (anyRunning) reason = 'Cannot retry while a process is running.';
else if (isAttemptRunning)
reason = 'Cannot retry while an agent is running.';
else if (busy) reason = 'Retry in progress.';
return { disabled, reason };
},
[busy, anyRunning, getProcessById]
[busy, isAttemptRunning, getProcessById]
);
/**