summaryrefslogtreecommitdiff
path: root/web/app.js
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-07-05 23:51:58 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-07-05 23:51:58 +0000
commit0e49f91c62ff9977c6a917a6f197adbd7876bbb9 (patch)
treefe992fe8cf887708d084a91f3e79a3bdf1f763a4 /web/app.js
parentcc6b3234c6ad7f0f6acef83f6ccb3556581e80cb (diff)
fix: task submission context cancellation, executions success-rate calc
submitTask was using the inbound HTTP/MCP request context to submit work to the executor pool, so every chatbot/REST-submitted task was cancelled the moment the request returned rather than actually running. Use the server's long-lived lifecycle context instead, matching the other Submit call sites. Separately, computeExecutionStats compared execution state against a lowercase 'completed' literal while the backend always emits uppercase state values, so success rate silently read 0% for every execution. Also treat READY as success alongside COMPLETED, since a top-level task's execution lands at READY on success — COMPLETED requires a later, separate accept step. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VTUSAEKfsPc6WGDq45yPHD
Diffstat (limited to 'web/app.js')
-rw-r--r--web/app.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/web/app.js b/web/app.js
index fc6864c..2f5aacf 100644
--- a/web/app.js
+++ b/web/app.js
@@ -665,7 +665,14 @@ export function computeExecutionStats(executions) {
for (const e of executions) {
const outcome = e.state || 'unknown';
byOutcome[outcome] = (byOutcome[outcome] || 0) + 1;
- if (outcome === 'completed') completed++;
+ // Executions carry the task state machine's uppercase values (see
+ // internal/executor.handleRunResult): a top-level task (no parent) that
+ // succeeds lands its execution at READY, not COMPLETED — COMPLETED is
+ // only set for subtask executions. Both represent a successful run from
+ // the executor's perspective; only the human/chatbot accept step (a
+ // separate, later transition) turns READY into COMPLETED.
+ const normalized = outcome.toUpperCase();
+ if (normalized === 'COMPLETED' || normalized === 'READY') completed++;
totalCost += e.cost_usd || 0;
if (e.duration_ms != null) {
durationSum += e.duration_ms;