grants: 🐛 Bound evidence reads and bind Orca lanes to their Run coordinator's grants - #281
Merged
Merged
Conversation
… host's refusals Limit root excerpts to a trailing 16 MiB window starting at a whole line. Read older owner words from live recorded evidence; exclude expired records. Report snapshot host errors without changing admission limits. Update evidence docs and correct the documented ask expiry to 7 days. Cover excerpt boundaries, recorded words, expiry, and host errors in tests.
Record each attended session's Orca terminal in the grant store, once per session. Resolve a lane's Run and coordinator terminal with orca orchestration worker-list and run-show. Adopt the coordinator tree's grants into the lane tree, logged as agent orca:<run>. Cache the Run lookup per session; outside Orca nothing binds. Scrub ambient Orca session variables in the test suite.
…ned, revalidated coordinator Adopt only spendable grants, never the coordinator's recorded words or asks. Pin the coordinator session per Run and terminal; a reused terminal lends nothing. Revalidate the Run binding after one minute or a terminal change. Pass expired owner records said after a grant to its judge, so a withdrawal never lapses.
Resolve a lane's dispatch with the sessions pack's worker_of and orca_json, which page Orca's worker list unscoped and tolerate its page shapes, instead of a second Orca client. Stub the binding in the sessions recheck test, which scripts each worker_of reply.
yasyf
force-pushed
the
feat/grants-core-3
branch
from
October 3, 2026 06:17
5fcbb11 to
8cccc06
Compare
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
Replaying the Slack hook against a 206 MB root transcript produced 6 evidence-read refusals in 54 runs at 18 parallel cold processes. The snapshot admission queue caused those refusals; the bridge hid the host's error. Separately,
root_excerptscanned the whole root transcript five times per event.What
root_excerptto the trailingtail_bytes, defaulting to 16 MiB, starting at the first whole line. Older owner words reach grant judges through recordedwordsandaskrecords.recorded(evt, kind)betweenOwnerWordsandAsked. Both require unexpired, unrevoked records; previously, expiredwordsrecords remained readable.snapshot host failed the request: <host error>. Admission limits stay unchanged. At 18 parallel processes, refusals still occur, now reported assnapshot admission queue exhausted.askexpiry; remove promises of whole-transcript access from docstrings.Orca lanes
The root's ruling on the owner's answer ("Allow cross-root sharing by agents"): an Orca lane of the same Run reads the root's grants with no manual adopt.
generalpack records the Orca terminal (ORCA_TERMINAL_HANDLE) of each attended session (CLAUDE_CODE_SESSION_ATTENDED=1) in a neworca_terminalstable, once per session. A nestedclaude -preportsCLAUDE_CODE_SESSION_ATTENDED=0and records nothing.orca orchestration worker-listfinds the dispatched worker for that terminal, andrun-showgives the Run's coordinator terminal. The coordinator's session tree comes from the recorded terminal, and its grants are adopted into the lane's tree as logged adoptions with agentorca:<run>, so spends stay shared and appear ingrant show.run_7715a23a5657and its coordinator terminal; the coordinator's own terminal resolves to no Run.Review fixes on the Orca binding:
wordsandaskrecords stay in its tree, so a lane cannot mint a fresh budget from an approval the coordinator already spent; one approval spends once.wordsandaskrecords said after the grant was minted whose records have expired, so an expired record never ends a withdrawal while the grant stays usable. A withdrawal the judge sees revokes the grant.Accepted risk:
ORCA_TERMINAL_HANDLEandCLAUDE_CODE_SESSION_ATTENDEDcome from the session environment, and an agent that sets them on purpose can claim another terminal's binding or replace a terminal record. Hooks catch agent mistakes, not deliberate forgery, as with #278's forged-receipt ruling. The same limit means a coordinator terminal that starts an unrelated session before a lane first binds hands the lane that session, and a resumed original session does not reclaim its terminal record; both cases leave existing bindings refusing rather than lending.Measurements
The same replay on the 206 MB transcript measured:
Median wall time remained about 10 s, dominated by judge calls and process startup.
Tests
wordsrecords, excerpt windows starting mid-line or at a line boundary, and host error reporting.test_grants.py,test_dispatch.py,test_public_api.py,test_context.py,test_snapshot_owner.py, andtest_pack_graphite.py; 427 passed across the pack, inline, and lint suites.notourswas expected to allow; it also refused in both versions as the judge's reading of the ruling's “one-line” scope varied. Its excerpt was unchanged.