/shipwright:error-fix runs instead · from shipwright
Reads open error findings from the task store, fetches Sentry issue details and stack traces, then routes each to auto-fix, review, or plan tasks. Requires prior error-scan run.
This skill never runs in Claude Code
It ships in shipwright at skills/, but /shipwright:error-fix (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
Read the repo's open error PatrolFindings from the task store and, for each New/Regressed
issue, fetch its Sentry detail and latest-event stack trace, route it, and queue it as a
task-store task. Findings are never turned into direct PRs, and the scan-to-fix hand-off is the
store: this skill reads no report file and writes no finding to any repo path.
Only issues already mapped to this repo exist as findings (/error-scan drops unmapped ones
before recording), so there is no unmapped group here and no guessed repo.
Prerequisites:
/error-scan --repo org/repo first so open PatrolFindings exist.SENTRY_ORG and SENTRY_AUTH_TOKEN must be set (issue detail + latest event).Task store setup: If
SHIPWRIGHT_TASK_STORE_URLorSHIPWRIGHT_TASK_STORE_TOKENis missing, invoke/shipwright:task-storefor setup instructions.
--repo org/repo — required. If missing or not org/repo, print and stop:
Usage: /error-fix --repo org/repo [--cron ID] [--dry-run]
Error: --repo is required.
--cron ID — the system-cron id (default error-patrol); used as CRON_ID for reads,
originRef and the recorded run.--dry-run — print what would be routed without writing tasks, findings or a runSet REPO to the --repo value. Queueing is the only mode — no PR mode.
curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/patrol-findings?cronId=$CRON_ID&repo={url-encoded-repo}&status=open&limit=200" | jq '.findings'
Page with nextCursor until exhausted. Skip findings whose taskId is already set. If none
remain, print No open error findings for {repo}. Run /error-scan --repo {repo} first. and
stop. Each finding's fingerprint is the Sentry issue id and its detail holds shortId,
title, culprit, permalink, project, count, userCount, firstSeen, lastSeen.
Order by detail.count descending.
For each finding (issue id = fingerprint):
curl -sS -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/$ISSUE_ID/"
curl -sS -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/$ISSUE_ID/events/latest/"
These are the basis for routing (Step 4) and companion detection (Step 5). Never print or log
$SENTRY_AUTH_TOKEN. If either call fails (non-2xx), skip that issue this run and list it in
the summary as a distinct "Sentry fetch failed" line; never queue a task on incomplete data.
Run each fetched issue through references/pre-filing-verification.md (relative to the plugin
root) — the finding is a snapshot that may be stale. Drop issues whose cited call site no
longer exists or whose gap is already fixed (Items 1–2); an issue that cannot be confirmed by a
literal check routes review, never auto (Item 3); Item 4 (id/branch collisions) is covered
by Step 3 dedup.
Skip when --dry-run. Query active tasks for the repo, URL-encoded, with an explicit
limit=1000, for each of pending, in_progress and blocked (a task awaiting review counts
as active):
curl -sf -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" \
"$SHIPWRIGHT_TASK_STORE_URL/tasks?status=pending&repo={url-encoded-repo}&limit=1000" | jq .
Pagination guard — do not silently proceed with a partial result set. After each call
check nextCursor: if it is a string, re-run the same query with &cursor=<nextCursor>
(opaque; never parse or build one) and merge the .tasks arrays until nextCursor is null.
Never build the "already active" set from an incomplete page set.
Collect tasks with source == "error-fix". A Sentry issue is already active (isIssueActive in
scripts/error-patrol/cluster.ts) when a task id is error-{sentry-issue-id} or starts with
error-{sentry-issue-id}-, or the issue id is in any active error-fix task's
metadata.errorPatrol.memberIssueIds. Skip those issues and print
Skipping {shortId} — task already active. metadata.errorPatrol.relatedIssueIds is a hint
only and never affects dedup. Findings that already carry a taskId were skipped
in Step 1.
After dedup, look for suspected clusters between the issues you are about to file and the open (pending / in_progress / blocked) error-fix tasks gathered in Step 3. Deployed and done tasks are not scanned, so a regression of a closed cluster files normally with no hint.
Use agent judgment with general guidance only — no thresholds. Signals worth weighing: the same normalized message across call sites, event-time proximity (different errors from one incident), a shared dependency. Sentry's grouping docs are useful background for why one cause can split into several issues.
For each suspected pair, write the hint on both tasks via the PATCH /tasks/{id} metadata
merge (already-filed task: patch now; new task: patch after Step 7 creates it). The merge-patch
replaces arrays, so first read the task's current metadata.errorPatrol.relatedIssueIds and
PATCH the de-duplicated union of the existing list and the new hint ids — never just the new id
(mergeRelatedIssueIds in scripts/error-patrol/cluster.ts computes it):
{"metadata": {"errorPatrol": {"relatedIssueIds": ["<existing related ids>", "<other sentry issue id>"]}}}
metadata.errorPatrol holds memberIssueIds (confirmed members, used by dedup) and
relatedIssueIds (suspected, hints). buildRelatedHints in scripts/error-patrol/cluster.ts
turns pairs into both-sided lists. Hints are suggestions: never auto-merge tasks, never move
ids into memberIssueIds here, and a pending relatedIssueIds hint never changes dedup.
When a human confirms a suspected cluster, merge it into one task. No admin UI; Slack triage only.
Survivor: the member task with the oldest createdAt survives. The human checks
in-progress / merged state during triage; this skill applies no status logic. The survivor's
task id never changes.
Survivor metadata: PATCH /tasks/{survivorId} with the metadata merge, setting
memberIssueIds to the union of every member's issue id including the survivor's own
original issue id, and removing the confirmed ids from relatedIssueIds:
{"metadata": {"errorPatrol": {"memberIssueIds": ["<survivor's own issue id>", "<absorbed ids>"], "relatedIssueIds": ["<only still-unconfirmed ids>"]}}}
buildConfirmMetadata in scripts/error-patrol/cluster.ts computes both lists.
Absorbed tasks: cancel each one (PATCH status: "cancelled") with note
Merged into {survivorId}.
Later arrivals: a new issue matching a confirmed cluster files normally with hints on both it and the survivor, and is merged on a later confirm.
After a confirm, dedup (isIssueActive over the active tasks) files nothing for any member id.
Routing follows the three-way contract in docs/task-store.md ("Finding routing"). It is a
judgment call made at runtime from the Sentry detail and stack trace; no event count, user count
or severity threshold ever forces a route (counts only order the queue).
| Route | When | Task shape |
|---|---|---|
| auto | A clear single root cause with an obvious fix: the trace points to one function/module and the fix is a straightforward change (null check, missing await, wrong type, off-by-one, one unhandled edge case), contained to one service | kind: dev, status: pending, hitl: false |
| review | The cause is ambiguous, there is no clear reproduction path, several plausible fixes exist, a product decision is needed ("reject or normalize this input?"), or verification could not be confirmed by a literal check. State the specific question in blockedReason | kind: dev, status: blocked, blockedReason: "needs-review: <question>", hitl: false; a human answers and calls POST /tasks/{id}/unblock |
| plan | The fix is bigger than one task: the trace spans several services or repos, or it needs a design decision first | kind: prd, status: blocked, blockedReason: "needs-plan: <why>", hitl: false, no branch; a human takes it through /shipwright:prd or /shipwright:plan-session and unblocks or cancels it |
Default toward review (or plan if large) when unsure — never toward auto. This skill
never marks a task as human-only: Sentry issues involve no credential rotation, and a plan task waits
as blocked for a human rather than being autonomously planned.
While reading the trace, watch for an instrumentation gap at the call site: missing request/entity context on the event, inconsistent logging shape versus neighboring call sites, or pure noise (an exception captured that is not an actionable error, e.g. a benign condition or a client abort).
If one applies, queue a companion task for the observability fix in addition to the
primary. If the issue is a real bug, queue both; if it is pure noise, queue only the companion.
Route the companion with Step 4: a single obvious call-site fix is auto; a gap recurring
across call sites or services with no shared abstraction to slot into is review (or plan
if large). Set dependencies: ["{companion id}"] on the primary only when it genuinely cannot
land or be verified first.
Print, then stop without writing tasks, findings or a run:
ERROR FIX — DRY RUN ({repo})
Would route {N} tasks:
1. error-{sentry-issue-id} [auto | review | plan] {issue title}
2. error-{sentry-issue-id}-obs [auto | review | plan] (companion) {call site}
No tasks written. Re-run without --dry-run to queue.
Cap at 10 issues per run (highest count first); note the cap if more remain.
{
"id": "error-{sentry-issue-id}",
"title": "Error fix: {issue title}",
"source": "error-fix",
"originKind": "cron",
"originRef": "<CRON_ID>",
"repo": "<REPO>",
"kind": "dev | prd",
"branch": "fix/{task-id-lowercased}",
"layer": "Background",
"status": "pending | blocked",
"blockedReason": "needs-review: <question> (review route) | needs-plan: <why> (plan route)",
"hitl": false,
"description": "<see 7.2>"
}
The companion id is error-{sentry-issue-id}-obs, title Error fix (observability): {call site}, branch fix/{companion-id-lowercased}. The primary id is the finding's
fingerprint prefixed error-. repo is --repo verbatim (already org/repo). slug:
lowercase, hyphens, max 5 words. Plan tasks omit branch; omit blockedReason unless the route
is review or plan.
Enough context for dev-task to fix without re-reading Sentry:
Sentry issue: {shortId} — {issue title}
Link: {permalink}
Culprit: {culprit}
Project: {project} | Repo: {repo} | Route: {auto|review|plan}
Stack trace summary: {condensed top frames — the function/file, not the raw trace}
Root cause hypothesis: {best-effort read}
Fix guidance: {concrete guidance, or the open question for review/plan}
{If a companion was queued: "Related observability task: {id} — {reason}"}
Issue: {sentry-issue-id}
The companion description names the gap, the call site, fix guidance and, when relevant,
Blocks: {primary id}.
TASKS="$(mktemp -d)/error-tasks.json").POST $SHIPWRIGHT_TASK_STORE_URL/tasks/bulk with --data-binary @"$TASKS" (bearer auth,
Content-Type: application/json); delete the temp file afterwards.open:
curl -sf -X POST -H "Authorization: Bearer $SHIPWRIGHT_TASK_STORE_TOKEN" -H "Content-Type: application/json" \
"$SHIPWRIGHT_TASK_STORE_URL/patrol-findings/batch" \
--data '{"cronId":"'"$CRON_ID"'","repo":"'"$REPO"'","findings":[{"fingerprint":"<issue id>","status":"open","taskId":"<task id>"}]}'
This finding-to-task link is what /error-resolve reads; there is no ledger file.bun "${CLAUDE_PLUGIN_ROOT}/scripts/cron-run-recorder.ts" record --cron "$CRON_ID" --repo "$REPO" \
--commit "$(git rev-parse HEAD)" --result "$RESULT"
$RESULT (temp file outside the repo) =
{"outcome":"ok","metrics":{"auto":N,"review":N,"plan":N,"skipped":N}} ("no_op" when
nothing was routed). Pass no legacy-import flag; the import belongs to /error-scan.ERROR FIX — {repo}: {A} auto, {R} review, {P} plan; {S} skipped
{If any skipped: one line each — "Skipped (already active)" or "Skipped (Sentry fetch failed)": {shortId}}
Auto tasks run via the loop; review tasks wait for a human unblock; plan tasks wait for /shipwright:prd | /shipwright:plan-session.
Stop after printing.
taskId are skipped.--repo is required — no fallback to the current directory.hitl: true — every task is auto, review or plan per Step 4; hitl is always false.--dry-run.references/principles.md.$SENTRY_AUTH_TOKEN.--dry-run mutates nothing.What SKILL.md sets; muted values are Claude Code's defaults
27 skills in this plugin
/agent-readinessScore one repo against the agent-readiness catalogue (docs/readiness.md) with the deterministic scorer, post one ReadinessSnapshot and record one run. Requires --repo org/repo. No model judgment, no task creation, no repo files./canary-executionCross-cutting contract for the test-readiness pipeline. Defines how canary-eligible test code runs in two modes — `local` (boot dependencies inline, hit localhost) and `canary` (skip the boot, hit a deployed `TEST_TARGET_URL`) — via a dedicated entry point separate from the local smoke runner. Specifies eligibility rules (read-only or self-cleaning, smoke/E2E only, critical/high tier only, zero DB-dependent tests) and the deploy-gate budget (<60s wall time). Referenced by the inventory, system-design, migration, and roadmap skills.
/duplication-fixRead a repo's ready_to_propose duplication patterns from the task store (PatrolFinding) and queue them as routed task-store tasks (auto, review or plan), one task per pattern, each carrying a strangler-fig (build -> coexist -> eliminate) execution plan. Requires --repo org/repo and duplication-scan to have run first./duplication-scanDiscover emerging duplicate/similar code patterns in one repo via judgment-driven comparison, track them across runs in the task store's PatrolFinding ledger, and list only stabilized open patterns in docs/patrols/duplication.md. Requires --repo org/repo. Report only — no code changes./entropy-fixRead the entropy-scan handoff for one repo and route PR-worthy violations as task-store tasks (auto / review / plan), one task per rule. Requires --repo org/repo and /entropy-scan to have run first./entropy-scanScan one repo for principle deviations and write docs/patrols/entropy.md. Requires --repo org/repo. Report only — no code changes.npx claudepluginhub app-vitals/shipwright --plugin shipwrightOther plugins' skills for the same job