Repository navigation
fix(github): let a session continue its own bot-published PR after others push - #187465
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAllows a conversation to refresh and continue its own bot-published PR after another writer advances its branch. Example: A conversation publishes through roboclaw-bot, another writer adds maintainer.txt, and the conversation has an unpublished artifact.txt edit.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a source-confirmed contribution workflow failure that remains on main. No introduced defect was found, and the added production-owner authorization cases address the previous review concern. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe github_publish tool dispatches to Gateway inspection, workspace preparation, and publication owners, which combine current requester authority with session receipts and GitHub observations before changing workspace files or pushing source. flowchart TD
A[Conversation tool request] --> B[Gateway requester authority]
B --> C[Session receipt and PR inspection]
C --> D[Existing workspace integration]
D --> E[Bound PR publication]
E --> F[Guarded Git push]
Technical reviewBest possible solution: Reuse the conversation's verified publication receipt to enter the existing PR integration path while retaining current requester and final-effect guards. Do we have a high-confidence way to reproduce the issue? Current main's linked-author check rejects a publisher-bot PR before recovery can integrate its newer head; the PR reports a matching production incident and a red-to-green registered-tool regression, which this read-only review did not execute. Is this the best way to solve the issue? The patch is a focused repair using existing receipt, authorization, and integration owners, with no competing merge implementation or new configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 241614b59cf5. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +29, Tests +164, Docs +9. Total +202 across 11 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 29, 2026, 6:24 AM ET / 10:24 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed as 4ececc4.
Thanks to Jacqueline for the #180294 report that exposed this. |
…hers push (openclaw#187465) ## What Problem This Solves Fixes: after anyone else pushes to a PR that an agent session published through the managed publisher (for example `roboclaw-bot`), that session can never update the PR again. Publishing correctly refuses to overwrite the other commits (`push_rejected`). But the documented recovery, `prepare_pr`, refused twice: 1. **Author check.** `prepare_pr` only accepts PRs authored by the requester's own linked GitHub account. A PR the session published is authored by the publisher bot, so the session that created the PR was refused like a stranger: "This PR is not authored by a GitHub account linked to you." 2. **Clean-workspace check.** The first `prepare_pr` in a session treats the PR as a fresh import and requires a clean workspace. The publishing session always has its own published commits and usually the unpublished fix it is trying to push. Real case: openclaw#180294 on the team Gateway. A maintainer pushed 3 commits to the PR branch. The session's next fix failed with `push_rejected` 3 times over a week, and every `prepare_pr` attempt was refused. The agents then suggested reassigning session ownership, which cannot help (see below). ## Why This Change Was Made `inspectOwnGitHubPullRequest` is the one owner of "may this conversation act on this PR". It now also reads the conversation's latest published record. It admits the PR author when that record names this exact PR URL and the PR author is the publisher account recorded for it. A bot-authored PR from another conversation is still refused. `prepare_pr` then treats the head this conversation last published as the already-prepared head. It uses the existing advanced-head path: save the workspace, merge the newer head, return conflicts. It does not use the first-import path that demands a clean workspace. The next ordinary publication appends to the same PR as a fast-forward. No new action, state or config. Also: - The `push_rejected` next step now tells the agent to call `prepare_pr` for its own PR, not "apply the changes on top of that head" (which no tool could do). - The owner-only `prepare_pr` error now says it means the person who started the conversation. Reassigning the session owner does not transfer this; [multi-user](https://docs.openclaw.ai/concepts/multi-user) documents that reassignment keeps authority with the creator, and any agent turn can reassign. This check is unchanged on purpose; only the wording changed, because "owner" sent agents into an ownership-transfer loop. - Docs and the `prepare_pr` tool description state the new path. ## User Impact A session whose bot-published PR was updated by someone else can recover with `prepare_pr` and then publish to the same PR, keeping its saved work. Previously the only way out was a replacement PR or manual Git work by an operator. ## Evidence - **Production trace:** team Gateway, session for openclaw#180294. Publication records show 2 published updates by `roboclaw-bot` (account 309084314) to that PR URL, then 3 `push_rejected` failures. The PR's head moved because of 3 maintainer commits. Each `prepare_pr` call failed, either on the author check or on the creator check after an ownership reassignment. - **Red then green through the agent tool and Gateway** (`src/gateway/github-pr-workspace-refresh.test.ts`, "merges another writer's commits into this session's own bot-published PR"): - The session publishes a PR as the publisher bot. - A maintainer appends a commit to that branch. - The session has an unpublished edit. - `prepare_pr` runs, then publish. - `main`: **failed**, with the production error "This PR is not authored by a GitHub account linked to you…". - This branch: **passed**. The maintainer's file is merged and the unpublished fix is kept. Publish sends one fast-forward push leased on the maintainer's head, to the same PR, and that push contains both. - **Authority is still enforced at both effects** (same file, real `prepare_pr` and publication entry points): - A bot-authored PR this session did not publish is refused; no binding is written. - A revoked requester is refused before the newer head is accepted. The workspace HEAD, files and binding are unchanged, with no GitHub writes. - A requester revoked after a successful `prepare_pr` is refused at publication ("no longer authorized"), with zero pushes; the PR branch stays at the maintainer's head. - Reassigning the session owner still does not grant `prepare_pr`; the creator check is unchanged and covered by the existing adoption suite. - **Also new:** a bot-authored PR this session did not publish is still refused, and an unchanged own PR after the base advanced prepares cleanly (it fetches the newer base and writes the binding). - **Related suites:** 160 tests across preparation, refresh, inspect, existing-PR publication, publication actions, base refresh, imported actions, PR workspace adoption, and the `github_publish` tool all pass. The one failure in the first run was a test asserting the old owner-check wording, now updated. `pnpm test src/gateway/github-pr-workspace-refresh.test.ts --maxWorkers=1`: 16 passed, 71 s wall. GitHub transport is synthetic in these tests (real Gateway, Git, session and publication owners); no live GitHub run. - `pnpm check:changed` passes (format, typecheck, lint, guards) with the dead-export scan skipped; that scan fails on files this PR does not touch, which are already on `main`. No overlap with Pash/Sarah changes. **Merge danger:** two-way door. No schema, config or stored-state change; a revert restores the old refusals. **Blast radius:** `prepare_pr`, `inspect_pr`, and publication to a prepared PR, for sessions with a published PR. If the new check were wrong, a session could merge and push to a PR whose author matches its own recorded publisher account. The URL and account must both match this conversation's own publication record, and the existing publisher write-access and remote-head checks still run before any push. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: after anyone else pushes to a PR that an agent session published through the managed publisher (for example
roboclaw-bot), that session can never update the PR again.Publishing correctly refuses to overwrite the other commits (
push_rejected). But the documented recovery,prepare_pr, refused twice:prepare_pronly accepts PRs authored by the requester's own linked GitHub account. A PR the session published is authored by the publisher bot, so the session that created the PR was refused like a stranger: "This PR is not authored by a GitHub account linked to you."prepare_prin a session treats the PR as a fresh import and requires a clean workspace. The publishing session always has its own published commits and usually the unpublished fix it is trying to push.Real case: #180294 on the team Gateway. A maintainer pushed 3 commits to the PR branch. The session's next fix failed with
push_rejected3 times over a week, and everyprepare_prattempt was refused. The agents then suggested reassigning session ownership, which cannot help (see below).Why This Change Was Made
inspectOwnGitHubPullRequestis the one owner of "may this conversation act on this PR". It now also reads the conversation's latest published record. It admits the PR author when that record names this exact PR URL and the PR author is the publisher account recorded for it. A bot-authored PR from another conversation is still refused.prepare_prthen treats the head this conversation last published as the already-prepared head. It uses the existing advanced-head path: save the workspace, merge the newer head, return conflicts. It does not use the first-import path that demands a clean workspace. The next ordinary publication appends to the same PR as a fast-forward. No new action, state or config.Also:
push_rejectednext step now tells the agent to callprepare_prfor its own PR, not "apply the changes on top of that head" (which no tool could do).prepare_prerror now says it means the person who started the conversation. Reassigning the session owner does not transfer this; multi-user documents that reassignment keeps authority with the creator, and any agent turn can reassign. This check is unchanged on purpose; only the wording changed, because "owner" sent agents into an ownership-transfer loop.prepare_prtool description state the new path.User Impact
A session whose bot-published PR was updated by someone else can recover with
prepare_prand then publish to the same PR, keeping its saved work. Previously the only way out was a replacement PR or manual Git work by an operator.Evidence
roboclaw-bot(account 309084314) to that PR URL, then 3push_rejectedfailures. The PR's head moved because of 3 maintainer commits. Eachprepare_prcall failed, either on the author check or on the creator check after an ownership reassignment.src/gateway/github-pr-workspace-refresh.test.ts, "merges another writer's commits into this session's own bot-published PR"):prepare_prruns, then publish.main: failed, with the production error "This PR is not authored by a GitHub account linked to you…".prepare_prand publication entry points):prepare_pris refused at publication ("no longer authorized"), with zero pushes; the PR branch stays at the maintainer's head.prepare_pr; the creator check is unchanged and covered by the existing adoption suite.github_publishtool all pass. The one failure in the first run was a test asserting the old owner-check wording, now updated.pnpm test src/gateway/github-pr-workspace-refresh.test.ts --maxWorkers=1: 16 passed, 71 s wall. GitHub transport is synthetic in these tests (real Gateway, Git, session and publication owners); no live GitHub run.pnpm check:changedpasses (format, typecheck, lint, guards) with the dead-export scan skipped; that scan fails on files this PR does not touch, which are already onmain.No overlap with Pash/Sarah changes.
Merge danger: two-way door. No schema, config or stored-state change; a revert restores the old refusals. Blast radius:
prepare_pr,inspect_pr, and publication to a prepared PR, for sessions with a published PR. If the new check were wrong, a session could merge and push to a PR whose author matches its own recorded publisher account. The URL and account must both match this conversation's own publication record, and the existing publisher write-access and remote-head checks still run before any push.