Permission v0.1: deterministic policy and human decision flow - #22
Open
tim8es wants to merge 11 commits into
Open
Permission v0.1: deterministic policy and human decision flow#22tim8es wants to merge 11 commits into
tim8es wants to merge 11 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Purpose
Implement GitHub issue #15: the smallest deterministic Permission Engine required by MindRail protocol v0.1. Model/LLM output is never execution authority; policy authority is explicit, deterministic, versioned, and fail-closed.
Closes #15.
Scope
Implemented
RequestPermissionandRecordPermissionDecisionfor the in-memory reference runtime and protocol dispatcher.Exact default policy semantics (
PolicyRef { id: "mindrail.permission", version: "0.1.0" }):workspace.readALLOWpolicy.automatic_allowexternal.publishDENYpolicy.deniedrepository.writeHUMAN_REQUIREDpolicy.human_requiredDENYpolicy.no_matching_ruleRequestPermission:PermissionRequest;PermissionDecisionwith system actorsystem:mindrail.permission-policy, exactPolicyRef, and no superseded predecessor;PolicyRef, or invalid evaluation shape fails closed withPOLICY_UNAVAILABLEand appends no records.RecordPermissionDecision:ALLOW/DENY;expectedPreviousDecisionIdto name the latest decision and requires the latest outcome to beHUMAN_REQUIRED;basis=human, next sequence, andsupersedesDecisionId;Grant effectiveness is deliberately separate from audit history: an
ALLOWapplies only to its exact request authority tuple(workspace, task, session, lease, fencingToken)and is effective only while the existing runtime authority checker still accepts that tuple. A late human decision may finish audit history after authority loss, but cannot revive the old execution or transfer a grant to replacement execution authority.Intentionally out of scope: OAuth/IAM/auth-provider integration, credentials/tokens, model calls, arbitrary tools, network calls, policy DSL/interpreter, persistence, HTTP/MCP transports, or Domain Contract changes.
Architecture / ADR impact
Details:
src/policy/permission-policy.ts.src/runtime/permission-service.ts.in-memory-control-plane.tshas only the constructor/delegation/dispatch seam and directly reusesrequireExecutorAuthority; no second execution-authority implementation was introduced.mainremained exactly at common base87fbfcf2ed738071f648a3b94bfff1df1f235dbaduring final diff review, so there was no current parallel-stream merge conflict. Runtime/protocol files are expected integration hotspots if sibling streams merge first.Verification evidence
Mandatory TDD RED was obtained before production implementation:
Fresh GREEN branch verification after implementation, formatting, and invalid-policy regressions:
Permanent PR
Qualityverification on the final feature head:Documentation
docs/CURRENT_STATE.mdremains accurate.Security / permissions
No credentials, external IAM authority, network access, or persistence were added. A MindRail
ALLOWdoes not create credentials and cannot bypass host/IAM/sandbox/tool approval.HUMAN_REQUIREDcreates no grant. Policy authority is system-authored and deterministic; model/LLM output is not consulted.Final diff review found:
The permanent
Qualityworkflow remains read-only and now executespnpm test:coverageafterpnpm check, so the required frozen install, full check, and coverage commands are all permanent PR-gate evidence.Limitations / unverified claims
ALLOWis only a MindRail decision record/effectiveness check. External hosts, IAM, sandboxes, and tools retain their own authority and approval requirements.Review gate