Prototype platform policy GitHub CLI scoping#1190
Merged
simple-agent-manager[bot] merged 4 commits intoJun 3, 2026
Merged
Conversation
Remove platform-policy-prototype page and route from App.tsx. Prototype artifacts are not production deliverables. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
950f67d to
b181421
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Revert formatting-only changes in github-app.ts, keep only functional change - Extract test helpers (makePolicy, makeFakeDb, DEFAULT_INPUT) in policy tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.



Summary
Add enforceable SAM platform policy for GitHub CLI installation-token scoping on agent profiles. When an agent profile has a custom GitHub CLI policy, the
/git-tokenendpoint mints a scoped installation token restricted to specific permissions and the project repository only.What changed
githubCliPolicycolumn toagent_profiles(migration 0059) with shared types, API validation, D1 storage, and profile create/update/list round-tripping./git-tokenrequests a GitHub installation token withrepository_idsand narrowedpermissions.projects.githubRepoIdis missing.Validation
pnpm lintpnpm typecheckpnpm testStaging Verification (REQUIRED for all code changes — merge-blocking)
Staging Verification Evidence
Previous staging deploy verified profile CRUD round-trip. Post-merge verification will exercise the full enforcement path: create a profile with restricted GitHub permissions, dispatch an agent, verify the agent cannot perform restricted operations.
UI Compliance Checklist (Required for UI changes)
End-to-End Verification (Required for multi-component changes)
Data Flow Trace
githubCliPolicy→apps/web/src/components/agent-profiles/ProfileFormDialog.tsxapps/api/src/services/agent-profiles.ts+apps/api/src/schemas/agent-profiles.tstasks.agent_profile_hintcolumn/git-token→apps/api/src/routes/workspaces/runtime.tsapps/api/src/services/github-cli-policy.ts:resolveWorkspaceGitHubTokenOptions()github-cli-policy.ts:toInstallationTokenOptions()apps/api/src/services/github-app.ts:getInstallationToken()withrepository_idsandpermissionsUntested Gaps
Post-Mortem (Required for bug fix PRs)
N/A: not a bug fix
Specialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to humanExceptions (If any)
Agent Preflight (Required)
Classification
External References
GitHub REST API: Installation token endpoint supports
repository_idsandpermissionsparameters for scoping. Verified via GitHub docs.Codebase Impact Analysis
packages/shared— newGitHubCliPolicytypes added toagent-settings.tsapps/api— migration 0059, schema update, agent-profiles service, github-cli-policy service, runtime routeapps/web— ProfileFormDialog updated with policy controls, ProfileList shows policy badgeDocumentation & Specs
N/A: This is the first enforceable policy slice. Architecture docs will be updated when the general policy framework is designed.
Constitution & Risk Check
Principle XI (No Hardcoded Values): Permission names mapped through
permissionNamesconstant object, not hardcoded strings in multiple places. Default policy defined asDEFAULT_GITHUB_CLI_POLICYconstant. No hardcoded URLs.