From 16ff7ca46bfb4af44af488fa95bd3f8e981f4db2 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 16 Mar 2026 04:24:15 +0000 Subject: feat: improve next-task selection and rejection UX - next-task script: exclude rejected tasks from fallback selection; only pick PENDING tasks with no rejection comment and no prior executions, or QUEUED tasks (e.g. BUDGET_EXCEEDED retries) - web/app.js: prompt for optional rejection comment when rejecting a task, passing it through to the API instead of always sending an empty string Co-Authored-By: Claude Sonnet 4.6 --- web/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'web/app.js') diff --git a/web/app.js b/web/app.js index 0e13543..e1782dd 100644 --- a/web/app.js +++ b/web/app.js @@ -996,11 +996,11 @@ async function acceptTask(taskId) { return res.json(); } -async function rejectTask(taskId) { +async function rejectTask(taskId, comment) { const res = await fetch(`${API_BASE}/api/tasks/${taskId}/reject`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ comment: '' }), + body: JSON.stringify({ comment: comment || '' }), }); if (!res.ok) { let msg = `HTTP ${res.status}`; @@ -1030,13 +1030,16 @@ async function handleAccept(taskId, btn, footer) { } async function handleReject(taskId, btn, footer) { + const comment = prompt('Reason for rejection (optional):', ''); + if (comment === null) return; // User cancelled prompt + btn.disabled = true; btn.textContent = 'Rejecting…'; const prev = footer.querySelector('.task-error'); if (prev) prev.remove(); try { - await rejectTask(taskId); + await rejectTask(taskId, comment); await poll(); } catch (err) { btn.disabled = false; -- cgit v1.2.3