返回 CodeWhale
SKILL.md
1 ---
2 name: fleet-manager
3 description: Use when managing, triaging, restarting, escalating, or summarizing Codewhale fleet runs and workers.
4 metadata:
5 short-description: Triage Codewhale fleet runs
6 ---
7
8 # Fleet Manager
9
10 Use this skill when acting as a manager agent for Codewhale fleet runs.
11 Your job is to classify worker state, choose the narrowest safe typed action,
12 and leave a ledgered receipt or a safe escalation draft.
13
14 ## Authority Boundary
15
16 - Prefer typed fleet surfaces over shell spelunking: `codewhale fleet status`,
17 `inspect`, `logs`, `artifacts`, `interrupt`, `restart`, `resume`, `stop`
18 (stop requires `--all`), and the Runtime API endpoints.
19 - Do not read `.codewhale/fleet.jsonl`, host logs, or remote files directly
20 unless the typed command or API is missing required evidence.
21 - Do not send Slack, webhook, PagerDuty, email, or chat messages unless the
22 user or run config explicitly authorizes sending. Draft the message instead.
23 - Never include secrets, tokens, webhook URLs, routing keys, full prompts, or
24 oversized logs in a summary or escalation.
25
26 ## Triage Loop
27
28 1. Identify the run and worker from the user request, run receipt, or fleet
29 status output. If no worker is named, start with `codewhale fleet status`.
30 2. Inspect the worker with `codewhale fleet inspect <worker-id>` or the
31 matching Runtime API worker endpoint (`GET /v1/fleet/workers/{worker_id}`).
32 3. Review bounded evidence with `codewhale fleet logs <worker-id>` and
33 `codewhale fleet artifacts <worker-id>`, or the Runtime API equivalents
34 (`GET /v1/fleet/runs/{run_id}/receipts/{task_id}/evidence` and
35 `GET /v1/fleet/runs/{run_id}/events/replay`). Summarize artifact refs,
36 not full payloads.
37 4. Classify the state before acting:
38 - `transient failure`: transport error, timeout, stale heartbeat, host
39 unavailable, or retryable provider/network failure.
40 - `task failure`: worker completed the task but the result is wrong,
41 missing required artifacts, or reports a domain error.
42 - `verifier failure`: scorer/verifier failed or disagrees with the worker
43 result.
44 - `needs-human`: missing authority, unsafe secret boundary, destructive
45 action, repeated restart exhaustion, ambiguous product decision, or
46 conflict between artifacts and verifier.
47 - `not startable`: the issue or task has no `agent-ready` grant from a
48 maintainer; do not pick it up or dispatch a worker against it.
49 5. Choose one typed action:
50 - run has orphaned leases after a manager restart:
51 `codewhale fleet resume <run-id>` (idempotent reconcile).
52 - transient and retry budget remains: `codewhale fleet restart <worker-id>`.
53 - transient but unsafe to retry: draft escalation and mark needs-human.
54 - task failure: preserve artifacts, summarize the failure, and avoid restart
55 unless the task spec says retrying can produce new evidence.
56 - verifier failure: inspect scorer inputs and artifacts, then escalate if the
57 verifier cannot be corrected through a typed action.
58 - needs-human: do not restart automatically; draft a concise escalation.
59 6. Record the result in the response: classification, action taken or drafted,
60 evidence commands, artifact refs, and next owner.
61
62 ## Restart vs Escalate
63
64 Restart only when all of these are true:
65
66 - the failure is likely transient,
67 - the task is idempotent or the run policy allows retry,
68 - retry budget remains,
69 - no secret, permission, or destructive action boundary is involved, and
70 - the previous attempt produced enough receipt data to explain the restart.
71
72 Escalate when any of these are true:
73
74 - restart budget is exhausted,
75 - the worker requests secrets or new authority,
76 - artifacts indicate data loss, corruption, or destructive side effects,
77 - the verifier and task result conflict in a way you cannot resolve from typed
78 evidence,
79 - the same failure repeats after a restart, or
80 - a human product or release decision is required.
81
82 ## Safe Escalation Draft
83
84 Use this shape for Slack/PagerDuty drafts. Keep logs to three short lines or an
85 artifact ref.
86
87 ```text
88 Codewhale fleet needs attention
89 Run: <run-id>
90 Worker: <worker-id>
91 Task: <task-id or unknown>
92 Classification: <transient failure | task failure | verifier failure | needs-human>
93 Reason: <one sentence, no secrets>
94 Latest typed evidence: codewhale fleet inspect <worker-id>; codewhale fleet artifacts <worker-id>
95 Safe log excerpt: <3 lines max or "see artifact <ref>">
96 Requested decision: <restart approval | verifier review | task owner review | permission decision>
97 ```
98
99 ## Post-Run Receipt
100
101 End every Fleet Manager response with a compact receipt:
102
103 ```text
104 Fleet receipt
105 Run: <run-id>
106 Workers checked: <count/list>
107 Classification: <state>
108 Action: <restart/interrupt/stop/resume/escalation draft/no-op>
109 Ledger expectation: <typed action should be recorded | draft only, no send>
110 Artifacts reviewed: <refs>
111 Follow-up owner: <manager | task owner | human>
112 ```
113
113 lines MARKDOWN