Skip to content

fix: gate BranchPicker and edit pencil on runtime capabilities#327

Merged
pikann merged 1 commit into
masterfrom
fix/suppress-branch-picker-no-edit-capability
Jul 24, 2026
Merged

fix: gate BranchPicker and edit pencil on runtime capabilities#327
pikann merged 1 commit into
masterfrom
fix/suppress-branch-picker-no-edit-capability

Conversation

@pikann

@pikann pikann commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The BranchPicker and the user message's edit pencil in thread.tsx rendered unconditionally, regardless of whether the runtime actually supports switching branches or editing — assistant-ui's underlying hooks only check local UI state, not thread.capabilities.
  • Neither conversation-view.tsx nor ai-chat-float.tsx wire up onEdit/setMessages on useExternalStoreRuntime, so those capabilities are always false there — yet the controls showed up anyway on every message, and clicking them would throw a runtime error ("Runtime does not support switching branches" / "...editing messages").
  • Wrapped both in <AuiIf condition={(s) => s.thread.capabilities.switchToBranch}> and <AuiIf condition={(s) => s.thread.capabilities.edit}> so they only render when a runtime genuinely supports them.

Fixes #313

Test plan

  • npx vitest run in apps/web — 315 tests passing
  • npx tsc -b — no type errors
  • Verified via a runtime harness that capabilities.edit and capabilities.switchToBranch are false for the exact useExternalStoreRuntime config used in conversation-view.tsx / ai-chat-float.tsx

🤖 Generated with Claude Code

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — gates BranchPicker and the edit pencil in thread.tsx behind thread capability checks so they don't appear (and throw) when the runtime doesn't support those operations.

  • Gate edit pencil on capabilities.editActionBarPrimitive.Edit is now wrapped in <AuiIf> so it only renders when the runtime has onEdit wired up.
  • Gate BranchPicker on capabilities.switchToBranchBranchPickerPrimitive.Root is now wrapped in <AuiIf> so it only renders when the runtime has setMessages wired up.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

@pikann
pikann merged commit 445f064 into master Jul 24, 2026
1 check passed
@pikann
pikann deleted the fix/suppress-branch-picker-no-edit-capability branch July 24, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Message version arrows appear on conversations that were never edited

1 participant