Repository navigation
Description
Problem
Each installation token of a roadmap Job asks for the one set CONST_GITHUB_APP_TOKEN_PERMISSIONS in src/devops_cli/config/constants.py: contents: write, issues: write, pull_requests: write and workflows: write, with others. ADR 0030 says: "Until #3700, one process mints one token for the three phases, so the token keeps workflows: write."
#3700 is live since 2026-11-22. prepare and publish now run in their own containers and mint their own tokens. prepare only reads: it clones and reads the item and the pull request. But its token can still write contents and workflow files.
Change
- Give each phase a token with only the permissions that it uses.
preparegets read permissions. publishasks forworkflows: writeonly when the merged plan names a workflow file, whichpublishalready checks.- Change ADR 0030 and the token documents to match.
Acceptance criteria
- A test shows the permissions that the token of
prepareasks for, and that they hold no write. - A test shows that
publishasks forworkflows: writeonly for a plan that names a workflow file. - ADR 0030 has no "Until feat(roadmap): add the three-container runner Job, policy and log reads #3700" line about the token.
Dependencies
Source
Source: #3700
Alternatives check of 2026-11-23: none.
Tool: none found.
Reason: Searches found only GitHub Actions token actions and Python API clients that accept a permission map; none scopes this repository's prepare and publish tokens, tests them, or updates ADR 0030, so the change stays in-house.
Lacks:
- No tool mints a read-only token for the prepare phase
- No tool ties workflows: write to the merged plan's files
- No tool rewrites ADR 0030 or the token documents
- No tool adds the two permission tests the issue requires
Proposed design
Problem statement
The installation token of each roadmap Job asks for the one set CONST_GITHUB_APP_TOKEN_PERMISSIONS, which holds contents: write, issues: write, pull_requests: write and workflows: write. Since #3700 the prepare and publish phases run in their own containers and mint their own tokens. prepare writes issue status and marks, and it reads checks and Actions runs, but its token can still write contents and workflow files. The change gives each phase a token with only the permissions that it uses, and removes the Until #3700 sentence from ADR 0030.
Acceptance criteria
Requirement: Prepare token holds the permissions of the prepare phase
The installation token of each prepare phase SHALL request contents: read, pull_requests: read, issues: write, checks: read and actions: read, and SHALL NOT request workflows.
Scenario: Prepare phase token request
- WHEN the test builds the token request of the
preparephase with a fake GitHub client - THEN the requested permissions equal
contents: read,pull_requests: read,issues: write,checks: readandactions: read, and hold noworkflowskey.
Requirement: Publish token omits workflows write for a plan with no workflow file
The publish phase SHALL NOT request workflows: write when the merged plan names no workflow file.
Scenario: Publish token for a plan with no workflow file
- WHEN the test builds the token request of
publishfor a merged plan that names no file under.github/workflows/ - THEN the requested permissions hold no
workflowskey, andcontentsandpull_requestsstaywrite.
Requirement: Publish token asks workflows write for a workflow file
The publish phase MUST request workflows: write when the merged plan names a workflow file.
Scenario: Publish token for a plan with a workflow file
- WHEN the test builds the token request of
publishfor a merged plan that names.github/workflows/ci.yml - THEN the requested permissions hold
workflows: write.
Requirement: ADR 0030 has no deferred token sentence
ADR 0030 SHALL hold no Until #3700 sentence about the token.
Scenario: ADR 0030 text
- WHEN
rg -n 'Until #3700' docs/adr/0030-roadmap-steps-run-their-agent-apart-from-the-app-key.mdruns - THEN it prints no match.
Existing Tool Considered
The alternatives check of 2026-11-23 in the issue body gives the verdict none with Tool: none found, and the Lacks: list of that block holds the reasons; the change covers each reason in-house. Cost to build: about 2 500 tokens of edits (one map for prepare, one builder for publish, two call sites, two tests and the ADR text) and about 30 minutes of review. Cost to keep: low, because a permission map changes only when a phase changes the GitHub calls that it makes.
Key questions
- Which permissions does the
preparephase request?: The permissions that the phase uses:contents: readto clone,pull_requests: readto read the pull request,issues: writeto write the status, the marks and the stage records, andchecks: readandactions: readto read the check runs and the Actions runs. The set holds noworkflowskey. The implement, stage, fix-checks and fix-conflict prepare phases share this one map, because each makes the same calls. (best practice) [sources: src/devops_cli/config/constants.py:1628, src/devops_cli/roadmap/implement/implement_phases.py:309, src/devops_cli/roadmap/stores/github_store.py:1087, src/devops_cli/roadmap/stage/stage_job_phases.py:387, src/devops_cli/roadmap/steps/fix_checks_phases.py:301]- Chosen: Read for contents, pull requests, checks and actions, and write for issues. It covers the clone, the two reads and the issue writes that each prepare phase makes, and it removes
contents: writeandworkflows: write. - Rejected: Read-only set with no write permission. The prepare phase calls
write_status,set_marks,StageWriter.begin,settleandjudge_round, so a read-only token fails at the first issue write. - Rejected: Keep the one shared write set. It keeps
contents: writeandworkflows: writein a phase that uses neither.
- Chosen: Read for contents, pull requests, checks and actions, and write for issues. It covers the clone, the two reads and the issue writes that each prepare phase makes, and it removes
- How does
publishdecide to ask forworkflows: write?: The token request takes the flag thatpublishalready computes from the merged plan's file list. The flag is true only when the plan names a path under.github/workflows/, and the permission builder addsworkflows: writeonly then. (best practice) [sources: src/devops_cli/github/app_installation.py, tests/roadmap/phases/test_roadmap_phase_publish.py]- Chosen: Reuse the merged-plan check that
publishruns. The phase reads the merged plan already, so one boolean drives the token request and no second scan is needed. - Rejected: Read the plan a second time in the token helper. It puts the same check in two modules, and the two can disagree.
- Rejected: Always request
workflows: write. It keeps the over-broad grant that the issue removes.
- Chosen: Reuse the merged-plan check that
- Where do the per-phase permission maps live?: In
src/devops_cli/config/constants.py, besideCONST_GITHUB_APP_TOKEN_PERMISSIONS: one map forprepareand one builder forpublishthat addsworkflows: writewhen its flag is true.src/devops_cli/github/app_installation.pytakes the map as a parameter. (best practice) [sources: src/devops_cli/config/constants.py:1628, src/devops_cli/github/app_installation.py]- Chosen: One constant for each phase in
constants.py. The maps are constants of the CLI, and the existing constant already lives there with its caller. - Rejected: Build each map at the call site. It puts the same permission names in several modules.
- Rejected: A settings key for the permissions. It makes a security boundary configurable and adds a surface to test.
- Chosen: One constant for each phase in
- Which callers use
CONST_GITHUB_APP_TOKEN_PERMISSIONS?: One production caller,src/devops_cli/github/app_installation.py, and the constant module itself. [sources: src/devops_cli/config/constants.py:1628, src/devops_cli/github/app_installation.py] - Does ADR 0030 need a
body-hashupdate?: No. ADR 0030 isproposed, anddocs/adr/README.md:30setsbody-hashonly on accepted records. The change updates the text of ADR 0030 and leaves its frontmatter unchanged. [sources: docs/adr/README.md:30, docs/adr/0030-roadmap-steps-run-their-agent-apart-from-the-app-key.md]
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 22, 2026
Both scope token permissions per roadmap job; #5498 covers all jobs' keys and permissions via a table, while the candidate specifies the exact permissions for the prepare and publish phases only.devops-cli-service commentedon Nov 23, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 23, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
dan-petty commentedon Nov 25, 2026
This issue cannot be built as written on
origin/main(3734bc156). Its acceptance criterion and design require aprepareinstallation token with read permissions only (contents: read,issues: read,pull_requests: read, and nowritevalue). Everypreparephase onmainwrites to GitHub issues and reads Actions/Checks:prepare_implementcallswrite_status,set_marks,report.yield_to, andreport.stop(src/devops_cli/roadmap/implement/implement_phases.py:309,347,369,378;src/devops_cli/roadmap/stores/github_store.py:1087);prepare_stage_jobcallsStageWriter.begin,settle,finish_stage_job, andjob_time_decision(src/devops_cli/roadmap/stage/stage_job_phases.py:387,394,396;src/devops_cli/roadmap/stage/stage.py:3034);fix-checksprepare_phasecallsjudge_round(src/devops_cli/roadmap/steps/fix_checks_phases.py:301); andfix-conflictpreparerecords attempt rounds. Alsodocs/adr/0030-roadmap-steps-run-their-agent-apart-from-the-app-key.mdhasstatus: proposed, anddocs/adr/README.md:30setsbody-hashonly on accepted records. Please refine the permission sets to keepissues: write,checks: read, andactions: readwhereprepareuses them, and remove thebody-hashrequirement while ADR 0030 isproposed.devops-cli-service commentedon Nov 25, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 25, 2026
Released in v0.219.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.219.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 17:09 UTC