Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ The same explicitly authorized rollover contract applies to the later supported
| `acceptance-revalidation-v13` | V12, including its retained unknown request |
| `acceptance-revalidation-v14` | Settled V13 on the integrated U03 candidate |
| `acceptance-revalidation-v15` | Settled V14, including its invalid-JSON failure |
| `acceptance-revalidation-v16` | Settled V15, including the stale-confirmation U03 failure |

Before preparation, retain the predecessor ledger, binding and guard at their pinned
fingerprints and preserve the entire earlier history chain. The selected policy's
Expand Down Expand Up @@ -535,6 +536,12 @@ failure and all known costs in V14; do not resume it or reinterpret it as passin
acceptance. The earlier three unknown liabilities and every purpose/token cap remain
unchanged. A new complete prefix must establish acceptance for the changed adapter.

V16 retains the permanently halted V15 ledger, binding and guard for confirmation
invalidation revalidation. Keep the original incomplete U03 result and its settled
costs; the earlier U02 gate remains evidence for its original candidate only. The
same cumulative USD200 ceiling, three unknown liabilities and purpose/token caps
apply. Fresh acceptance must bind the changed service rather than relabel old proof.

Issue the evidence-bound U02 gate only after those inputs validate. Gate artifact references are
relative to the private directory containing the gate; place the referenced artifacts there:

Expand Down
4 changes: 2 additions & 2 deletions services/agent/data/repository_corpus_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
},
{
"doc_id": "repository-development",
"version": "sha256-8fd11b59eea6f0663bf45ad4261f6ab2e183b2098b3308c18dc05891c64a2b58",
"chunk_id": "repository-development:sha256-8fd11b59eea6f0663bf45ad4261f6ab2e183b2098b3308c18dc05891c64a2b58:1",
"version": "sha256-df792c4eeb93390edb6fccb5896153f620d8dfd9b7dd1735080baeaf7edc5a32",
"chunk_id": "repository-development:sha256-df792c4eeb93390edb6fccb5896153f620d8dfd9b7dd1735080baeaf7edc5a32:1",
"source_path": "docs/DEVELOPMENT.md",
"access_scope": "repository-public",
"sample_kind": "real",
Expand Down
14 changes: 14 additions & 0 deletions services/agent/src/authorized_budget_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
REVALIDATION_V13_POLICY_ID = "acceptance-revalidation-v13"
REVALIDATION_V14_POLICY_ID = "acceptance-revalidation-v14"
REVALIDATION_V15_POLICY_ID = "acceptance-revalidation-v15"
REVALIDATION_V16_POLICY_ID = "acceptance-revalidation-v16"
REVALIDATION_POLICY_IDS = frozenset({REVALIDATION_POLICY_ID, REVALIDATION_V2_POLICY_ID, REVALIDATION_V3_POLICY_ID, REVALIDATION_V4_POLICY_ID, REVALIDATION_V5_POLICY_ID, REVALIDATION_V6_POLICY_ID, REVALIDATION_V7_POLICY_ID, REVALIDATION_V8_POLICY_ID, REVALIDATION_V9_POLICY_ID, REVALIDATION_V10_POLICY_ID, REVALIDATION_V11_POLICY_ID, REVALIDATION_V12_POLICY_ID})
REVALIDATION_V2_HISTORY = MappingProxyType({
"attempts": 164, "known_actual_micro_usd": 42_307,
Expand Down Expand Up @@ -239,6 +240,17 @@
})
REVALIDATION_POLICY_IDS = REVALIDATION_POLICY_IDS | {REVALIDATION_V15_POLICY_ID}

REVALIDATION_V16_HISTORY = MappingProxyType({
"attempts": 1286, "known_actual_micro_usd": 365_717,
"known_committed_micro_usd": 11_363_714,
"unknown_attempts": 3, "unknown_encumbrance_micro_usd": 2_359_296,
"cumulative_attempt_limit": 1527, "cumulative_limit_micro_usd": 200_000_000,
})
REVALIDATION_V16_POLICY = MappingProxyType({
**REVALIDATION_V15_POLICY, "history": REVALIDATION_V16_HISTORY,
})
REVALIDATION_POLICY_IDS = REVALIDATION_POLICY_IDS | {REVALIDATION_V16_POLICY_ID}


def policy_for(policy_id: str):
if policy_id == POLICY_ID:
Expand Down Expand Up @@ -273,6 +285,8 @@ def policy_for(policy_id: str):
return REVALIDATION_V14_POLICY
if policy_id == REVALIDATION_V15_POLICY_ID:
return REVALIDATION_V15_POLICY
if policy_id == REVALIDATION_V16_POLICY_ID:
return REVALIDATION_V16_POLICY
raise PeriodError("unsupported policy")


Expand Down
27 changes: 23 additions & 4 deletions services/agent/src/revalidation_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,30 @@ def _check_unknown_rollover(snapshot, guard, *, predecessor="v2"):
}


V15_ROLLOVER_IDENTITY = {
"period_id": "revalidation-v15-20261011",
"identity": "8b7f3fc4d4554bd99feb43cd3ae889af",
"config_sha256": "f83b200a2aed0085090377bd60427b252d7e2c0423a810bde63d6c49103f84d3",
"policy_id": "acceptance-revalidation-v15",
}
V15_ROLLOVER_SHA256 = {
"budget.sqlite3": "c29d0368239c4caeaadc74c0a719933c3a367ff10cff0da311bc6e9048567560",
"binding.json": "726effe429045a098633ca9ccf812ff84bfef2181ea54f9476a08c323f2d8651",
"dav58-increment-8b7f3fc4d4554bd99feb43cd3ae889af.json": "85238b3fc50363a9d9fa19db96fa16c0f4670aa73473d2ace81972c447a03e2f",
}


def _validate_rollover_history(sources, *, settled_policy="v1"):
from authorized_budget_period import REVALIDATION_V14_HISTORY, REVALIDATION_V15_HISTORY
from authorized_budget_period import REVALIDATION_V14_HISTORY, REVALIDATION_V15_HISTORY, REVALIDATION_V16_HISTORY
from authorized_budget_period import PeriodError, PeriodIdentity, REVALIDATION_V2_HISTORY, REVALIDATION_V4_HISTORY, REVALIDATION_V5_HISTORY, REVALIDATION_V6_HISTORY, REVALIDATION_V7_HISTORY, REVALIDATION_V8_HISTORY, REVALIDATION_V9_HISTORY, REVALIDATION_V10_HISTORY, REVALIDATION_V11_HISTORY, REVALIDATION_V12_HISTORY, _parent, _file
from model_budget import ModelBudget, authorization_slot
from dav58_live_guard import IncrementalGuard

if settled_policy == "v14":
if settled_policy == "v15":
original = _validate_rollover_history(sources, settled_policy="v14")
identity, fingerprints = V15_ROLLOVER_IDENTITY, V15_ROLLOVER_SHA256
totals, history = (103, 35_648, 922_800), REVALIDATION_V16_HISTORY
elif settled_policy == "v14":
original = _validate_rollover_history(sources, settled_policy="v13")
identity, fingerprints = V14_ROLLOVER_IDENTITY, V14_ROLLOVER_SHA256
totals, history = (97, 33_416, 872_400), REVALIDATION_V15_HISTORY
Expand Down Expand Up @@ -367,7 +384,7 @@ def _validate_rollover_history(sources, *, settled_policy="v1"):
try:
# Validate sealed receipts without making the permanently halted journal resumable.
receipt_view = guard
if settled_policy in {"v13", "v14"}:
if settled_policy in {"v13", "v14", "v15"}:
if guard.get("halted") is not True:
raise PeriodError("previous guard must be permanently halted")
receipt_view = {**guard, "halted": False}
Expand All @@ -380,10 +397,12 @@ def _validate_rollover_history(sources, *, settled_policy="v1"):


def validate_history(sources, *, policy_id="acceptance-revalidation-v1"):
from authorized_budget_period import REVALIDATION_V13_POLICY_ID, REVALIDATION_V14_POLICY_ID, REVALIDATION_V15_POLICY_ID
from authorized_budget_period import REVALIDATION_V13_POLICY_ID, REVALIDATION_V14_POLICY_ID, REVALIDATION_V15_POLICY_ID, REVALIDATION_V16_POLICY_ID
from authorized_budget_period import PeriodError, REVALIDATION_HISTORY, _parent, _file
from authorized_budget_period import REVALIDATION_POLICY_ID, REVALIDATION_V2_POLICY_ID, REVALIDATION_V3_POLICY_ID, REVALIDATION_V4_POLICY_ID, REVALIDATION_V5_POLICY_ID, REVALIDATION_V6_POLICY_ID, REVALIDATION_V7_POLICY_ID, REVALIDATION_V8_POLICY_ID, REVALIDATION_V9_POLICY_ID, REVALIDATION_V10_POLICY_ID, REVALIDATION_V11_POLICY_ID, REVALIDATION_V12_POLICY_ID

if policy_id == REVALIDATION_V16_POLICY_ID:
return _validate_rollover_history(sources, settled_policy="v15")
if policy_id == REVALIDATION_V14_POLICY_ID:
return _validate_rollover_history(sources, settled_policy="v13")
if policy_id == REVALIDATION_V15_POLICY_ID:
Expand Down
18 changes: 18 additions & 0 deletions services/agent/tests/test_v16_confirmation_history.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from authorized_budget_period import policy_for


def test_confirmation_revalidation_retains_settled_v15_and_unknown_liabilities():
old = policy_for("acceptance-revalidation-v15")
policy = policy_for("acceptance-revalidation-v16")
history = policy["history"]
assert history["attempts"] == old["history"]["attempts"] + 103 == 1286
assert history["known_actual_micro_usd"] == old["history"]["known_actual_micro_usd"] + 35648 == 365717
assert history["known_committed_micro_usd"] == old["history"]["known_committed_micro_usd"] + 922800 == 11363714
assert history["unknown_attempts"] == old["history"]["unknown_attempts"] == 3
assert history["unknown_encumbrance_micro_usd"] == old["history"]["unknown_encumbrance_micro_usd"] == 2359296
assert history["cumulative_limit_micro_usd"] == old["history"]["cumulative_limit_micro_usd"] == 200000000
assert history["cumulative_attempt_limit"] == history["attempts"] + policy["attempts"] == 1527
assert policy["lanes"] == old["lanes"]
assert policy["limit_micro_usd"] == old["limit_micro_usd"]
assert (history["known_committed_micro_usd"] + history["unknown_encumbrance_micro_usd"]
+ policy["limit_micro_usd"] <= history["cumulative_limit_micro_usd"])
Loading