Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <issue reference> 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.
21 changes: 21 additions & 0 deletions docs/DEPENDENCY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<exact 40-character existing head SHA>" --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)
Expand Down
15 changes: 15 additions & 0 deletions tests/contracts.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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'),
Expand Down
Loading