diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.ts
index 07e0e520d8..b7bf535976 100644
--- a/apps/web/src/components/CommandPalette.logic.ts
+++ b/apps/web/src/components/CommandPalette.logic.ts
@@ -161,7 +161,7 @@ export type BuildThreadActionItemsThread = Pick<
| "id"
| "modelSelection"
| "projectId"
- | "session"
+ | "runtime"
| "title"
| "worktreePath"
> & {
diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx
index f271f7d556..50b4ccd148 100644
--- a/apps/web/src/components/CommandPalette.tsx
+++ b/apps/web/src/components/CommandPalette.tsx
@@ -1022,7 +1022,7 @@ function OpenCommandPaletteDialog(props: {
renderTrailingContent: (thread) => ,
renderDescription: (thread, { projectTitle }) => {
const modelInstanceId =
- thread.session?.providerInstanceId ?? thread.modelSelection.instanceId;
+ thread.runtime?.providerInstanceId ?? thread.modelSelection.instanceId;
const providerEntry =
providerEntryByEnvironmentAndInstanceId.get(
`${thread.environmentId}:${modelInstanceId}`,
@@ -1038,7 +1038,7 @@ function OpenCommandPaletteDialog(props: {
isCurrent={thread.id === activeThreadId}
driverKind={providerEntry?.driverKind ?? null}
providerDisplayName={
- thread.session?.providerName ?? providerEntry?.displayName ?? modelInstanceId
+ thread.runtime?.providerName ?? providerEntry?.displayName ?? modelInstanceId
}
/>
);
diff --git a/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx b/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
index da78751d91..7237b43574 100644
--- a/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
@@ -47,7 +47,10 @@ import {
useState,
} from "react";
+import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
+import { useNewThreadHandler } from "~/hooks/useHandleNewThread";
import { useCopyToClipboard, writeTextToClipboard } from "~/hooks/useCopyToClipboard";
+import { usePreparePullRequestThreadAction } from "~/lib/sourceControlActions";
import { cn } from "~/lib/utils";
import { readLocalApi } from "~/localApi";
import type { ReviewCommentContext } from "~/reviewCommentContext";
@@ -91,7 +94,6 @@ import { openOnHostLabel, showPullRequestLinkContextMenu } from "./pullRequestLi
import { PullRequestSummaryTab } from "./PullRequestSummaryTab";
import { PullRequestTimelineTab } from "./PullRequestTimelineTab";
import {
- allowedPullRequestMergeMethods,
buildAskAboutLinesHandoff,
buildAskAboutPullRequestHandoff,
buildExplainPullRequestHandoff,
@@ -1011,8 +1013,26 @@ export function PullRequestDetailPanel({
useEffect(() => {
if (!visibleTabs.some((item) => item.value === tab)) setTab("summary");
}, [tab, visibleTabs]);
- const can = (action: PullRequestAction) => canPerformPullRequestAction(detail, action);
- const primaryAction = resolvePullRequestPrimaryAction(detail);
+ // Two questions, both of which have to say yes: whether this host can do it at all, and
+ // whether this account may. A reader with read access on someone else's project sees the pull
+ // request and none of the buttons that would only ever be refused.
+ const can = (action: PullRequestAction) =>
+ detail?.capabilities.actions.includes(action) === true &&
+ detail.viewerPermissions.actions.includes(action);
+ // One live action holds the slot. A conflicting change cannot be merged now, so the slot goes
+ // to the thing that would help instead of a Merge button that only ever says no.
+ const primaryAction =
+ detail === null || detail.state !== "open"
+ ? null
+ : detail.isDraft && can("ready")
+ ? "ready"
+ : !can("merge")
+ ? null
+ : conflicting
+ ? "resolve"
+ : allowedMergeMethods.length > 0
+ ? "merge"
+ : null;
// The pull request number carries this state in the overview and the right-panel tab mirrors
// it. Conflicts keep their own row below: an open pull request remains green there.
const statePresentation = detail
diff --git a/apps/web/src/components/pullRequest/usePullRequestActions.ts b/apps/web/src/components/pullRequest/usePullRequestActions.ts
index 43ab130a50..8ae6b14bf0 100644
--- a/apps/web/src/components/pullRequest/usePullRequestActions.ts
+++ b/apps/web/src/components/pullRequest/usePullRequestActions.ts
@@ -31,6 +31,9 @@ const ACTION_SUCCESS_LABELS: Record = {
draft: "Converted to draft",
close: "Pull request closed",
reopen: "Pull request reopened",
+ "update-branch": "Branch updated with the base branch",
+ "enable-auto-merge": "Auto-merge enabled",
+ "disable-auto-merge": "Auto-merge disabled",
};
/** Said as the thing that did not happen, rather than as the operation that returned an error. */
@@ -40,6 +43,9 @@ const ACTION_FAILURE_LABELS: Record = {
draft: "Could not convert this to a draft",
close: "Could not close this pull request",
reopen: "Could not reopen this pull request",
+ "update-branch": "Could not update this branch",
+ "enable-auto-merge": "Could not enable auto-merge",
+ "disable-auto-merge": "Could not disable auto-merge",
};
/** What to try, for the times the host says only that it refused. */
@@ -51,6 +57,11 @@ const ACTION_FAILURE_HINTS: Record = {
close: "The host refused it. Check that you have write access, or that you opened it.",
reopen:
"The host refused it. Check that you have write access, and that the branch still exists.",
+ "update-branch":
+ "The host refused it. Check that you have write access, and that the base branch has not diverged in a way the host cannot merge.",
+ "enable-auto-merge":
+ "The host refused it. Check that auto-merge is enabled for this repository and that you have write access.",
+ "disable-auto-merge": "The host refused it. Check that you have write access to this repository.",
};
/**