Repository navigation
proposals/execute: name the cause of each not_executable refusal - #98
Open
ayushsingh82 wants to merge 1 commit into
Open
ayushsingh82 wants to merge 1 commit into
ayushsingh82 wants to merge 1 commit into
Conversation
A not_executable refusal now carries `causes`, one { cause, retry } per
problem in the order the message gives them, next to the existing `error`
and `code`. `retry` is now, later, owner or never, so an app can say what
happens next without parsing text. A cost_limit also carries worstCostBps
and maxCostBps, and is `never` once the quote's own slippage margin is over
the limit.
The checks (checkPlan, feasibility, quoteChosen, the proposal's pre-claim
checks) classify each problem; the plan stream's `rejected` event and the
owner client's `refused` failure carry the optional `causes`. Hosts older
than this change send none. SDK 0.6.1 (patch: an optional field).
Closes MultiAgency#97
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.
Closes #97
What changed
A
not_executablerefusal fromproposals/executenow carriescausesbesideerrorandcode: one{ cause, retry }per problem, in the order the message gives them.retrysays what happens next without parsing text:now: a race; trying again may pass at once.later: may clear without the owner (prices, quotes, the provider).owner: needs an owner action outside this proposal.never: this proposal can't pass; read it again, or propose anew.All 17 causes in the issue table are implemented (
src/planning/causes.ts).code,errorand the HTTP status are unchanged.checkPlan,feasibilityandquoteChosenclassify each problem. The string-returningcheckPlanandfeasibilitykeep their signatures;checkPlanCausedandfeasibilityCausedare the structured forms.beforeClaim) return their own causes:no_grant,cash_floor,policy_not_in_force,approval_mismatch,record_changed,claimed.rejectedevent gets an optionalcauses, set only when every problem has one, so it lines up with the message.refusedfailure getscauses?: RefusalCause[](REFUSAL_CAUSES,refusalCause). Only causes it can validate are passed on. A host older than this change sends none.docs/sdk-changes.md(new 0.6.1 heading,package-version.tsmoved to 0.6.1 as a patch, per the rule in that file: an optional field is an addition).Decisions for review
cost_limitretry class. The issue saysnever"once the limit, not the quote, binds" without defining it. I used:neverwhen the quote's slippage margin alone (worst-case cost minus expected cost) is over the limit, so no quote can meet it; otherwiselater. Both numbers are carried (worstCostBps,maxCostBps). The 97 bps vs 50 bps case in the issue isneverunder this rule.provider_warning.strategy_changedbefore a claim isnow, as in the table, thoughexecuteProposalinvalidates a proposal whose strategy changed on the next call, so the next answer is a read of the invalidated proposal.plan-recovery.test.ts,planning-valuation.test.ts) compared the wholerejectedevent, which now includescauses; updated.What I ran
Node 24.22.0, pnpm 12.16.1 (the pinned 12.15.0 was not usable in my cache):
pnpm typecheck: passes.pnpm test(offline): 1,539 pass, 0 fail, including new tests forfloor,provider_warning,no_grant,cash_floorand bothcost_limitclasses.pnpm evidence:check: passes.Not run:
pnpm test:e2e,verify-skills(the skill text changed), the browser suites, and anything live. The sdk-changes.md heading says "unreleased"; the release commit still dates it. Treasury needs no change to keep working; showing the causes in its UI is a follow-up.