Repository navigation
feat: support actions on imported pull requests - #178281
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 changes before merge. What this changesThis PR lets existing publication actions operate on a conversation’s imported original PR without requiring a publication receipt. Example: A guest continues example/repository pull request 7 on branch topic.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it adds useful, maintainer-approved support for imported PRs, and no introduced correctness defect was found. GitHub now reports a conflict against its updated prerequisite branch. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherThe github_publish tool sends session-bound requests to the Gateway, which selects the imported PR or publication receipt, checks current authority, performs GitHub operations and returns observed state. flowchart TD
A[User request] --> B[github_publish tool]
B --> C[Gateway action owner]
C --> D[Session binding or receipt]
C --> E[Current requester and publisher authority]
D --> F[GitHub transport]
E --> F
F --> G[Observed PR result]
Technical reviewBest possible solution: Extend the existing Gateway action owner to select the bound original PR while retaining current-authority checks and separate receipt preconditions. Do we have a high-confidence way to reproduce the issue? The pinned base explicitly refuses actions whenever the workspace has a githubPullRequest binding; the supplied baseline run reports the corresponding registered-action failures, and no target code was executed during this review. Is this the best way to solve the issue? The change uses the existing binding, requester, inspection, preflight and transport owners, avoids fabricated publication receipts, and preserves ordinary receipt-backed behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 43c99e871f38. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +112, Tests +463, Docs +15. Total +590 across 12 files. Added test files: 1. 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 21, 2026, 7:20 AM ET / 11:20 UTC (Revision 2). |
7f2098a to
816f726
Compare
71145c0 to
984eb8c
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
f6a4786 to
087a07f
Compare
Security-sensitive guard clearedCurrent revision: This PR no longer changes files in the maintainer security-review tier. Separate CODEOWNERS requirements still apply to security policy and enforcement files. |
984eb8c to
84f158f
Compare
After prepare_pr binds a conversation's workspace to the guest's own original PR, the existing github_publish actions edit, ready, request_review and upload_evidence act on that bound PR before any new push and without a publication receipt: the action handler selects the workspace binding before consulting shared publication receipts, returns a pullRequest descriptor with the observed remote head instead of a fabricated publication, and requires expectedHeadCommit without a requestId. Receipt-backed actions keep their requestId precondition. Every guest action re-verifies the linked author and private repository access through own-PR inspection; writes also recheck the publisher's write eligibility at the effect and preserve a human title/body change observed there. merge, close and inspect on the bound PR still require full operator write access, so an administrator can land it from the same conversation while a guest's later turns stay restricted. The target check compares the bound PR's immutable repository IDs, number, branch and author so a changed target refuses. Refs #178233
84f158f to
7b74f99
Compare
|
Added: |
After prepare_pr binds a conversation's workspace to the guest's own original PR, the github_publish actions edit, ready, request_review and upload_evidence act on that bound PR before any new push and without a publication receipt: the action handler selects the binding before publication receipts, returns a pullRequest descriptor with the observed remote head, and requires expectedHeadCommit without a requestId, while receipt-backed actions keep their requestId precondition. Every guest action re-verifies the linked author and private repository access, writes recheck publisher write eligibility at the effect and preserve a human title/body change observed there, and merge, close and inspect on the bound PR still require full operator write access, so an administrator can land it from the same conversation while a guest's later turns stay restricted. Refs openclaw#178233.
Builds on #178233 (preparing an own PR's head as the conversation's managed workspace), which has landed on
main; this PR now targetsmaindirectly.What Problem This Solves
A conversation can prepare a contributor's existing PR without publishing anything, but its next metadata, readiness, review-request or evidence action still requires a completed shared publication receipt. That leaves the original PR unusable through these actions until another source publication exists, even though the workspace already records which PR the contributor is continuing. An administrator who wants to land that PR from the same conversation is refused the same way.
This PR adds action support for that existing association. The diff is limited to the action path and its directly required protocol, tool text, documentation and tests.
User Impact
Guests can edit their own original PR's title or body, mark its draft ready, request the fixed ClawSweeper re-review, and upload inspected workspace evidence before pushing more source. These actions preserve workspace files and Git history. An older publication from the conversation cannot redirect them to a different PR.
Full-write operators retain their existing inspection, closing and merging actions on the bound original PR, including through an authorized publishing child, so an administrator can land the guest's PR from the same conversation. An administrator joining a guest conversation does not elevate later guest turns: merge, close and inspect on the bound PR still require full operator write access on every call. Current linked-author, repository-access, target and authority checks remain in force. Nothing here grants a guest merge or auto-merge, and no replacement PR is created.
Pushing new source to the original PR's head branch and refreshing the workspace to a newer remote head are separate contributions and remain unavailable here; the tool text says so.
Why This Change Was Made
The action handler now selects the workspace's bound original PR before consulting publication receipts. Imported actions return a
pullRequestdescriptor (URL, repository, branch) and the currently observed remote head; they do not fabricate apublishedresult or request ID. Their writes requireexpectedHeadCommitand refuse arequestId, which belongs only to a publication receipt. Actions backed by a real publication receipt continue to require that receipt'srequestIdand head preconditions, so the two target kinds cannot be confused.The existing requester, own-PR inspection, write-preflight and GitHub transport owners supply authority and effects: every guest action re-runs own-PR inspection, which verifies the current linked author and private repository access, and every write re-runs the publisher write-eligibility check at the effect. The publishing-session lineage walk and the PR-state validation moved from the action handler into
github-publication-action-target.ts, where the state check also compares the bound PR's immutable repository IDs, number, branch and author, so a changed target or author refuses before any write while inspection may still observe legitimate newer commits. The write-preflight owner now returns the PR it observed, so a human title/body change seen during eligibility preparation is preserved before PATCH without another API request. Fixed review text, evidence-byte checks and uncertain-write handling retain their existing behavior. The final GitHub read/PATCH race remains non-atomic, as before.The protocol schema makes
requestIdoptional onrequest_reviewandupload_evidenceand lets the action result carry eitherpublicationorpullRequest. The tool text tells the model to read witheditfirst and to sendexpectedHeadCommitwithoutrequestIdwhen the result carriespullRequest.Evidence
Candidate and history
This head is the same 12-file contribution as the earlier head 71145c0 (+809/−216 against its base at the time), rebuilt as one linear commit: first on #178233's rebased head 816f726 (published as 984eb8c), then replayed onto
mainonce #178233 landed there as 9218dca. That replay was patch-identical:git range-diffreports the single commit unchanged, and none of this PR's files differ between the two bases. Three files needed resolution against that base, all in the base's current shape and without changing what this PR proves: thegithub_publishtool text (the base rewrote the action list; this PR's sentences aboutrequestIdand the bound PR are applied to that text), the publication-action test fixture (its invoker is exported for the new test; the base's method shape is kept), and the protocol schema test (the base rewrote it on the sharedschemaValidationhelper; the optionalrequestIdcase is expressed in that form). A file-by-file comparison of the patch before and after the rebuild shows no other change beyond context lines.Before the change
On the base, with the candidate's test file and fixture in place but production code unchanged,
src/gateway/github-publication-imported-actions.test.tsfails 8 of 18 cases: every action in a bound workspace throwsThis workspace continues an existing PR. Its PR actions are not available yet, including the administrator'sinspectandmergeand the guest'sedit,readyandrequest_review. The ten passing cases only assert that a changed precondition refuses without writing, which the base's blanket refusal satisfies trivially.Remote validation on this head
Remote validation on this exact tree (Linux Testbox, 4 CPUs), in stage order:
core,ui,extensions,extensions-test,scriptsandtest-rootprograms, with no graph left unrun.github_publishtool test). The gateway batch ran 8 files / 170 cases, the protocol schema test 17 cases, and the tool test 28 cases.One correction was needed during that validation: the first candidate's
prepare_prsentence namedupload_evidenceunconditionally, and the base's tool test requires the description to omit evidence upload when the sandbox cannot provide it. The sentence now mentions it only when evidence upload is offered; the tool test and the four gateway tests that import the tool module were rerun on the corrected tree and passed.On head 984eb8c, hosted CI completed successfully (84 checks passed, none failed), the automated review rated it Platinum with no findings, and an independent review concluded clean. Between that head and this one,
mainchanged how two relied-on modules read session state and select GitHub Enterprise accounts, and #178312 (the conversation's PR card) moved own-PR inspection behind a shared reader; the call these actions make and the GitHub.com behavior they rely on are unchanged. The head was replayed ontomainafter #178312 landed, patch-identically again, and the fast checks, type checks and the ten related test files, including the decisive test, were rerun on this exact tree and passed.One hosted check is red for a reason outside this PR:
control-ui-performancefails onmainitself, where the Control UI startup bundle has grown past its budget (about 323 KiB gzip against 317.8 KiB). This PR changes no Control UI file and adds no bytes to any measured bundle; the same check fails identically when run onmain's tip, and on other open PRs.Registered action coverage
The new test file drives the registered
sessions.github.actionowner through thegithub_publishtool with real session, requester and identity owners; only GitHub I/O is synthetic. It covers: reading the bound PR with no prior publication, with an older publication receipt in the conversation, and with an unprepared head; edit, fixed re-review and ready without pushing source and without touching the session's external writes; metadata edits against a newer observed remote head without changing the prepared source or the binding; a human title or body change observed during eligibility preparation, which refuses the edit and performs no PATCH; the guest/administrator separation, where the administrator inspects and merges the bound PR while the guest'smerge,closeandinspectare refused by scope and the guest'sreadyis accepted; denial before any effect when the author, head or base repository, branch, head commit, publisher permission, private access, session binding or requester changes; and refusal of a stale receiptrequestIdor a missing head for the imported target. The evidence-upload test exercises the same target forupload_evidence.Prior-head records
The earlier head 4cd2366 was reviewed by ClawSweeper on an older base; its verdict is marked stale and a fresh review runs on this head. The earlier integration results below are retained from that candidate and are not a deployment of this head.
Retained integration results (earlier candidate 45f7aa4)
Retained integration builds exercised Guest metadata read/edit/readback, draft-to-ready, the fixed re-review request, and one evidence upload on the original bound PR without source publication. The readiness case changed only the draft flag. Re-review posted exactly one fixed command and explicitly left review acceptance and completion unconfirmed. Captured PR identity, source head, metadata outside the requested edit, workspace and session state were preserved.
The metadata title matched exactly; the model omitted one requested final newline from the body, and GitHub received the exact tool argument. The upload returned the inspected PNG's hash and size with access explicitly unverified. A separate body edit then associated that same asset, exactly preserving the requested bytes and existing body prefix, without another upload. The intended reviewer account, with current private-repository access, downloaded matching PNG bytes through its existing authenticated GitHub route; anonymous access still returned 404. This proves access for that tested account, which is also the shared publisher; it does not establish another account's access or browser rendering.
The remaining live authority and administrator cases are covered on this head by the registered action tests above, not by a live run.
Visual evidence
Continuous request and ready result on integration 45f7aa4
original-pr-ready-request-through-result-v3.mp4
Visual verification
These captures are retained from the earlier integration candidate; the action behavior they show is unchanged on this head.
45f7aa4da479adb8cec5910bf49f59d6f8e93898