Repository navigation
Conversation
…gures The agent zone meters its own runs, so a capped budget was only as hard as that zone is honest. An Owner can now name Anthropic or OpenAI as cost sources for a capped budget with a period. The control zone reads each provider's admin cost API for the factory's own workspace or project every 15 minutes and stores the figure where only it can write. The gate counts a period as having spent the larger of the agents' reports and the providers' figures. A named provider whose figure is missing, damaged or read more than two hours ago holds new capped runs and never a rollback, so a missing key or an outage fails closed. Amounts are parsed as exact decimals, only USD is accepted, and no redirect is followed with an admin key. Signed-off-by: Goon <duy@wearetopgroup.com>
…t/provider-cost-floor
…r a failed read A damaged figure answered TAMPERED, which stopped a rollback and did not hold every claim; it now holds capped runs like a missing one. The control pass runs every second, so a failed read is now retried after a minute instead of on every pass. State plainly that the gate runs in the agent zone, so the floor corrects wrong reports but cannot stop an agent zone taken over as a whole. Signed-off-by: Goon <duy@wearetopgroup.com>
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.
Why
The agent zone meters its own runs, so a capped budget was only as hard as the reported costs are honest. ADR 0007 states this limit. This PR proposes ADR 0027: the providers' own billing figure bounds what the agents report. ADR 0027 is
proposedand needs the Owner's acceptance.What
budget.settakesprovider_cost_sources(anthropic,openai). Only a capped budget with a period accepts it, andbudget.setwarns when a source is removed.install/provider_spend. Only the control zone writes that key; the agent zone can read it but not write it, in the store and in the PostgreSQL row policies. No migration is needed.SISF_ANTHROPIC_ADMIN_KEYandSISF_OPENAI_ADMIN_KEY. Each must be set with its scope,SISF_ANTHROPIC_COST_WORKSPACEorSISF_OPENAI_COST_PROJECT. No agent environment accepts aSISF_variable.budget.getshowsprovider_spent_microsand warns when the providers report more than the agents.BUDGET_EXCEEDED. A rollback is never held.Limits
budget.get(fed by the control zone's figure) is how the Owner sees what was really spent.Files outside the feature
tests/docs/brief_parity_test.gonow counts 27 ADRs and lists 0027 as proposed, as earlier ADRs did.Verification
go generateleaves no diff;gofmt,go vetandgolangci-lintare clean (0 issues).go test ./...passes.-racepasses oninternal/budget/...,cmd/factoryd/...,internal/testkit/...,internal/dispatcher/...andtests/docs.-racepasses oninternal/budgetagainst PostgreSQL. On PostgreSQL, the agent role cannot change the figure over plain SQL.