{
  "id": "gpt-6.2-astra-2",
  "model": "gpt-6.2-astra",
  "repeat": 2,
  "startedUTC": "2026-12-01T02:36:15.404553+00:00",
  "seconds": 38,
  "promptSHA256": "b351cabf6bde095573e094d8ad7488a11cb7a07a503cd10f1e8b7db0607389cc",
  "starterHashes": {
    "candidate.cjs": "f0160e086444d8e29605e578b7a2163bb7cb737b1a2f77dbc652ad0f0c6e69e7",
    "grader.cjs": "ab31467a19661e896a6303357f382c9d25ae374cd01e0d93cfff0106299e2bfd",
    "PROMPT.txt": "7da39e29e75b0ea6cff4fbf1d4f7a08df89633f04f333ef6392a1250c373781e",
    "README.txt": "bbc0d6dc027dd379d7dfc6f7572d22bba7724388a387838f80ec21ab5f6ea245"
  },
  "trace": [
    "thread.started",
    "turn.started",
    "item.agent_message",
    "turn.completed"
  ],
  "score": 80,
  "maximum": 80,
  "checks": [
    {
      "name": "Start consumes one attempt",
      "pass": true,
      "points": 4
    },
    {
      "name": "Repeated start is a no-op",
      "pass": true,
      "points": 4
    },
    {
      "name": "Success clears stale metadata",
      "pass": true,
      "points": 4
    },
    {
      "name": "Out-of-order success is ignored",
      "pass": true,
      "points": 4
    },
    {
      "name": "Out-of-order failure is ignored",
      "pass": true,
      "points": 4
    },
    {
      "name": "First retry uses base delay",
      "pass": true,
      "points": 4
    },
    {
      "name": "Second retry doubles delay",
      "pass": true,
      "points": 4
    },
    {
      "name": "Backoff is capped",
      "pass": true,
      "points": 4
    },
    {
      "name": "Attempt limit is inclusive",
      "pass": true,
      "points": 4
    },
    {
      "name": "Permanent failure never retries",
      "pass": true,
      "points": 4
    },
    {
      "name": "Early retry is ignored",
      "pass": true,
      "points": 4
    },
    {
      "name": "Exact retry boundary is eligible",
      "pass": true,
      "points": 4
    },
    {
      "name": "Exhausted job cannot start",
      "pass": true,
      "points": 4
    },
    {
      "name": "Cancel removes queued retry",
      "pass": true,
      "points": 4
    },
    {
      "name": "Late success cannot undo cancellation",
      "pass": true,
      "points": 4
    },
    {
      "name": "Terminal success cannot restart",
      "pass": true,
      "points": 4
    },
    {
      "name": "Terminal failure cannot be cancelled",
      "pass": true,
      "points": 4
    },
    {
      "name": "Unknown event preserves extra fields",
      "pass": true,
      "points": 4
    },
    {
      "name": "Raw error text is never stored",
      "pass": true,
      "points": 4
    },
    {
      "name": "Inputs stay unchanged on a real transition",
      "pass": true,
      "points": 4
    }
  ],
  "selfPass": true,
  "referencePass": true,
  "sensitivity": [
    {
      "name": "Extra retry",
      "detected": true
    },
    {
      "name": "Fixed delay",
      "detected": true
    },
    {
      "name": "Late start boundary",
      "detected": true
    },
    {
      "name": "Cancellation undone",
      "detected": true
    },
    {
      "name": "Raw error saved",
      "detected": true
    },
    {
      "name": "Input mutation",
      "detected": true
    }
  ],
  "humanReview": "Pending; no combined score",
  "submission": {
    "candidate": "function transition(state, event, policy) {\n  const { status, attempts } = state;\n  if (status === 'succeeded' || status === 'failed' || status === 'cancelled') return state;\n\n  switch (event.type) {\n    case 'cancel':\n      return { ...state, status: 'cancelled', nextRunAt: null, lastError: null };\n\n    case 'start':\n      if (status !== 'pending' && status !== 'retry') return state;\n      if (event.now < state.nextRunAt) return state;\n      if (attempts >= policy.maxAttempts) {\n        return { ...state, status: 'failed', nextRunAt: null, lastError: 'ATTEMPTS_EXHAUSTED' };\n      }\n      return { ...state, status: 'running', attempts: attempts + 1, nextRunAt: null, lastError: null };\n\n    case 'success':\n      if (status !== 'running') return state;\n      return { ...state, status: 'succeeded', nextRunAt: null, lastError: null };\n\n    case 'failure': {\n      if (status !== 'running') return state;\n      const transient = event.retryable === true;\n      if (transient && attempts < policy.maxAttempts) {\n        const delay = Math.min(policy.maxDelay, policy.baseDelay * 2 ** (attempts - 1));\n        return { ...state, status: 'retry', nextRunAt: event.now + delay, lastError: 'TRANSIENT' };\n      }\n      return { ...state, status: 'failed', nextRunAt: null, lastError: transient ? 'TRANSIENT' : 'PERMANENT' };\n    }\n\n    default:\n      return state;\n  }\n}\n\nmodule.exports = { transition };\n",
    "tests": "const assert = require('node:assert/strict');\nconst test = require('node:test');\nconst { transition } = require('./candidate.cjs');\n\nconst initial = { id: 'a', status: 'pending', attempts: 0, nextRunAt: 0, lastError: null, metadata: { owner: 'ops' } };\nconst policy = { maxAttempts: 4, baseDelay: 10, maxDelay: 25 };\nconst failure = { type: 'failure', retryable: true, error: 'private diagnostic' };\n\n// Assert the full result and check all three inputs after every step.\nfunction step(state, event, changes = {}) {\n  const before = JSON.parse(JSON.stringify([state, event, policy]));\n  const next = transition(state, event, policy);\n  assert.deepStrictEqual([state, event, policy], before);\n  assert.deepStrictEqual(next, { ...before[0], ...changes });\n  return next;\n}\n\ntest('retry lifecycle consumes each attempt once and caps the delay', () => {\n  let job = initial;\n  let now = 0;\n  for (const [attempts, delay] of [[1, 10], [2, 20], [3, 25], [4, null]]) {\n    job = step(job, { type: 'start', now }, { status: 'running', attempts, nextRunAt: null, lastError: null });\n    step(job, { type: 'start', now });\n    now += 3;\n    if (delay === null) {\n      step(job, { ...failure, now }, { status: 'failed', nextRunAt: null, lastError: 'TRANSIENT' });\n    } else {\n      job = step(job, { ...failure, now }, { status: 'retry', nextRunAt: now + delay, lastError: 'TRANSIENT' });\n      now += delay;\n      step(job, { type: 'start', now: now - 1 });\n    }\n  }\n});\n\ntest('due time gates exhaustion for pending and retry jobs', () => {\n  for (const status of ['pending', 'retry']) {\n    for (const attempts of [4, 5]) {\n      const job = { ...initial, status, attempts, nextRunAt: 20 };\n      step(job, { type: 'start', now: 19 });\n      step(job, { type: 'start', now: 20 }, { status: 'failed', nextRunAt: null, lastError: 'ATTEMPTS_EXHAUSTED' });\n    }\n  }\n});\n\ntest('only literal true enables retries, and completion clears stale metadata', () => {\n  const job = { ...initial, status: 'running', attempts: 1, nextRunAt: 18, lastError: 'TRANSIENT' };\n  for (const flags of [{}, { retryable: false }, { retryable: 'true' }]) {\n    step(job, { type: 'failure', now: 30, error: 'private diagnostic', ...flags }, { status: 'failed', nextRunAt: null, lastError: 'PERMANENT' });\n  }\n  step(job, { type: 'success', now: 30 }, { status: 'succeeded', nextRunAt: null, lastError: null });\n});\n\ntest('cancellation clears queued work and all terminal states absorb late events', () => {\n  for (const status of ['pending', 'retry', 'running']) {\n    const job = status === 'pending' ? initial : { ...initial, status, attempts: 2, nextRunAt: 40, lastError: 'TRANSIENT' };\n    const cancelled = step(job, { type: 'cancel', now: 30 }, { status: 'cancelled', nextRunAt: null, lastError: null });\n    for (const type of ['start', 'success', 'failure', 'cancel', 'tick']) step(cancelled, { type, now: 50 });\n  }\n  for (const status of ['succeeded', 'failed']) {\n    const job = { ...initial, status, attempts: 2, nextRunAt: null, lastError: status === 'failed' ? 'PERMANENT' : null };\n    for (const type of ['start', 'success', 'failure', 'cancel', 'tick']) step(job, { type, now: 50 });\n  }\n});\n\ntest('queued jobs ignore premature results and unknown events', () => {\n  for (const status of ['pending', 'retry']) {\n    const job = { ...initial, status, attempts: status === 'retry' ? 1 : 0 };\n    for (const type of ['failure', 'success', 'tick']) step(job, { ...failure, type, now: 100 });\n  }\n});\n",
    "explanation": "A running job has already consumed its attempt. Only an eligible start increments the counter. A transient failure schedules capped exponential backoff while budget remains, and the final transient failure records TRANSIENT. An already-exhausted job records ATTEMPTS_EXHAUSTED when its start becomes due. Terminal states ignore late events, and failure handling never reads raw error text.\n\nChanged states use a shallow copy to preserve unrelated fields. No-ops return the original state. Nested metadata is shared and never modified by the transition.\n\nThe supplied regression tests cover the retry lifecycle, timing and budget boundaries, cancellation, late events, error codes, and input immutability. Neither the tests nor the grader were run, per the single-response constraint. The repair assumes valid inputs and models synchronous state transitions only."
  }
}
