Summary
The github integration client (GithubClient) can createPullRequest, postReview, comment, etc. — but has no merge method. So an agent that wants to merge a PR has to shell out to gh pr merge, which (a) is the lone gh/git use left in the showcase agents, and (b) doesn't fit the sandbox model (the repo is a tarball mount with no .git/gh auth; GitHub writes are meant to go through the integration's writeback).
Add mergePullRequest(...) so agents merge through the integration like every other GitHub write.
Not blocking
The review agent (AgentWorkforce/agents#1, review/agent.ts → mergePr) works today via gh pr merge. This is a cleanup that removes the last gh call; nothing depends on it.
Proposed API
// GithubClient
mergePullRequest(args: {
owner: string;
repo: string;
number: number;
method?: 'merge' | 'squash' | 'rebase'; // default 'squash'
commitTitle?: string;
commitMessage?: string;
}): Promise<{ merged: boolean; sha?: string }>;
Usage in the review agent then becomes:
await ctx.github.mergePullRequest({ owner, repo, number, method: 'squash' });
Repos / files to touch
Mirror the createPullRequest path (client writes a VFS draft → writeback worker calls the GitHub REST API):
- AgentWorkforce/workforce —
packages/runtime/src/clients/github.ts
Add mergePullRequest to the GithubClient interface + impl (write a draft via writeJsonFile, e.g. to /github/repos/{owner}/{repo}/pulls/{n}/merge.json).
- AgentWorkforce/relayfile-adapters —
packages/github/src/writeback.ts (GitHubWritebackHandler, today only handles pulls/{n}/reviews/...) + packages/github/github.mapping.yaml (writebacks: block)
Map the merge draft path → PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge (body: merge_method, optional commit_title/commit_message). Add a writeback.test.ts case.
- AgentWorkforce/cloud — verify the
relayfile-writeback-consumer executes the new request shape (likely generic — no change, just confirm).
- AgentWorkforce/agents —
review/agent.ts mergePr: swap ctx.sandbox.exec('gh pr merge …') for ctx.github.mergePullRequest(...) (drops the last gh).
Acceptance
ctx.github.mergePullRequest(...) merges a PR end-to-end via the writeback (no gh).
- review agent merges on authorized approval with no
gh/sandbox shell-out.
🤖 Generated with Claude Code
Summary
The github integration client (
GithubClient) cancreatePullRequest,postReview,comment, etc. — but has no merge method. So an agent that wants to merge a PR has to shell out togh pr merge, which (a) is the lonegh/git use left in the showcase agents, and (b) doesn't fit the sandbox model (the repo is a tarball mount with no.git/ghauth; GitHub writes are meant to go through the integration's writeback).Add
mergePullRequest(...)so agents merge through the integration like every other GitHub write.Not blocking
The
reviewagent (AgentWorkforce/agents#1,review/agent.ts→mergePr) works today viagh pr merge. This is a cleanup that removes the lastghcall; nothing depends on it.Proposed API
Usage in the review agent then becomes:
Repos / files to touch
Mirror the
createPullRequestpath (client writes a VFS draft → writeback worker calls the GitHub REST API):packages/runtime/src/clients/github.tsAdd
mergePullRequestto theGithubClientinterface + impl (write a draft viawriteJsonFile, e.g. to/github/repos/{owner}/{repo}/pulls/{n}/merge.json).packages/github/src/writeback.ts(GitHubWritebackHandler, today only handlespulls/{n}/reviews/...) +packages/github/github.mapping.yaml(writebacks:block)Map the merge draft path →
PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge(body:merge_method, optionalcommit_title/commit_message). Add awriteback.test.tscase.relayfile-writeback-consumerexecutes the new request shape (likely generic — no change, just confirm).review/agent.tsmergePr: swapctx.sandbox.exec('gh pr merge …')forctx.github.mergePullRequest(...)(drops the lastgh).Acceptance
ctx.github.mergePullRequest(...)merges a PR end-to-end via the writeback (nogh).gh/sandbox shell-out.🤖 Generated with Claude Code