Repository navigation
Evidence-based failure classification and reported-cost budget input - #67
Open
MarouaBoud wants to merge 3 commits into
Open
MarouaBoud wants to merge 3 commits into
MarouaBoud wants to merge 3 commits into
Conversation
Co-Authored-By: Lagartha <ionanova22@gmail.com>
…ted cost detectFailure records heartbeat-timeout or deadline-expiry evidence; reportFailure records agent-attested evidence; reportCost feeds B = (escrow - costAccrued) / escrow into both routers. Checkpoint count no longer sets the failure class. Co-Authored-By: Lagartha <ionanova22@gmail.com>
…detection Co-Authored-By: Lagartha <ionanova22@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Failure evidence. Every failure is recorded with its source:
HEARTBEAT_TIMEOUTdetectFailure)DEADLINE_EXPIREDdetectFailure)AGENT_REPORTreportFailure)libraries/FailureTaxonomy.sol). Checkpoint count no longer sets the class (previously 0 → LIVENESS, 1–2 → RESOURCE, ≥3 → LIVENESS, which scored early progress lower than none). LOGIC is reachable through an agent report.detectFailuresucceeds when the deadline has passed, even while the agent keeps sending heartbeats. Before, such a task could neither complete (completeTaskreverts past the deadline) nor be failed (TaskNotStale).HEARTBEAT_MISSandDEADLINE_EXCEEDEDcannot be self-reported.Budget input B.
reportCost(taskId, cumulativeCost)(current agent, monotone, clamped to the escrow) storescostAccrued. Both routers computeB = (escrow − costAccrued) / escrow; B was previously 1 for every funded task. Settlement does not usecostAccrued. Reported cost reaching the escrow classifies a heartbeat timeout as RESOURCE /BUDGET_EXHAUSTED.Interface.
IRecoveryRouter.classifyAndScore(bytes32, FailureEvidence)replaces the five-argument version.FailureTypegainsBUDGET_EXHAUSTEDandDEADLINE_EXCEEDED(appended; existing ordinals unchanged).TaskgainscostAccrued,failureEvidenceSource,failureEvidenceCID(appended). New eventsCostReported,FailureEvidenceRecorded; new errorsCostNotMonotonic,InvalidFailureReport.CairnCoreUpgradeable,RecoveryRouterandRecoveryRouterUpgradeablecarry the same changes.Consumer ABIs (frontend, SDK, subgraph, pipeline) move with the redeploy.
Verification
forge test: 443 passing (408 existing, updated where they asserted the checkpoint-count classification; 35 new inFailureEvidence.t.solandupgrades/CairnCoreUpgrade.t.sol).CairnCore95.29%,RecoveryRouter100%,RecoveryRouterV2100%,FailureTaxonomy100%.CairnCore17.3 KB (limit 24 KB).detectFailure185,465 (was 171,985; stores evidence source and CID, one more event);RecoveryRouterV2.classifyAndScore52,401 (was 51,764);reportCost42,697;reportFailure179,679.