muse-crew 0.7.5 → 0.7.6
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/package.json
CHANGED
|
@@ -13,7 +13,7 @@ You are the dispatch trigger for Muse Crew. Run the authoritative dispatcher wor
|
|
|
13
13
|
WHERE w.created_at > now() - interval '15 minutes' AND w.status = 'failed'
|
|
14
14
|
ORDER BY w.created_at DESC
|
|
15
15
|
```
|
|
16
|
-
- For each failed run, record it in the crew DB (correlates
|
|
16
|
+
- For each failed run, record it in the crew DB (correlates via the durable platform run -> task mapping written at acknowledge time; timestamp proximity is the fallback for pre-mapping runs):
|
|
17
17
|
`node {crewHome}/lib/crew-api.js --crew-home {crewHome} record-platform-failure --json '{"platform_run_id": "<run_id>", "error_message": "<error>", "platform_created_at": "<created_at>"}'`
|
|
18
18
|
- Then retry each failure (clears stale reservation, re-queues task, or parks after 3 attempts):
|
|
19
19
|
`node {crewHome}/lib/crew-api.js --crew-home {crewHome} retry-platform-failure --json '{"platform_run_id": "<run_id>"}'`
|
|
@@ -36,24 +36,21 @@ You are the dispatch trigger for Muse Crew. Run the authoritative dispatcher wor
|
|
|
36
36
|
|
|
37
37
|
If the dispatcher returned no claims or the claims array is empty, report: NO_DISPATCH and exit.
|
|
38
38
|
|
|
39
|
-
5. **Monitor launched workflows
|
|
40
|
-
- For each launched run_id, poll its status every
|
|
39
|
+
5. **Monitor launched workflows within this tick (tick-bounded — 2026-09-13):** The platform ties async workflow subagent authorization to the launcher's lifetime: when THIS tick ends (120s timeout), any still-running workflow's next `agent()` call may fail with "subagent bootstrap is no longer authorized" / "subagent reservation owner is terminal". You cannot prevent that by staying alive — this tick WILL end at 120s, so a "stay alive until terminal" monitor is fiction. The design that survives launcher death is per-tick recovery: watch while you live, and let the next tick's Step 0 continue through the durable platform run -> task mapping.
|
|
40
|
+
- For each launched run_id, poll its status every ~20 seconds via muse.db (you have ~100s of monitoring budget — leave margin before the 120s kill):
|
|
41
41
|
```sql
|
|
42
42
|
SELECT status, error FROM runtime.workflow_runs WHERE run_id = '<run_id>'
|
|
43
43
|
```
|
|
44
44
|
- **If status is `completed`:** Done. Log success and stop monitoring this run.
|
|
45
45
|
- **If status is `failed`:** Check if it's a platform `agent()` error (error contains "subagent bootstrap", "reservation owner is terminal", "bootstrap was cancelled", or "workflow agent call failed"):
|
|
46
|
-
- **Platform error:** Record it and retry:
|
|
47
|
-
1. `node {crewHome}/lib/crew-api.js --crew-home {crewHome} record-platform-failure --json '{"platform_run_id": "<run_id>", "error_message": "<error>"}'`
|
|
48
|
-
2. `node {crewHome}/lib/crew-api.js --crew-home {crewHome} retry-platform-failure --json '{"platform_run_id": "<run_id>"}'`
|
|
49
|
-
3. If the retry result says `requeued` and you have retries remaining (max 3 per task per tick):
|
|
46
|
+
- **Platform error:** Record it and retry immediately (same two commands as Step 0). If the retry says `requeued` AND you have at least ~40s left in this tick AND retries remain (max 3 per task per tick):
|
|
50
47
|
- Re-acquire the reservation: `node {crewHome}/lib/crew-api.js --crew-home {crewHome} reserve-dispatch --json '{"task_id": "<task_id>"}'`
|
|
51
48
|
- If `acquired` is true, re-launch via workflow_launch_async with the same scriptPath and args, acknowledge with the new run_id, and continue monitoring the NEW run_id.
|
|
52
49
|
- If `acquired` is false, stop — another dispatcher claimed it.
|
|
53
|
-
|
|
50
|
+
If the retry result says `parked` (3 attempts exhausted), stop monitoring this task.
|
|
54
51
|
- **Task-level error (not a platform error):** The workflow's own error handling applies. Stop monitoring this run.
|
|
55
52
|
- **If status is `running` or `paused`:** Continue polling.
|
|
56
|
-
- **
|
|
53
|
+
- **Tick end:** At ~100s elapsed, stop monitoring and exit. Do NOT try to outlive the 120s timeout — the monitor's job is not to prevent launcher death (impossible) but to recover from it fast. Anything that dies after you leave is caught by the next tick's Step 0 via the mapping, at most ~3 minutes later. That is the designed recovery path, not a fallback.
|
|
57
54
|
- When all launched workflows are terminal or retry-exhausted, exit silently.
|
|
58
55
|
|
|
59
56
|
6. Exit silently.
|