grants: ✨ Counted judge grants, cross-tree adoption, and downstream spending - #277
Merged
Merged
Conversation
…pending Context: the owner approved the grants design with changes: multi-spend, Slack enforcement in cc-slack, and agent cross-root sharing. Summary: GrantVerdict.uses mints an N-use grant from quoted words; capt-hook grant adopt shares a grant into another tree with a logged adoption; Grants(spent_by=...) names a grant without reserving and capt-hook grant spend lets the downstream system pay. Motivation: cc-slack must enforce and spend Slack grants itself, and lanes in other roots must use what the owner gave the root. Details: one approval now keys standing, counted, and one-shot mints alike, so the same words never mint twice; grant show leads with the remaining uses.
… name unknown grants Context: the cc-slack lane consuming #277 found three defects. Summary: the inline-test LLM stub fills None-default fields with None; a spent_by check lets a one-shot retry of the same payload through; grant spend on an unknown id exits with its reason. Motivation: the stub filled GrantVerdict.uses with an empty string, failing every judge-stubbed hook test, and a lost reply could never be retried through cc-slack. Details: two tests cover the retry and the unknown id; Slack hook (399) and general pack (941) inline tests pass.
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 owner asked for these changes to the grants design:
What
GrantVerdict.usesto mint counted grants from the owner's quoted words.capt-hook grant adopt, which agents can run to share a grant across roots. Both roots spend from the same budget. Theadoptionstable logs the destination tree, timestamp, session, and agent.Grants(spent_by=...)to name a covering grant without reserving a use, andcapt-hook grant spendto commit the use downstream. The command returns the grant and remaining uses as JSON, or exits non-zero with a reason when it cannot spend. The first spender is thecc-slackdaemon, with integration in a follow-up monorepo PR.grant showlead with remaining uses or the reason the grant is unusable, followed by its record, adoptions, and spends.Tests
tests/test_grants.pycovering counted grants, adoption with a shared budget, downstream spending through the CLI, and refusal to spend from another tree without adoption.tests/test_grants.py,tests/test_dispatch.py, andtests/test_public_api.py.