{
  "$schema": "https://miguelcolmenares.com/schemas/plan-state/v1.schema.json",
  "planId": "export-retry",
  "title": "Add a retry to the export job",
  "lifecycle": "multi-session",
  "createdDate": "2026-01-15",
  "lastUpdated": "2026-01-16",
  "relatedDocs": ["references/example-plan.md"],
  "handoff": {
    "nextAction": "Finish use-in-export: the upload call in src/export.ts is wrapped, the test for the forced 503 is not written yet.",
    "branch": "feature/export-retry",
    "lastCommit": "a1b2c3d Add withRetry",
    "uncommitted": "src/export.ts wrapped, src/export.test.ts not started",
    "verify": "npm test -- export",
    "updatedBy": "codex",
    "updatedAt": "2026-01-16"
  },
  "taskTemplate": {
    "note": "Every task is one change, one acceptance check and one commit.",
    "steps": [
      { "id": "implement", "description": "Make the change and its tests.", "status": "not-started" },
      { "id": "verify", "description": "Run the acceptance check of the task.", "status": "not-started" },
      { "id": "record", "description": "Update the JSON in the same commit as the work.", "status": "not-started" }
    ]
  },
  "workItems": [
    {
      "id": "retry",
      "title": "Retry the upload in the export job",
      "kind": "feature",
      "status": "in-progress",
      "findings": [
        "Observed: 3 of the last 14 nightly exports failed with a 503 from the storage API, in the job logs of 2026-01-15."
      ],
      "tasks": [
        {
          "id": "write-with-retry",
          "status": "completed",
          "acceptance": "npm test -- retry passes",
          "files": ["src/retry.ts", "src/retry.test.ts"],
          "dependsOn": [],
          "claimedBy": "claude-code/sonnet",
          "claimedAt": "2026-01-15T10:05:00Z"
        },
        {
          "id": "use-in-export",
          "status": "in-progress",
          "acceptance": "npm test -- export passes, and a forced 503 in the test succeeds on the second try",
          "files": ["src/export.ts", "src/export.test.ts"],
          "dependsOn": ["write-with-retry"],
          "claimedBy": "codex",
          "claimedAt": "2026-01-16T09:30:00Z"
        },
        {
          "id": "log-retries",
          "status": "not-started",
          "acceptance": "A forced 503 writes one warning line for each retry",
          "files": ["src/export.ts"],
          "dependsOn": ["use-in-export"]
        }
      ],
      "log": [
        {
          "date": "2026-01-15",
          "summary": "Added withRetry with three tries and waits of 1, 4 and 16 seconds, 6 tests pass.",
          "agent": "claude-code/sonnet"
        },
        {
          "date": "2026-01-16",
          "summary": "Claimed use-in-export and wrapped the upload call, the test for the forced 503 is not written.",
          "agent": "codex"
        }
      ]
    }
  ],
  "changelog": [
    {
      "date": "2026-01-16",
      "summary": "The work moved from Claude Code to Codex after the Claude usage window ended.",
      "agent": "codex"
    }
  ]
}
