muse-crew 0.14.6 → 0.14.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -141,6 +141,13 @@ async function telemetryFlush() {
141
141
  }
142
142
  async function telemetryEnd(status) {
143
143
  if (!telemetryRunId) return;
144
+ // Room #26 blocker 37: record-run-end rejects any status outside the
145
+ // schema CHECK — and this function swallowed that throw as "non-fatal",
146
+ // leaving the run row 'running' forever. An invalid status is a
147
+ // programmer error: fail loud. Transport errors stay non-fatal.
148
+ if (!["completed", "failed", "parked", "timed_out"].includes(status)) {
149
+ throw new Error("telemetryEnd: invalid status " + JSON.stringify(status) + " — must be completed|failed|parked|timed_out");
150
+ }
144
151
  // Flush any buffered events before recording the end.
145
152
  await telemetryFlush();
146
153
  try {
@@ -495,7 +502,12 @@ while (i < STEPS.length) {
495
502
  );
496
503
  if (!claimResult.claimed) {
497
504
  log("Standing down — task " + taskId + " was already claimed by another run");
498
- await telemetryEnd("duplicate");
505
+ // Room #26 blocker 37: telemetryEnd only accepts schema-valid
506
+ // statuses ("duplicate" violated the CHECK and silently left the run
507
+ // row 'running' forever). The stand-down is a clean exit — the run
508
+ // completed without doing work; the duplicate verdict itself stays in
509
+ // the workflow's returned status and this log line.
510
+ await telemetryEnd("completed");
499
511
  return { status: "duplicate", task_id: taskId, reason: "task already claimed by another run" };
500
512
  }
501
513
  activeSessionId = claimResult.session_id;