Skip to content

Commit 36b5684

Browse files
committed
fix(ui): reset completed publication cycles
1 parent 2dbbfd9 commit 36b5684

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎ui/src/e2e/chat-pull-requests.e2e.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,37 @@ describeControlUiE2e("session pull request chips", () => {
372372
path: path.join(publicationProofDir, "02-publication-published.png"),
373373
});
374374
}
375+
376+
await gateway.emitGatewayEvent(CONTROL_UI_SESSION_PULL_REQUESTS_CHANGED_EVENT, {
377+
sessions: {
378+
[watchedKey]: {
379+
pullRequests: [
380+
{
381+
number: 125200,
382+
owner: "openclaw",
383+
repo: "openclaw",
384+
branch: "openclaw/reconciled-publication",
385+
title: "Publish reconciled work",
386+
url: "https://github.com/openclaw/openclaw/pull/125200",
387+
state: "merged",
388+
},
389+
],
390+
branch: {
391+
owner: "openclaw",
392+
repo: "openclaw",
393+
branch: "openclaw/reconciled-publication",
394+
additions: 3,
395+
deletions: 0,
396+
createUrl:
397+
"https://github.com/openclaw/openclaw/pull/new/openclaw/reconciled-publication",
398+
},
399+
rateLimited: false,
400+
status: "ok",
401+
},
402+
},
403+
});
404+
await expect.poll(() => page.getByRole("button", { name: "Publish PR" }).count()).toBe(1);
405+
await expect.poll(() => page.getByRole("link", { name: "Open PR" }).count()).toBe(0);
375406
});
376407

377408
it("drops a deferred publication result after switching to another publishing session", async () => {

‎ui/src/pages/chat/chat-pane-session.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,25 @@ export abstract class ChatPaneSession extends ChatPaneTaskSuggestions {
116116
pullRequestEpoch,
117117
);
118118
}
119+
const published =
120+
this.githubPublicationResult?.status === "published"
121+
? this.githubPublicationResult
122+
: undefined;
123+
const publishedPullRequest = published
124+
? result.pullRequests.find((pullRequest) => pullRequest.url === published.url)
125+
: undefined;
126+
if (
127+
result.branch &&
128+
published &&
129+
(result.branch.branch !== published.branch ||
130+
(publishedPullRequest &&
131+
publishedPullRequest.state !== "open" &&
132+
publishedPullRequest.state !== "draft"))
133+
) {
134+
this.githubPublicationResult = null;
135+
this.githubPublicationError = null;
136+
this.githubPublicationIdempotencyKey = null;
137+
}
119138
this.sessionPullRequestsBranch = result.branch;
120139
this.sessionPullRequestsRateLimited = result.rateLimited;
121140
this.dismissedSessionPullRequestIds = listDismissedChatPullRequests(sessionKey);

0 commit comments

Comments
 (0)