Repository navigation
Conversation
Per-call caps bounded request size, not money: CUDLY_MCP_MAX_COUNT=50 still admitted 50 x u-24tb1, roughly $286M over three years. Real purchases now also need CUDLY_MCP_MAX_COMMITMENT_USD. An unset or invalid value refuses before credentials are resolved; after ResolveClient the purchase is priced with the helpers from the previous commit and refused when its total exceeds the cap, before an idempotency token is derived or anything is bought. Real GCP CUD purchases are now refused until the library pin includes the CUD pricing fix (go#321, follow-up #67). GCP tests that asserted a successful real purchase now assert the refusal; #67 restores them. ExecutePurchase's response tail moves into purchaseResponse to stay under the gocyclo limit. Manifest, server.json, README and CHANGELOG document the new required setting. Refs #51 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Merge-driver verdict: CLEAN at Scope. This reviews the delta Verified:
Mutation probes (3), all killed:
Local verification on macOS (real runs, fixture and mock pricing, no cloud calls):
Non-blocking notes (for follow-up):
Gate status:
|
|
Follow-ups for the non-blocking notes:
|
|
Automated review of
Posted by a read-only review sweep. It stays silent on this commit and re-reviews only after a new push. |
Summary
This is part 2 of 3 for #51. It is stacked on #66: the base is
feat/51-usd-spend-cap, so merge #66 first and then retarget this PR to main.The existing per-call caps bound request size, not money:
CUDLY_MCP_MAX_COUNT=50still admitted 50 xu-24tb1, roughly $286M over three years. Real purchases now also requireCUDLY_MCP_MAX_COMMITMENT_USD.authorizeRealPurchasereads the USD cap. Unset, empty, non-numeric, NaN, Inf or <= 0 refuses the purchase beforeResolveClient, with no credential or network use. The parsed limit is passed down, so the env var is read once.ResolveClient, before the idempotency token orPurchaseCommitment:enforceUSDCap(from feat(tools): compute the total USD a purchase commits #66) prices the purchase and refuses a total above the cap. A purchase it cannot price is refused too.ExecutePurchase's response tail moved intopurchaseResponse, which keeps the function under the gocyclo limit. This is a pure extraction.mcpb/manifest.json: env var in all 3 platform blocks, plus amax_commitment_usduser setting whose title matches the refusal message.server.jsonBreaking/Added/Securityentries.Refs #51 (the issue stays open for part 3, the cumulative budget)
Test changes that narrow coverage (deliberate)
Under the GCP refusal, four tests that asserted a successful real GCP purchase now assert the refusal:
TestGCPComputeEngineCUDPurchaseHandleRealPurchaseTestGCPComputeEngineCUDPurchaseStructuredCost(explicit-zero cost, fix(deps): adopt reviewed cloud-commitments-go purchase safeguards #35/test(gcp): cover adopted purchase safeguards in MCP consumer #43)TestSpendCapCountAcrossEveryCountBearingBuilderTestSpendCapGCPMemoryThe over-cap refusals are still asserted. The library-boundary GCP cost proof stays in
tools/gcp_computeengine_cud_safeguards_test.go. #67 lists all four tests to restore. No test-only bypass seam was added.rdsOfferingintools/adopted_go_safeguards_test.gogains a price and currency, because the real RDS library path now has to clear the cap.Verification (local, macOS, at d2e389b)
Fake-cloud and unit evidence only. No real purchase or cloud call is made.
gofmt,go vet ./...andmake buildpass.go test -race -count=1 ./...passes in all 3 packages. golangci-lint and gosec, both run withGOTOOLCHAIN=go1.26.9, report 0 issues.gocyclo -over 10lists no non-test code. markdownlint passes on README and CHANGELOG, and both JSON files parse.TestUSDCapRegressionExpensiveRI(EC2u-24tb1x 50, $5.72M each, cap $1000). Without theenforceUSDCapcall the purchase executes (purchaseCalls == 1, the test fails). With it the call is refused, namingCUDLY_MCP_MAX_COMMITMENT_USD, withpurchaseCalls == 0after the client resolved.TestUSDCapUnsetRefusesBeforeResolvechecks that an unset cap leaves the client unresolved and makes no offering call.PurchaseCommitmentReview
An independent reviewer (Sonnet, high effort, non-author) did two passes. Pass 1 found no high or medium issues. It traced all 8
ExecutePurchasecall sites to the single choke point, confirmed previews stay offline, and confirmed thepurchaseResponseextraction preserves behaviour. Its four low findings were handled as follows:ResolveClient: accepted. It needs no network, and the docs only promise a pre-credential refusal for an unset cap.Pass 2 found no actionable findings. CodeRabbit is not pinged because the org's CR quota is exhausted.
🤖 Generated with Claude Code