Reject Work Run Corrections

Use this page when a permitted reviewer rejects a pending correction because the inspected evidence does not support applying it. Rejection preserves metadata-only history; it must not publish raw rejected correction text. For operator context, read Recording corrections. If the reviewer needs a follow-up correction before deciding, use Request retry.

Current status: the route shape below is the public docs path for reject review actions. Exact request fields, auth scopes, expected-version member names, and SDK method names remain pending until the platform-owned OpenAPI snapshot and SDK package evidence exist.

Raw HTTP Reject

POST /admin/work-runs/{work_run_id}/corrections/{correction_id}/reject appends a rejected history row when the pending correction still matches the version the reviewer inspected.

curl -i -sS -X POST \
  "$RETVEST_API_BASE/admin/work-runs/$WORK_RUN_ID/corrections/$CORRECTION_ID/reject" \
  -H "Authorization: Bearer $RETVEST_API_KEY" \
  -H "Accept: application/json, application/problem+json" \
  -H "Content-Type: application/json" \
  -H "Expected-Version: $CORRECTION_EXPECTED_VERSION" \
  -H "Idempotency-Key: correction-wr-example-20260618-reject-001" \
  -H "X-Request-Id: req_correction_reject_example_001" \
  -d '{
    "rejection_reason_code": "unsupported_evidence",
    "reviewer_note": "Reviewed evidence does not support applying this correction."
  }'
{
  "fixture_id": "work-run-correction.reject.success.v1",
  "correction_id": "wrc_example_002",
  "work_run_id": "wr_example",
  "correction_sequence": 3,
  "correction_status": "rejected",
  "rejection_reason_code": "unsupported_evidence",
  "expected_version": 2,
  "request_id": "req_correction_reject_example_001"
}

SDK Example

This source-only helper shows how a reviewer script can carry expected-version, request id, and idempotency metadata without claiming generated SDK methods.

type RejectProblemCode =
  | "validation_failed"
  | "version_conflict"
  | "invalid_transition"
  | "idempotency_conflict"
  | "forbidden"
  | "tenant_mismatch"
  | "rate_limited"
  | "unavailable"
  | "timeout";

type RejectProblem = {
  status?: number;
  code?: RejectProblemCode;
  category?: RejectProblemCode;
  request_id?: string;
  retry_after?: string;
};

type RejectCorrectionResult = {
  correction_id: string;
  correction_sequence: number;
  correction_status: "rejected";
  rejection_reason_code: string;
  expected_version: number;
  request_id?: string;
};

export async function rejectWorkRunCorrection(options: {
  baseUrl: string;
  apiKey: string;
  workRunId: string;
  correctionId: string;
  expectedVersion: number;
  idempotencyKey: string;
  requestId: string;
}) {
  const response = await fetch(
    `${options.baseUrl}/admin/work-runs/${encodeURIComponent(options.workRunId)}/corrections/${encodeURIComponent(options.correctionId)}/reject`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${options.apiKey}`,
        Accept: "application/json, application/problem+json",
        "Content-Type": "application/json",
        "Expected-Version": String(options.expectedVersion),
        "Idempotency-Key": options.idempotencyKey,
        "X-Request-Id": options.requestId
      },
      body: JSON.stringify({
        rejection_reason_code: "unsupported_evidence",
        reviewer_note: "Reviewed evidence does not support applying this correction."
      })
    }
  );

  if (!response.ok) {
    const problem = (await response.json().catch(() => ({}))) as RejectProblem;
    throw {
      problem,
      retryAfter: response.headers.get("Retry-After") ?? problem.retry_after ?? null
    };
  }

  return (await response.json()) as RejectCorrectionResult;
}

Expected-Version Handling

Send the last inspected correction sequence or version as Expected-Version. On version_conflict or invalid_transition, refresh List Work Run corrections, keep the reviewer's note local, and ask the reviewer to choose from the latest pending/applied/rejected state.

Unsafe Review Retries

Reject is not a safe blind retry. Do not auto-repeat it after duplicate clicks, route changes, stale correction data, or an unknown timeout. If local policy allows an exact idempotent replay, reuse the same request body, Expected-Version, Idempotency-Key, and target correction; then list corrections before showing success.

Problem code Developer handling
validation_failed Preserve the review note and fix bounded fields before sending a new action.
version_conflict Refresh the ledger and ask the reviewer to confirm the current pending row.
invalid_transition Show the latest correction status, including superseded; do not retry reject while the state is not pending.
idempotency_conflict Stop retrying and investigate the conflicting review action.
forbidden Hide review-only controls and metadata for this actor.
tenant_mismatch Show a generic unavailable state; do not reveal whether another tenant's Work Run exists.
rate_limited Respect Retry-After only for an exact idempotent replay allowed by local policy.
unavailable or timeout Refresh the ledger before asking the reviewer whether to retry.

Choose what this site may use. Your choice is kept in this browser only.