---
id: ADR-PFM-LLM-004
title: Recover Stale Work Through a Later Sweep
product_area: platform
module: llm
revision: 1
status: proposed
design_intent: proposed
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
decision: >-
  Hourly reconciliation closes requests older than a day at their stored estimate, abandons stale running
  tasks and reports task drift without automatic correction.
constrains:
  - WF-PFM-LLM-004
  - STATE-PFM-LLM-001
  - STATE-PFM-LLM-002
  - SVC-PFM-LLM-llm
origin: >-
  The hourly sweep is part of the approved foundation design section 4.2
  (services-platform:docs/llm/llm-foundation-and-generate-query.md#4.2 What Is Copied, What Changes); the
  estimate charge and the twenty-four-hour window are the module's own and are questioned by FND-PFM-LLM-022
  and FND-PFM-LLM-032.
alternatives:
  - option: Broaden request cleanup to cover admission
    why_not: It can cover more ordinary errors but still cannot execute after process death.
  - option: Charge stale work from persisted attempt usage
    why_not: >-
      Attempts can be incomplete; Product has not resolved the disagreement between guide and estimate-based
      implementation.
  - option: Automatically overwrite drifted totals
    why_not: >-
      It can conceal the original accounting defect unless reconciliation policy first defines the
      authoritative repair.
  - option: Select much younger requests
    why_not: It increases overlap with live requests; the pinned selection uses a day-long window.
consequences:
  - Successful later runs can release recorded stale holds after eligibility.
  - An unrecorded hold or failed period movement can remain unresolved.
  - Terminal requests with incomplete monthly charges are not selected again.
  - 'Silence and past-window alarms signal configured conditions, without promising repair of every failure.'
supersedes: []
evidence:
  - >-
    services-platform at ad3f6a6: modules/llm/services/reconciliation/llm-settlement-sweep.ts,
    reconciliation-pass.ts; aws/logic/llm-reconciliation.lambda.ts.
---

# Recover Stale Work Through a Later Sweep

## Context

A stopped process cannot execute request cleanup. Recovery needs a later reader of retained bookkeeping.

## Decision

Hourly reconciliation closes requests older than a day at their stored estimate, abandons stale running tasks and reports task drift without automatic correction.

## Alternatives Considered

Broaden request cleanup to cover admission: It can cover more ordinary errors but still cannot execute after process death.

Charge stale work from persisted attempt usage: Attempts can be incomplete; Product has not resolved the disagreement between guide and estimate-based implementation.

Automatically overwrite drifted totals: It can conceal the original accounting defect unless reconciliation policy first defines the authoritative repair.

Select much younger requests: It increases overlap with live requests; the pinned selection uses a day-long window.

## Consequences

Successful later runs can release recorded stale holds after eligibility. An unrecorded hold or failed period movement can remain unresolved. Terminal requests with incomplete monthly charges are not selected again. Silence and past-window alarms signal configured conditions, without promising repair of every failure.
