muse-crew 0.17.0 → 0.17.1
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.
- package/lib/crew-api.js +5 -1
- package/package.json +1 -1
package/lib/crew-api.js
CHANGED
|
@@ -1338,10 +1338,14 @@ commands["record-worker-run"] = (db, args) => {
|
|
|
1338
1338
|
return { ok: true, id: row.id, status: "running" };
|
|
1339
1339
|
}
|
|
1340
1340
|
if (args.id === undefined || args.id === null) throw usageError("id is required to finish a run.");
|
|
1341
|
-
db.prepare(
|
|
1341
|
+
const result = db.prepare(
|
|
1342
1342
|
`UPDATE worker_runs SET status = ?, error = ?, ended_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
|
1343
1343
|
WHERE id = ? AND status = 'running'`
|
|
1344
1344
|
).run(status, args.error || null, args.id);
|
|
1345
|
+
// Terminal rows are immutable (R-2): a finish against an already-terminal
|
|
1346
|
+
// (or missing) row updates zero rows — report the silent no-op explicitly
|
|
1347
|
+
// so callers can distinguish "I closed it" from "it was already closed".
|
|
1348
|
+
if (result.changes === 0) return { ok: true, noop: true };
|
|
1345
1349
|
return { ok: true, id: args.id, status };
|
|
1346
1350
|
};
|
|
1347
1351
|
|
package/package.json
CHANGED