intelligence-radar/workplans/IR-WP-0006-billing-reconciliation.md
tegwick 6808aa3594 Define reviewed publications and record the field-sampling frame.
IR-WP-0007-T03 can now record a capture-linked publication separately from generated drafts. The field-outcome design is written, and credential, billing, and website-pull gates were rechecked and left waiting.

Assistant: grok
Assistant-Session: 01a106a5-fc07-78c2-b64f-8e04cea25daf
2026-10-04 14:51:01 +02:00

4 KiB

id type title domain repo status flavor owner topic_slug origin origin_ref created updated state_hub_workstream_id
IR-WP-0006 workplan Reconcile trial billing and establish campaign accounting infotech intelligence-radar blocked implementation codex custodian residual IR-WP-0004 2026-09-14 2026-10-04 b877f5e2-0c0e-5bca-9082-873eab857ada

Created before closure of IR-WP-0004 at the user's request to separate credential delivery from billing. Source files own the work; cross-repository owner plans retain authority over native changes. Review baseline: docs/evidence/2026-09-14-ir-wp-0004-review.md.

Specify independent billing evidence and reconciliation contract

id: IR-WP-0006-T01
status: done
priority: high
state_hub_task_id: "87b26b10-f4d6-5c53-9965-fae61ac0df11"

Inventory the append-only events for ir-openrouter-pilot-20260913. Preserve the USD 0.023712 pending reservation and USD 10 total authorization. Define how provider billing evidence matches the failed request, what is unknown, who reviews a settlement, and how discrepancies are retained. HTTP 401 alone is not zero-charge proof. Accounting design can proceed independently of credential delivery; provider evidence retrieval may require an admitted read-only path.

Done: contract specified in docs/evidence/2026-09-27-ir-wp-0006-t01-reconciliation-contract.md — inventories the one pending reservation, defines valid billing evidence, the run_id-based match, the five refusal conditions, and what a settlement record must (and must not) contain.

Implement and verify auditable reconciliation

id: IR-WP-0006-T02
status: done
priority: high
state_hub_task_id: "1637f2ee-2369-5e78-8893-9437d2d6b6fc"

Provide a reviewed append-only settlement procedure or command. Preserve original reservations; reject duplicate/conflicting settlement, unknown reservation, invalid amount, cross-campaign references and budget overrun. Retain source billing evidence and reviewer attribution without credentials. Test uncertain/partial evidence and restart behavior. Do not fabricate a completed model trial to settle a failed request.

Done: intelligence_radar.trials.reconcile (+ CLI reconcile) implements the T01 contract — write-once settlement under the existing trials file lock, all five refusal conditions covered, no trials record fabricated. Tests in tests/test_trials.py (test_reconcile_*, 9 new cases) cover unknown reservation, duplicate/retry-after-success, cross-campaign, invalid amount, budget overrun, and missing evidence/reviewer attribution. Full suite (make check, 48 tests) passes.

Reconcile the outstanding reservation and hand off budget readiness

id: IR-WP-0006-T03
status: wait
depends_on: [IR-WP-0005-T02]
blocking_reason: "No authoritative provider billing evidence for the pending run yet; expected via the IR-WP-0005 admitted read-only path."
priority: high
state_hub_task_id: "441dc053-af7b-5a9c-866f-5b1eb804b94f"

Depends on T01/T02 and authoritative provider evidence. Resolve the USD 0.023712 reservation only to the supported actual amount, retaining any unresolved discrepancy explicitly. Rerender pilot/full plans for the same campaign and report spent, pending and remaining authorized budget. No campaign reset, additional authorization, or paid inference is implied. Completion requires reconciled evidence and a usable accounting handoff, not merely implementation tests.

Blocked: the mechanism is ready (T01/T02 done), but no authoritative provider billing evidence exists for the pending run_id 29a46a1d6c2d9ef6cfce8de6efef75cddcfecee346c1b4babf57119f1a241d71 yet. Applying reconcile here without that evidence would be exactly the fabrication this workplan forbids. Waits on external evidence (likely via the IR-WP-0005 admitted read-only path).

Rechecked 2026-10-04: the ledger still has the one reserved event for 29a46a1d6c2d9ef6cfce8de6efef75cddcfecee346c1b4babf57119f1a241d71 and no provider billing artifact. IR-WP-0005-T02 is still wait, so the read-only path is still closed. reconcile was not called. Stays wait.