Skip to content

CAP-PFM-LLM-003Keep one account for a multi-request AI task

Markdown

CAP-PFM-LLM-003

Keep one account for a multi-request AI task

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaPlatformModuleAI Requests, Usage and the Jazz AI TeammateRevision1

Read atservices-platform ad3f6a65

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
A task aggregates its request counts and charges.An idempotency key prevents a duplicate task from running.Failed tasks retain charges from completed requests.
Surfaces
apijob
Preconditions
The execution key exists in the catalog.
Postconditions
The execution retains its final outcome and request totals.

Controls

24 controls apply, from the corpus control catalogue.

TC-AI-006 TC-AI-007 TC-AVL-001 TC-AVL-005 TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-IAM-001 TC-IAM-002 TC-IAM-004 TC-IAM-005 TC-LOG-004 TC-LOG-005 TC-PI-001 TC-PI-002 TC-PI-003 TC-PI-005 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-VEN-001 TC-VEN-002 TC-VEN-003

Business Rules

9 rules, 7 to be proved before approval. A rule's product intent is derived from its origin: 0 confirmed by a product decision, the rest inheriting this capability's proposed.

IdRuleKindEnforced atProvenance
01must prove
Proposed
The execution starts running before its first request and closes completed or failed with its completion time and elapsed duration.
lifecycleservice, databaseobserved
02must prove
Proposed
Only the exact context supplied by the execution wrapper associates a request with it; outside or derived contexts carry no execution association.
invariantserviceobserved
03must prove
Proposed
Opening a nested execution is rejected and makes the enclosing execution fail.
validationserviceobserved
04must prove
Proposed
An unknown execution key is rejected before creating a record, and duplicate keys, unknown applications or empty features invalidate publication.
validationserviceobserved
05must prove
Proposed
Request settlement atomically adds one request and its credits and cents to the execution; estimated settlement adds no cents, released settlement adds no cost, refusals add no settlement count, and late settlements still contribute.
calculationservice, databaseobserved
06must prove
Proposed
Reusing an organization’s execution idempotency key returns the earlier running or closed execution as a replay without invoking the task again.
policyservice, databaseobserved
07
Proposed
The execution retains its declared identity, application, feature, caller attribution and any subject record.
invariantservicetest
08
Proposed
A settlement log identifies its enclosing execution when one exists and leaves that association absent otherwise.
policyservicetest
services-platform:modules/llm/tests/integration/lifecycle/executions.integration.spec.js#carries the execution id on the call made inside the execution
09must prove
Proposed
A task failure remains the caller’s error even if closing its execution also fails; that close failure is logged. After successful task work, a close failure is returned to the caller.
lifecycleserviceobserved

Scenarios

IdGivenWhenThenProvenance
01A task performs three requests.The task finishes successfully.Its execution records their count and summed charges.test
02A task fails after two completed requests.The failure closes the execution.The failed task retains those request charges and its elapsed time.test

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.