The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(chat): stop offering an Edit button the runtime cannot honour
M3gA-Mindfb2bcb65a4ab
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsxindex f1109229f1..9331bedd22 100644--- a/app/src/components/assistant-ui/thread.tsx+++ b/app/src/components/assistant-ui/thread.tsx@@ -28,6 +28,7 @@ import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-buttonimport { Button } from '@/components/assistant-ui/ui/button';import { Skeleton } from '@/components/assistant-ui/ui/skeleton';import ModelQualityPill from '@/components/chat/ModelQualityPill';+import { useAuiEditCapabilities } from '@/features/conversations/components/aui/auiThreadState';import {ActionBarMorePrimitive,ActionBarPrimitive,@@ -848,6 +849,16 @@ const UserMessage: FC = () => {};const UserActionBar: FC = () => {+ // Edit is offered only when the bound runtime can honour it. The+ // external-store adapter supplies `onNew` / `onCancel` and neither `onEdit`+ // nor `setMessages`, so assistant-ui reports `edit: false` and+ // `EditComposer` below never renders — the button was clickable and did+ // nothing (#5897).+ //+ // Gated on the capability rather than hard-coded off, so the affordance+ // appears by itself the day the adapter grows `onEdit`.+ const { canEdit } = useAuiEditCapabilities();+return (<ActionBarPrimitive.RoothideWhenRunning@@ -858,11 +869,13 @@ const UserActionBar: FC = () => {<CopyIcon /></TooltipIconButton></ActionBarPrimitive.Copy>- <ActionBarPrimitive.Edit asChild>- <TooltipIconButton tooltip="Edit" className="aui-user-action-edit">- <PencilIcon />- </TooltipIconButton>- </ActionBarPrimitive.Edit>+ {canEdit && (+ <ActionBarPrimitive.Edit asChild>+ <TooltipIconButton tooltip="Edit" className="aui-user-action-edit">+ <PencilIcon />+ </TooltipIconButton>+ </ActionBarPrimitive.Edit>+ )}</ActionBarPrimitive.Root>);};@@ -895,6 +908,15 @@ const EditComposer: FC = () => {};const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({ className, ...rest }) => {+ // The same defect class as the Edit button above, one step from biting: this+ // is rendered unconditionally at both call sites and is invisible today only+ // because `hideWhenSingleBranch` happens to hold — the adapter implements no+ // `setMessages`, so there is never more than one branch. That is+ // assistant-ui's guard doing the work this app intended to do itself, and it+ // would become a second dead control if the prop ever went away.+ const { canSwitchToBranch } = useAuiEditCapabilities();+ if (!canSwitchToBranch) return null;+return (<BranchPickerPrimitive.RoothideWhenSingleBranchdiff --git a/app/src/features/conversations/components/aui/auiThreadState.ts b/app/src/features/conversations/components/aui/auiThreadState.tsindex a73587d31d..896de8ff2f 100644--- a/app/src/features/conversations/components/aui/auiThreadState.ts+++ b/app/src/features/conversations/components/aui/auiThreadState.ts@@ -58,8 +58,13 @@ export function useAuiThreadRunning(): boolean | undefined {* that faithfully, so this hook is the honest gate for those affordances rather* than a hard-coded `false` that would rot the day the adapter grows them.*- * Nothing renders behind it today — see `EDIT_AND_BRANCH_SEAM` below for where- * an edit composer / `BranchPickerPrimitive` would attach.+ * Both affordances in `components/assistant-ui/thread.tsx` are gated on this+ * (#5897): `UserActionBar` renders `ActionBarPrimitive.Edit` only when+ * `canEdit`, and `BranchPicker` returns `null` unless `canSwitchToBranch`.+ * Neither is reachable today, which is the point — an edit button that looks+ * supported and silently does nothing is worse than no button. See+ * `EDIT_AND_BRANCH_SEAM` below for where the edit composer itself attaches when+ * the adapter grows `onEdit` / `setMessages`.*/export function useAuiEditCapabilities(): { canEdit: boolean; canSwitchToBranch: boolean } {const canEdit = useAuiState(selectCanEdit) ?? false;@@ -90,6 +95,11 @@ export function useAuiEditCapabilities(): { canEdit: boolean; canSwitchToBranch:** They are deliberately absent rather than rendered-and-inert: an edit button* that looks supported and silently does nothing is worse than no button.+ *+ * That rule was stated here but not enforced anywhere until #5897 — this hook+ * had zero production consumers while `ActionBarPrimitive.Edit` shipped+ * unconditionally, so the button was rendered, clickable and inert. The gate is+ * wired now; keep it wired when the affordances move into `TranscriptRow`.*/export const EDIT_AND_BRANCH_SEAM = Object.freeze({editComposer: 'TranscriptRow — gated on useAuiEditCapabilities().canEdit',