Request Retry For Work Run Corrections

Use this page when a permitted reviewer cannot apply a pending correction yet, but the Work Run can continue after an operator submits a follow-up correction. Requesting retry records a new pending correction row for the follow-up review. It is not a way to edit the existing correction row, and it is not approval evidence.

Current status: the route shape below is a source-publication example for the correction retry operation. The committed site-rendered correction OpenAPI slice and checked fixtures cover this route; OpenAPI-generated SDK methods, package registry distribution, and customer automation remain pending.

Raw HTTP Retry Request

POST /admin/work-runs/{work_run_id}/corrections/{correction_id}/retry records that the reviewer needs a follow-up correction before the Work Run can be approved or exported. Send the Work Run version the reviewer inspected as expected_work_run_version, one Idempotency-Key, and one request ID.

curl -i -sS -X POST \
  "$RETVEST_API_BASE/admin/work-runs/$WORK_RUN_ID/corrections/$CORRECTION_ID/retry" \
  -H "Authorization: Bearer $RETVEST_API_KEY" \
  -H "Accept: application/json, application/problem+json" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: correction-wr-example-20260618-retry-001" \
  -H "X-Request-Id: req_correction_retry_example_001" \
  -d '{
    "expected_work_run_version": 8,
    "resolution_reason_code": "operator_requested_retry",
    "resolution_note": "Retry review after the external evidence attachment was corrected."
  }'
{
  "fixture_id": "work-run-correction.retry.success.v1",
  "correction_id": "wrc_example_003",
  "work_run_id": "wr_example",
  "correction_sequence": 5,
  "correction_status": "pending",
  "work_run_version": 8,
  "approval_export_blocked": true,
  "request_id": "req_correction_retry_example_001"
}

The example is metadata-only. It intentionally omits original correction text, replacement text, citation bodies, customer identifiers, bearer tokens, and production idempotency-key values.

Approval Gate Semantics

Use the retry action when the reviewer agrees that the current pending correction is not ready to apply or reject, but the operator can submit a follow-up correction that may resolve the Work Run. The retry request appends a new pending row; it is not an edit to the existing row.

The approval and export remain blocked while the follow-up correction is unresolved. The gate clears only when that correction is resolved by apply, reject, or an explicit Work Run block decision owned by the platform. Public docs must not describe the run as approved, committed, or export-ready while the follow-up correction is unresolved.

SDK Example

This source-only helper shows the request metadata a retry decision should carry. It does not claim a generated SDK method exists.

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

type RetryProblem = {
  status?: number;
  code?: RetryProblemCode;
  category?: RetryProblemCode;
  request_id?: string;
  retry_after?: string;
};

type RetryCorrectionResult = {
  correction_id: string;
  work_run_id: string;
  correction_sequence: number;
  correction_status: "pending";
  work_run_version: number;
  approval_export_blocked: boolean;
  request_id?: string;
};

export async function retryWorkRunCorrection(options: {
  baseUrl: string;
  apiKey: string;
  workRunId: string;
  correctionId: string;
  expectedWorkRunVersion: number;
  idempotencyKey: string;
  requestId: string;
}) {
  const response = await fetch(
    `${options.baseUrl}/admin/work-runs/${encodeURIComponent(options.workRunId)}/corrections/${encodeURIComponent(options.correctionId)}/retry`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${options.apiKey}`,
        Accept: "application/json, application/problem+json",
        "Content-Type": "application/json",
        "Idempotency-Key": options.idempotencyKey,
        "X-Request-Id": options.requestId
      },
      body: JSON.stringify({
        expected_work_run_version: options.expectedWorkRunVersion,
        resolution_reason_code: "operator_requested_retry",
        resolution_note: "Retry review after the external evidence attachment was corrected."
      })
    }
  );

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

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

Problem Handling

Retry requests use the same request ID and Retry-After discipline as other review writes. Retry-After is a wait hint for rate limits, unavailable responses, or exact idempotent replays; it is not permission to submit a new review decision.

Problem code Developer handling
validation_failed Preserve the reviewer note locally and fix bounded fields before sending a new action.
version_conflict Refresh the correction ledger and compare the latest work_run_version before asking the reviewer to choose again.
already_finalized Show the latest applied, rejected, or superseded state; do not send another review decision for this correction.
invalid_transition Refresh the ledger and keep approval/export disabled while the Work Run still has an unresolved follow-up correction.
idempotency_conflict Stop replaying and investigate the conflicting review action before the reviewer decides again.
forbidden Disable retry controls and do not reveal restricted correction text or metadata.
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 replay the same request body, target, version, and key.

Checked Fixture Names

Public examples should cite checked fixture names instead of live-service claims:

  • work-run-correction.retry.success.v1
  • work-run-correction.retry.validation-failed.v1
  • work-run-correction.retry.version-conflict.v1
  • work-run-correction.retry.already-finalized.v1
  • work-run-correction.retry.invalid-transition.v1
  • work-run-correction.retry.idempotency-conflict.v1
  • work-run-correction.retry.rate-limited.v1

These names are source-publication anchors until retvest-contracts publishes the checked fixture manifest and retvest-platform commits the reviewed OpenAPI snapshot.

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