Repository navigation
Follow-up: permit-bound callers, Python 3.9 import, and docs - #36
Conversation
Examples, HTTP adapters, and the SDK now issue or forward a permit bound to the exact call. Ambiguity is always denied, a halted kernel stays halted across StateMachine.reset, and the async path delegates to the synchronous kernel. The audit ledger stays in memory and says so. Co-authored-by: Ayai <shards-inc@engineer.com>
load_verified annotated a union with the | operator. Python 3.9 evaluates that at import and the 3.9 CI job could not collect tests. Co-authored-by: Ayai <shards-inc@engineer.com>
RequestBuilder and PolicyBuilder now emit a KernelRequest and a JurisdictionPolicy the kernel can boot. The cookbook, security notes, whitepaper, quick start, and API reference use that path. The coverage gate is 66%. Co-authored-by: Ayai <shards-inc@engineer.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| try: | ||
| result = governed_browse(url="https://example.com/final-research") | ||
| final_browse = {"url": "https://example.com/final-research"} | ||
| result = governed_browse( |
| try: | ||
| result = governed_read(path="/data/final-notes.txt") | ||
| final_read = {"path": "/data/final-notes.txt"} | ||
| result = governed_read( |
| HAS_FASTAPI = False | ||
|
|
||
| try: | ||
| import flask # noqa: F401 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f66b788b2f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| permits = permits or [None] * len(requests) | ||
| receipts = [] | ||
| for request, permit in zip(requests, permits): | ||
| receipts.append(await kernel.submit(request, permit)) |
There was a problem hiding this comment.
Preserve one result for every batched request
When permits is a nonempty list shorter than requests, zip silently stops at the shorter list, so trailing requests are never submitted and the caller receives fewer receipts than requests. Validate that the two lists have equal length (or explicitly pad missing permits) before iterating so a malformed batch cannot silently drop governed work.
Useful? React with 👍 / 👎.
| def submit( | ||
| self, | ||
| request: Request, | ||
| permit_token: Optional[PermitToken] = None, | ||
| ) -> Receipt: |
There was a problem hiding this comment.
Allow SDK batch callers to supply permits
When a KernelClient or AsyncKernelClient caller batches tool requests that require permits, both submit_batch implementations invoke submit without a permit and expose no way to provide one, so every otherwise authorized tool call is denied with MISSING_PERMIT. Accept a corresponding permit collection and forward each token, as the new single-request API does.
Useful? React with 👍 / 👎.
Description
Follow-up to merged PR #35 (
7e06e1b). That merge landed the first fail-closed change and left two GitHub Actions jobs red: Python 3.9 could not importAuditLedger, and the docs build rejected links outside the docs tree. The caller, async, and ambiguity work that was still on the branch is included here.This pull request adds:
load_verifiedno longer evaluatestuple | listat import. Annotations are postponed.docs/README.mdpoints at the repository README and spec with GitHub URLs, somkdocs build --strictpasses.scripts/smoke.shruns each example. Adapter tests allow a valid permit and deny a missing or mismatched one.AsyncDispatcher.dispatchdoes not run a tool.StateMachine.reset()does not resume a halted kernel.fail_closed=False. Ambiguous requests are always denied. The flag is not an opt-out.KernelRequest,boot(KernelConfig), andsubmit(..., permit_token=permit).RequestBuilderandPolicyBuildernow build those objects.PolicyBuilder.with_custom_ruleraises, becauseJurisdictionPolicyhas no custom-rule field.The audit ledger stays in process memory. It does not fsync. Ed25519, a README rewrite, a PyPI rename, and repository-wide ruff/mypy remain out of scope.
Do not merge. This is for review.
Type of Change
Related Issues
Follow-up to #35. No separate issue number.
Invariant Compliance
Testing
Local, Python 3.12, head of this branch:
ruff check . --select E,F --ignore E501passed./scripts/smoke.shpassedmkdocs build --strictpassedDocumentation
spec/AUDIT.mdalready states the in-memory ledger. This change updates the cookbook, security notes, whitepaper, quick start, and API reference. Narrative guides underdocs/guidesother than the cookbook and quick start, and the operations playbook, still sketch older constructors.Checklist