Skip to content

Commit 882ccd8

Browse files
committed
Fix runner workspace publication parent
1 parent 7a94b4f commit 882ccd8

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

.github/scripts/run-agent-task/runner-workspace-publisher.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function publishRunnerWorkspace({ request, changedFiles, publicatio
4141
tree.push({ path: relativePath, mode: changed.mode, type: "blob", sha: string(blob.sha) })
4242
}
4343
const nextTree = await api("POST", "/git/trees", { base_tree: string(baseCommit.tree?.sha), tree })
44-
const commit = await api("POST", "/git/commits", { message: string(config.commit_message || request.workload?.label || "Apply agent task changes"), tree: string(nextTree.sha), parents: [parent] })
44+
const commit = await api("POST", "/git/commits", { message: string(config.commit_message || request.workload?.label || "Apply agent task changes"), tree: string(nextTree.sha), parents: [baseSha] })
4545
if (existing) await api("PATCH", `/git/refs/heads/${head.split("/").map(encodeURIComponent).join("/")}`, { sha: string(commit.sha), force: false })
4646
else await api("POST", "/git/refs", { ref: `refs/heads/${head}`, sha: string(commit.sha) })
4747
const pulls = await api("GET", `/pulls?state=open&head=${encodeURIComponent(`${targetRepo.split("/")[0]}:${head}`)}&base=${encodeURIComponent(base)}`)

docs/agent-task-reusable-workflow.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ package file is mounted into or visible from the agent workspace.
106106

107107
The repository's native-loop and PHP runtime-package tests execute generated
108108
PHP with narrow WordPress and native agent-registry shims. The non-skippable
109-
Playground integration additionally boots the agent registry and OpenAI
110-
provider path with a local HTTP interceptor. Its deterministic three-turn
111-
fixture reads and edits a seeded sandbox workspace, verifies provider tool
112-
outputs, and captures the canonical changed-files manifest and patch without
113-
network access or provider billing.
109+
deterministic WordPress Playground end-to-end test additionally boots the
110+
agent registry and OpenAI provider path with a local HTTP interceptor. Its
111+
three-turn fixture reads and edits a seeded sandbox workspace, verifies
112+
provider tool outputs, and captures the canonical changed-files manifest and
113+
patch without network access or provider billing.
114114

115115
To run the optional cross-repository package coverage, use a Docs Agent checkout
116116
pinned to commit `3da1b8076359db9bf9f4ee7dadcc3932c080ed71`, which contains

tests/agent-task-reusable-workflow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ assert.match(docs, /wp-codebox\/reusable-workflow-interface\/v1/)
9595
assert.match(docs, /run-agent-task-reusable-workflow-interface\.v1\.json/)
9696
assert.match(docs, /WP_CODEBOX_DIR/)
9797
assert.match(docs, /Runtime Coverage/)
98-
assert.match(docs, /not a WordPress Playground end-to-end test/)
98+
assert.match(docs, /deterministic WordPress Playground end-to-end test/)
9999
assert.doesNotMatch(docs.slice(0, docs.indexOf("## Runtime Coverage")), /docs-agent|wp-codebox\/docs-agent-runner-recipe\/v1|recipe_path|recipe_json|wp_codebox_ref|datamachine|data machine|data-machine|agents api|sandbox mounts|ability ids|provider internals|homeboy|require_app_token/i)
100100

101101
const tmp = await mkdtemp(join(tmpdir(), "wp-codebox-agent-task-workflow-"))

tests/runner-workspace-publisher.test.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ function fetchMock(existing = false) {
3030
const result = await publishRunnerWorkspace({ request, changedFiles: ["README.md"], publicationFiles, token: "secret", fetchImpl: mock.fetch })
3131
assert.equal(result.pull_request.opened, true)
3232
assert(mock.calls.some(([, method]) => method === "POST"))
33+
const commitRequest = mock.calls.find(([url, method]) => new URL(url).pathname.endsWith("/git/commits") && method === "POST")
34+
assert.deepEqual(commitRequest?.[2]?.parents, ["base"], "new branch commits must use the base branch head as their parent")
3335
}
3436
{
3537
const mock = fetchMock(true)
@@ -39,6 +41,8 @@ function fetchMock(existing = false) {
3941
const treeRequest = mock.calls.find(([url, method]) => new URL(url).pathname.endsWith("/git/trees") && method === "POST")
4042
assert.equal(treeRequest?.[2]?.base_tree, "prior-tree", "existing branch publication must extend its current tree")
4143
assert.deepEqual(treeRequest?.[2]?.tree, [{ path: "README.md", mode: "100644", type: "blob", sha: "blob" }], "the prior branch tree remains the base while only approved changed files are replaced")
44+
const commitRequest = mock.calls.find(([url, method]) => new URL(url).pathname.endsWith("/git/commits") && method === "POST")
45+
assert.deepEqual(commitRequest?.[2]?.parents, ["old"], "existing branch commits must use the existing branch head as their parent")
4246
}
4347
await assert.rejects(() => publishRunnerWorkspace({ request: { ...request, runner_workspace: { ...request.runner_workspace, repo: "other/repo" } }, changedFiles: ["README.md"], publicationFiles, token: "secret", fetchImpl: fetchMock().fetch }), /not authorized/)
4448
await assert.rejects(() => publishRunnerWorkspace({ request, changedFiles: ["README.md"], publicationFiles, token: "", fetchImpl: fetchMock().fetch }), /No GitHub token/)

0 commit comments

Comments
 (0)