diff --git a/docs/DEPENDENCY.md b/docs/DEPENDENCY.md index 43b91f5..6f992ee 100644 --- a/docs/DEPENDENCY.md +++ b/docs/DEPENDENCY.md @@ -125,9 +125,17 @@ committed model/run and original bot author/committer; do not supply `--model`, `--message` or `--files`, or substitute current GHCP metadata for a completed seat. It rechecks local/remote/PR identity, reviewed policy and all required exact-head checks, including ruleset-only branch protections. +The reviewed revision `0050ada7184d7ef167310ef25b4312a024069505` +also requests repository-scoped **Administration read** for resume only, so +legacy branch-protection requirements can be inspected. Normal publication +and `--merge-when-green` alone retain their existing token scopes. A human +must grant and accept Administration read on the App installation; approving +the code change does not establish that GitHub accepted the permission. Missing or conflicting metadata authority, dirty state, real head drift, -missing/merged PR or permission failure stops explicitly. HTTP 422 remains a -Checks-permission stop, not permission to use another token or human fallback. +missing/merged PR or permission failure stops explicitly. HTTP 403/422 while +requesting the resume token stops without a reduced-scope retry; a Checks +permission HTTP 422 is likewise a stop, not permission to use another token +or human fallback. Merge remains separately authorized and conservative cleanup can report a confirmed remote merge with incomplete local worktree cleanup. diff --git a/tests/contracts.test.mjs b/tests/contracts.test.mjs index ee34fee..818ee6c 100644 --- a/tests/contracts.test.mjs +++ b/tests/contracts.test.mjs @@ -9,7 +9,7 @@ import { parseConfig } from '../src/lib/config.mjs'; import { runLoop } from '../src/runtime/loop.mjs'; import { createTools } from '../src/runtime/tools.mjs'; import { planStub } from '../src/planner/stub.mjs'; -import { parseArgs } from '../vendor/github-agent-contracts/scripts/agent-pr.mjs'; +import { buildInstallationPermissions, parseArgs } from '../vendor/github-agent-contracts/scripts/agent-pr.mjs'; const config = parseConfig(readFileSync(new URL('../roster.config.example.yml', import.meta.url), 'utf8') .replace('base_url: ""', 'base_url: http://localhost:8000/v1').replace('model: ""', 'model: test-model')); @@ -35,6 +35,18 @@ test('reviewed contracts exposes exact-head resume without replacing committed m ]) assert.throws(() => parseArgs(args, {}), /resume/); }); +test('reviewed contracts adds explicit read-only inspection without widening default publication', () => { + assert.deepEqual(buildInstallationPermissions(), { contents: 'write', pull_requests: 'write' }); + assert.deepEqual(buildInstallationPermissions({ readChecks: true }), { + contents: 'write', pull_requests: 'write', checks: 'read', + }); + assert.deepEqual(buildInstallationPermissions({ readChecks: true, readAdministration: true }), { + contents: 'write', pull_requests: 'write', checks: 'read', administration: 'read', + }); + assert.throws(() => buildInstallationPermissions({ additionalPermissions: { administration: 'write' } }), + /Unsupported additional installation permission/); +}); + test('worktree initialization runs recursive submodule update at its root and verifies a declared publisher', async (t) => { const worktree = fixture(t); writeFileSync(path.join(worktree, '.gitmodules'), diff --git a/vendor/github-agent-contracts b/vendor/github-agent-contracts index fa48c24..0050ada 160000 --- a/vendor/github-agent-contracts +++ b/vendor/github-agent-contracts @@ -1 +1 @@ -Subproject commit fa48c244bc9b8ead5df927ec705ef41a39c56f68 +Subproject commit 0050ada7184d7ef167310ef25b4312a024069505