Work Run Correction Audit Visibility

Use this page when an operator script or reviewer support flow needs audit metadata for Work Run correction activity. It narrows the public-safe boundary for the audit read path; it does not replace the operator runbook in Recording corrections or the committed site-rendered correction OpenAPI slice.

Current status: this is source-publication guidance. The Work Run correction OpenAPI JSON/HTML slice is committed source-only; OpenAPI-generated correction SDK methods, package registry distribution, customer automation, and admin correction UI browser-path smoke evidence remain pending.

Current Boundary

The correction audit read is for governance review, request tracing, and proof-package preparation. Public examples may show metadata-only audit fields: correction ids, sequence numbers, correction statuses, event types, request ids, actor roles, visibility scopes, bounded reason codes, timestamps, receipt ids, hash-chain metadata, and receipt digests.

Public examples must not expose raw prompts, answers, citation text, correction bodies, bearer tokens, private evidence refs, customer text, or full audit payload dumps. Exact response member names, auth scopes, Problem extension fields, and SDK method names remain platform-owned until the reviewed snapshot is committed.

Read The Correction Audit Ledger

GET /admin/work-runs/{work_run_id}/corrections/audit returns role-aware metadata for correction audit events. Reads do not need an Idempotency-Key or Expected-Version header.

curl -i -sS \
  "$RETVEST_API_BASE/admin/work-runs/$WORK_RUN_ID/corrections/audit?limit=25" \
  -H "Authorization: Bearer $RETVEST_API_KEY" \
  -H "Accept: application/json, application/problem+json" \
  -H "X-Request-Id: req_correction_audit_example_001"
{
  "fixture_id": "work-run-correction.audit.success-page.v1",
  "items": [
    {
      "audit_id": "aud_example_001",
      "work_run_id": "wr_example",
      "correction_id": "wrc_example_001",
      "correction_sequence": 1,
      "event_type": "correction.created",
      "correction_status": "pending",
      "actor_role": "reviewer",
      "visibility_scope": "reviewer_audit",
      "receipt_id": "rct_example_001",
      "request_id": "req_correction_create_example_001",
      "recorded_at": "2026-06-18T09:00:00Z",
      "prev_hash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
      "row_hash": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
      "receipt_digest": "sha256:2222222222222222222222222222222222222222222222222222222222222222"
    },
    {
      "audit_id": "aud_example_002",
      "work_run_id": "wr_example",
      "correction_id": "wrc_example_001",
      "correction_sequence": 2,
      "event_type": "correction.applied",
      "correction_status": "applied",
      "actor_role": "reviewer",
      "visibility_scope": "reviewer_audit",
      "receipt_id": "rct_example_002",
      "request_id": "req_correction_apply_example_001",
      "recorded_at": "2026-06-18T09:04:00Z",
      "prev_hash": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
      "row_hash": "sha256:3333333333333333333333333333333333333333333333333333333333333333",
      "receipt_digest": "sha256:4444444444444444444444444444444444444444444444444444444444444444"
    },
    {
      "audit_id": "aud_example_003",
      "work_run_id": "wr_example",
      "correction_id": "wrc_example_002",
      "correction_sequence": 3,
      "event_type": "correction.rejected",
      "correction_status": "rejected",
      "actor_role": "reviewer",
      "visibility_scope": "reviewer_audit",
      "receipt_id": "rct_example_003",
      "request_id": "req_correction_reject_example_001",
      "rejection_reason_code": "unsupported_evidence",
      "recorded_at": "2026-06-18T09:07:00Z",
      "prev_hash": "sha256:3333333333333333333333333333333333333333333333333333333333333333",
      "row_hash": "sha256:5555555555555555555555555555555555555555555555555555555555555555",
      "receipt_digest": "sha256:6666666666666666666666666666666666666666666666666666666666666666"
    },
    {
      "audit_id": "aud_example_004",
      "work_run_id": "wr_example",
      "correction_id": "wrc_example_003",
      "correction_sequence": 4,
      "event_type": "correction_superseded",
      "correction_status": "superseded",
      "actor_role": "reviewer",
      "visibility_scope": "reviewer_audit",
      "receipt_id": "rct_example_004",
      "request_id": "req_correction_retry_example_001",
      "approval_export_blocked": true,
      "recorded_at": "2026-06-18T09:10:00Z",
      "prev_hash": "sha256:5555555555555555555555555555555555555555555555555555555555555555",
      "row_hash": "sha256:7777777777777777777777777777777777777777777777777777777777777777",
      "receipt_digest": "sha256:8888888888888888888888888888888888888888888888888888888888888888"
    }
  ],
  "pagination": {
    "limit": 25,
    "next_cursor": null
  },
  "request_id": "req_correction_audit_example_001"
}

Role-Aware Audit Visibility

Correction audit views should be role-aware and metadata-only:

Viewer Public-safe audit visibility
Operator Correction id, correction_sequence, correction_status, request id, receipt id, bounded reason codes, and timestamps.
Reviewer or admin Operator metadata plus actor role, audit event type, visibility scope, hash-chain metadata, receipt digest, and approval/export blocked reason.
Unauthorized, revoked, or tenant-mismatched actor Safe Problem response or unavailable state only; do not reveal whether a cross-tenant Work Run or correction exists.

No role should receive raw correction bodies, prompt text, generated answer text, citation bodies, private evidence refs, bearer tokens, or full audit payloads through correction audit metadata.

Problem Handling

Audit reads are safe to retry only as reads. Respect Retry-After on rate_limited, unavailable, or timeout responses, keep the previous visible rows until replacement data arrives, and log only the opaque request_id.

Problem code Operator-safe handling
invalid_cursor Drop the cursor, reload the first page, and do not log the cursor value.
forbidden Hide restricted audit metadata and disable audit-only controls.
tenant_mismatch Show a generic unavailable state; do not reveal whether another tenant's Work Run exists.
rate_limited Respect Retry-After before the next read.
unavailable or timeout Retry the read after Retry-After and keep the previous visible state until replacement data arrives.

Do not treat an audit read as approval evidence. Approval and export wording stay tied to resolved correction history, cleared retry follow-up gates, and the approval version inspected by the reviewer.

SDK, CLI, And RIL Packet Reads

The committed correction OpenAPI slice covers this audit path, but SDK and CLI audit reads should use source-package helpers or lower-level fetch helpers until generated SDK distribution evidence exists. The helper below does not claim OpenAPI-generated SDK availability or package-registry release evidence.

type CorrectionAuditStatus =
  | "pending"
  | "applied"
  | "rejected"
  | "superseded";

type CorrectionAuditRead = {
  items: Array<{
    audit_id: string;
    correction_id: string;
    correction_sequence: number;
    correction_status: CorrectionAuditStatus;
    event_type: string;
    visibility_scope: string;
    receipt_id: string;
    request_id?: string;
    rejection_reason_code?: string;
    approval_export_blocked?: boolean;
    prev_hash: string;
    row_hash: string;
    receipt_digest: string;
    recorded_at: string;
  }>;
  pagination: { limit: number; next_cursor: string | null };
  request_id?: string;
};

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

export async function readCorrectionAudit(options: {
  baseUrl: string;
  apiKey: string;
  workRunId: string;
  cursor?: string;
  requestId: string;
}) {
  const search = new URLSearchParams({ limit: "25" });
  if (options.cursor) search.set("cursor", options.cursor);

  const response = await fetch(
    `${options.baseUrl}/admin/work-runs/${encodeURIComponent(options.workRunId)}/corrections/audit?${search}`,
    {
      headers: {
        Authorization: `Bearer ${options.apiKey}`,
        Accept: "application/json, application/problem+json",
        "X-Request-Id": options.requestId
      }
    }
  );

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

  const audit = (await response.json()) as CorrectionAuditRead;
  return audit.items.map((event) => ({
    auditId: event.audit_id,
    correctionId: event.correction_id,
    sequence: event.correction_sequence,
    status: event.correction_status,
    eventType: event.event_type,
    visibilityScope: event.visibility_scope,
    receiptId: event.receipt_id,
    requestId: event.request_id,
    rejectionReasonCode: event.rejection_reason_code,
    approvalExportBlocked: event.approval_export_blocked,
    recordedAt: event.recorded_at,
    hashChain: {
      prevHash: event.prev_hash,
      rowHash: event.row_hash
    },
    receiptDigest: event.receipt_digest
  }));
}

RIL packet manifests may carry only the correction metadata needed to prove continuity with the governed Work Run state. Packet manifest shape, exact digest source, and runtime validation behavior remain retvest-ril owner-repo semantics until reviewed artifacts are published.

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