diff --git a/AGENTS.md b/AGENTS.md index 139b88ec..1f6e98d6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -88,3 +88,13 @@ chat, queue, or runtime. The parent Copilot calls for the issue, then the App publisher for reviewed changes. It must not `git commit` as R4yHarris when `GITHUB_APP_*` is set. Follow the [GHCP bridge](docs/GHCP.md) for publication and HTTP 422 handling. + +## Publication learnings + +GitHub closing keywords in commit messages and PR bodies ignore prose negation: +writing `do not close` followed by an issue reference can still close that issue. +For an incomplete parent, write `Parent remains open` instead; +reserve closing keywords for the exact completed scope and verify issue/project +state after merge. Preserve original commits when correcting an unintended +closure: reopen the issue, reconcile its project status and correct the mutable +PR body, without inventing acceptance or amending provenance. diff --git a/docs/DEPENDENCY.md b/docs/DEPENDENCY.md index 1c8e9799..43b91f50 100644 --- a/docs/DEPENDENCY.md +++ b/docs/DEPENDENCY.md @@ -110,6 +110,27 @@ see the complete [GHCP example](GHCP.md). Do not commit as the signed-in human when App environment variables are set. Never commit tokens, private keys, or `.env`. +### Recover an interrupted exact-head publication + +The reviewed contracts revision `fa48c244bc9b8ead5df927ec705ef41a39c56f68` +adds explicit resume without a second commit, push or PR. After inspecting the +existing App commit and matching open PR, run from its clean feature worktree: + +```powershell +node vendor\github-agent-contracts\scripts\agent-pr.mjs --resume "" --merge-when-green +``` + +Metadata-only recovery omits `--merge-when-green`. Resume preserves the +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. +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. +Merge remains separately authorized and conservative cleanup can report a +confirmed remote merge with incomplete local worktree cleanup. + ## Trailer CI The [composite action](../.github/actions/check-agent-trailers/action.yml) diff --git a/tests/contracts.test.mjs b/tests/contracts.test.mjs index a819c972..ee34feec 100644 --- a/tests/contracts.test.mjs +++ b/tests/contracts.test.mjs @@ -9,6 +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'; 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')); @@ -20,6 +21,20 @@ function fixture(t) { return worktree; } +test('reviewed contracts exposes exact-head resume without replacing committed model authority', () => { + const head = 'a'.repeat(40); + const options = parseArgs(['--resume', head, '--merge-when-green'], { AI_MODEL: 'unrelated-current-model' }); + assert.equal(options.resume, head); + assert.equal(options.mergeWhenGreen, true); + assert.equal(Object.hasOwn(options, 'model'), false); + for (const args of [ + ['--resume', head, '--message', 'new commit'], + ['--resume', head, '--model', 'replacement-model'], + ['--resume', head, '--files', 'README.md'], + ['--resume', 'short-sha'], + ]) assert.throws(() => parseArgs(args, {}), /resume/); +}); + 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 61b97b3e..fa48c244 160000 --- a/vendor/github-agent-contracts +++ b/vendor/github-agent-contracts @@ -1 +1 @@ -Subproject commit 61b97b3e93e670a675c0301cce5412c73404d179 +Subproject commit fa48c244bc9b8ead5df927ec705ef41a39c56f68