Skip to content

feat: support actions on imported pull requests - #178281

Merged
shakkernerd merged 1 commit into
mainfrom
imported-pr-actions
Oct 21, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
imported-pr-actions

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Builds on #178233 (preparing an own PR's head as the conversation's managed workspace), which has landed on main; this PR now targets main directly.

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 pullRequest descriptor (URL, repository, branch) and the currently observed remote head; they do not fabricate a published result or request ID. Their writes require expectedHeadCommit and refuse a requestId, which belongs only to a publication receipt. Actions backed by a real publication receipt continue to require that receipt's requestId and 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 requestId optional on request_review and upload_evidence and lets the action result carry either publication or pullRequest. The tool text tells the model to read with edit first and to send expectedHeadCommit without requestId when the result carries pullRequest.

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 main once #178233 landed there as 9218dca. That replay was patch-identical: git range-diff reports 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: the github_publish tool text (the base rewrote the action list; this PR's sentences about requestId and 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 shared schemaValidation helper; the optional requestId case 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.ts fails 8 of 18 cases: every action in a bound workspace throws This workspace continues an existing PR. Its PR actions are not available yet, including the administrator's inspect and merge and the guest's edit, ready and request_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:

  • Changed-file formatting and lint passed on the 10 changed source files.
  • Type checks passed for every selected core test graph and the core, ui, extensions, extensions-test, scripts and test-root programs, with no graph left unrun.
  • The ten related test files passed: the four test files in the change (the new imported-actions test, the evidence test, the preparation test and the protocol schema test) and every test file that imports a changed module (publication actions, base-refresh actions, own-PR inspection, publication workflows, session GitHub reads, and the github_publish tool 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_pr sentence named upload_evidence unconditionally, 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, main changed 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 onto main after #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-performance fails on main itself, 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 on main's tip, and on other open PRs.

Registered action coverage

The new test file drives the registered sessions.github.action owner through the github_publish tool 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's merge, close and inspect are refused by scope and the guest's ready is 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 receipt requestId or a missing head for the imported target. The evidence-upload test exercises the same target for upload_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

Open preview

Before After
Original PR card showing draft before the Guest request The same original PR card ready for review after the Guest action

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.

  • Baseline: Integration build 45f7aa4 before the readiness request, with the original PR still draft.
  • Exact head: 45f7aa4da479adb8cec5910bf49f59d6f8e93898
  • Scenario: A Guest asks to mark the original imported draft PR ready. The action changes draft state while retaining source and metadata.
  • Runtime/build: OpenClaw 2026.10.4, commit 45f7aa4, tree aa8132e; original 1280 x 720 dark UI. This retained integration is not a deployment of the current PR head.
  • Action: One natural Guest send and one ready mutation using the observed head, without a publication requestId.
  • Observed result: Original PR changed from draft to open; captured source and metadata were unchanged.
  • Recorder limitation: The strict allowlist stopped after extra read-only checks, before its final dedicated assertion. Native and GitHub results were reconciled without replay.
  • The continuous recording uses the original source frames without replay, splicing, retiming or added holds.
  • All 972 output frames were inspected; matched stills and key input/result frames were also checked.
  • The inspected hashes match these media files, with private context masked.
  • Native and GitHub observations confirm the requested state change and preservation of captured source/session state.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: The workspace is bound to the PR, but edit, ready and re-review actions refuse without a completed publication.
  • After: The guest reads and updates the original PR using its observed head without a requestId.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused implementation with retained live evidence and production-owner authority coverage; the verified branch conflict is a workflow blocker rather than a patch defect.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The retained integration demonstrates guest actions on the original imported PR, with inspected screenshots confirming draft-to-ready; current-head registered-owner coverage supplies allowed and forbidden principal controls, requester revocation during awaited work, and binding invalidation before upload I/O. GitHub I/O is synthetic in those authority controls, and live administrator variants are not claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A contributor can prepare an existing PR but cannot edit it, mark it ready, request re-review or attach evidence through the managed action path before publishing more source.
Reason: The maintainer-authored direction completes a coherent action stage while explicitly leaving source publication and later-head imports to separate contributions.

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
Reviewed head: 984eb8c08d99a56df2ccacab5a0f1a40a4f64ede

Before merge

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced changes verified: The pinned introduction diff adds imported-target handling while preserving receipt-backed requestId checks and removing the prerequisite’s blanket refusal. (src/gateway/github-publication-actions.ts:113, 984eb8c08d99)
  • Current-main boundary: Current main still selects completed publication receipts; own-PR inspection landed through feat: inspect existing own pull requests #178055, while workspace preparation remains separately owned by feat: prepare existing PR source in a managed workspace #178233. (src/gateway/github-publication-actions.ts:224, 43c99e871f38)
  • Authority boundary coverage: Registered-tool tests use real requester, identity and session owners with synthetic GitHub I/O, covering guest denial of privileged actions, revoked requester authority, changed bindings and refusal before external writes. (src/gateway/github-publication-imported-actions.test.ts:265, 984eb8c08d99)
  • Retained live evidence inspected: Downloaded before/after screenshots show the original PR changing from draft to ready on integration candidate 45f7aa4. Video preparation failed with 'ffprobe failed: spawnSync ffprobe ENOENT'; browser fallback returned Cache miss. The linked preview gist returned HTTP 403 through the repository token and was inaccessible through the web fallback; these review-side limits do not invalidate the inspected screenshots or registered-owner evidence.
  • Current conflict confirmed: For reviewed head 984eb8c, GitHub reports mergeable=false and mergeable_state=dirty against prepare-existing-pr at b5bc8c4. (984eb8c08d99)
  • Policy and history applied: Read root and applicable docs, agents, Gateway and test instructions; no maintainer-notes directory exists. Feature history identifies the action and broker owners; follow-history encountered unavailable old blobs, so introduction claims rely on verified merged commits and their recorded reasons. (AGENTS.md, 43c99e871f38)

Likely related people:

  • Shakker: Raw commit bf90074 adds src/agents/tools/github-publish-tool.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bf90074c33e2; files: src/agents/tools/github-publish-tool.ts)
  • Peter Steinberger: Raw commit 503ae08 adds src/agents/tools/github-publish-tool.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 503ae08b7b16; files: src/agents/tools/github-publish-tool.ts)
  • stevenlee-oai: Raw commit 1bd22b2 adds src/agents/tools/github-publish-tool.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 1bd22b28d632; files: src/agents/tools/github-publish-tool.ts)

PR surface

Source +112, Tests +463, Docs +15. Total +590 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 285 173 +112
Tests 6 493 30 +463
Docs 1 19 4 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 797 207 +590

Review metrics

Metric Value Why it matters
Production versus test changes Production +285/-173; tests and support +493/-30. Growth supports imported-target selection and distinct authority regressions; the extracted target module replaces existing handler code rather than adding a competing owner.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This enables a bounded contributor workflow without changing ordinary publication defaults or granting guests privileged landing actions.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-20T08:55:02.080Z sha 4cd2366 :: needs real behavior proof before merge. :: none

Reviewed October 21, 2026, 7:20 AM ET / 11:20 UTC (Revision 2).

@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 21, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@shakkernerd
shakkernerd force-pushed the prepare-existing-pr branch 3 times, most recently from f6a4786 to 087a07f Compare October 21, 2026 12:32
Base automatically changed from prepare-existing-pr to main October 21, 2026 12:55
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

Current revision: 7b74f99d505255c10e68cd0453e3daa47148c7b8

This PR no longer changes files in the maintainer security-review tier.

Separate CODEOWNERS requirements still apply to security policy and enforcement files.

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
@shakkernerd
shakkernerd merged commit 4f9aa4c into main Oct 21, 2026
139 of 142 checks passed
@shakkernerd
shakkernerd deleted the imported-pr-actions branch October 21, 2026 13:55
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Added: github_publish edit, ready, request_review and upload_evidence act on a conversation's bound original PR without a publication receipt, while merge, close and inspect on it remain limited to full operator write access.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant