一键导入
register-retry-error
Register a new retryable error pattern in the error retry registry. Use when encountering errors that should trigger automatic retry.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Register a new retryable error pattern in the error retry registry. Use when encountering errors that should trigger automatic retry.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Structured adversarial analysis protocol. Quick single-agent modes (challenge, panel, pre-mortem, red team) plus a decision-review protocol where one agent proposes, one critiques, the proposer revises, and a binding/advisory judge panel decides ADOPT/REVISE/REJECT/ESCALATE.
Track and verify custom patches to external dependencies. Register, audit, and verify patches survive updates. CRUD lifecycle for patch entries with post-update verification.
Copy the current OpenCode session ID to clipboard. Triggers on /session-id.
Atlas-level review orchestration handler. Manages the complete review workflow — delegates review tasks, processes findings, enforces cycle limits, and prevents loops. Loaded by the orchestrator when REVIEW-ENFORCER fires.
Automated code review agent that analyzes git diffs and returns structured findings in CRITICAL/WARNING/INFO format. Loaded by sub-agents tasked with reviewing code changes.
Safety-critical operational pipeline for analyzing and executing OpenCode/OMO updates with explicit approval, patch preservation, rollback capability, and evidence-state discipline.
| name | register-retry-error |
| description | Register a new retryable error pattern in the error retry registry. Use when encountering errors that should trigger automatic retry. |
Triggers: /register-retry-error, register retry error, add retry pattern
When invoked with /register-retry-error, request or receive:
Before proceeding, validate the provided pattern:
try {
new RegExp(pattern)
} catch (e) {
throw new Error(`Invalid regex pattern: ${e.message}`)
}
MUST: Reject invalid patterns immediately with clear error message.
Create a unique id from the description:
^[a-z0-9]([a-z0-9-]*[a-z0-9])?$Example:
Read the current registry file: ~/.config/opencode/retry-errors.json
MUST verify:
id (duplicate key)pattern string (duplicate pattern)If duplicates found, reject with reason: "Entry with id '{id}' already exists" or "Pattern already registered"
Create the new entry object with ALL required fields:
{
"id": "generated-from-description",
"pattern": "provided-regex-string",
"match_type": "regex",
"max_retries": 3,
"backoff_ms": [1000, 6000, 36000],
"retry_after_tool_execution": false,
"description": "provided-description",
"added_by": "operator",
"added_at": "YYYY-MM-DD (current date in ISO format)"
}
Replace default values with user-provided values where specified. Important: Always use the current date in ISO format (YYYY-MM-DD) for added_at, computed at the time of registration.
Verify: backoff_ms.length === max_retries (critical constraint)
MUST USE ATOMIC WRITE to prevent JSON corruption:
const fs = require('fs');
const path = require('path');
const os = require('os');
const registryPath = path.join(os.homedir(), '.config', 'opencode', 'retry-errors.json');
const tempPath = registryPath + '.tmp';
// 1. Read current registry
const registry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
// 2. Append new entry
registry.errors.push(newEntry);
// 3. Write to temp file
fs.writeFileSync(tempPath, JSON.stringify(registry, null, 2), 'utf8');
// 4. Rename atomically (atomic on POSIX systems)
fs.renameSync(tempPath, registryPath);
CRITICAL: Never write directly to the registry file. Always:
On success, report:
✓ Successfully registered new error pattern
ID: {generated-id}
Pattern: {pattern}
Max Retries: {max_retries}
Backoff: {backoff_ms}
Description: {description}
Added At: {timestamp}
The new pattern will take effect on the next error event (hot-reload).
| Rule | Action |
|---|---|
| Invalid regex | Reject with error message, do NOT write |
| Duplicate id | Reject, suggest alternative id |
| Duplicate pattern | Reject, warn that pattern is already registered |
| Backoff length mismatch | Reject: backoff_ms.length must equal max_retries |
| Missing required fields | Reject: list missing fields |
| File write fails | Reject: include error message, do NOT corrupt registry |
| Registry file missing | Reject: registry file must exist (created by task-1) |
| Registry file invalid JSON | Reject: report JSON parse error, do NOT overwrite |
"SSE read timed out", "Connection refused"\., \(, \), \[, \]i flag)timeout, error, failed.* that matches everything)Input:
SSE read timed outOutput:
ID: sse-read-timeout
Pattern: SSE read timed out
Max Retries: 3
Backoff: [1000, 6000, 36000]
Added At: {current-date}
Input:
rate limit.*exceeded|too many requestsOutput:
ID: provider-rate-limit-exceeded
Pattern: rate limit.*exceeded|too many requests
Max Retries: 4
Backoff: [2000, 10000, 30000, 60000]
Description: Provider rate limit exceeded on API call
Added At: {current-date}
| Violation | Severity | Reason |
|---|---|---|
| Accept raw JSON input | CRITICAL | Must parse and validate parameters individually |
| Allow overwriting existing entries | CRITICAL | Duplicates must be rejected |
| Skip regex validation | CRITICAL | Invalid patterns break the plugin at runtime |
| Direct file write (no temp file) | CRITICAL | Risks JSON corruption on write failure |
| Add edit/delete/list functionality | CRITICAL | v1 is register-only; no CRUD beyond append |
| Allow patterns that match permanent errors | HIGH | Would cause unnecessary retries on fatal errors |
| Generic catch-all patterns | HIGH | Would retry errors that shouldn't be retried |
This skill is discoverable by:
/register-retry-error