[PR #7285] fix(tui): restore showDetails check removed in Permission rework #12337

Closed
opened 2026-02-16 18:17:15 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7285

State: closed
Merged: Yes


Fixes #7286

Problem

The 'Hide tool details' toggle in the command palette (Ctrl+P) has no effect on the UI - completed tools are always displayed regardless of the setting.

Root Cause

The Permission rework commit 351ddeed9 (merged 2026-01-01, PR #6319) accidentally removed the showDetails check from the ToolPart function when refactoring the tool rendering system.

Before Permission rework (working):

function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) {
  const { theme } = useTheme()
  const { showDetails } = use()  // <-- Gets showDetails from context
  const sync = useSync()
  const [margin, setMargin] = createSignal(0)
  const component = createMemo(() => {
    // Hide tool if showDetails is false and tool completed successfully
    // But always show if there's an error or permission is required
    const shouldHide =
      !showDetails() &&
      props.part.state.status === "completed" &&
      !sync.data.permission[props.message.sessionID]?.some((x) => x.callID === props.part.callID)

    if (shouldHide) {
      return undefined  // <-- Returns nothing, hiding the tool
    }
    // ...
  })
}

After Permission rework (broken):

function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) {
  const sync = useSync()
  // <-- No use() call!
  // <-- No showDetails check!

  const toolprops = { /* ... */ }

  return (
    <Switch>
      // <-- Always renders all tools unconditionally
    </Switch>
  )
}

Fix

Restore the showDetails check by:

  1. Adding const ctx = use() to access the context
  2. Adding a shouldHide memo with the original logic
  3. Wrapping the return in <Show when={!shouldHide()}>

The fix preserves the original behavior:

  • Hide completed tools when showDetails is false
  • Always show tools that are pending/running (so users see progress)
  • Always show tools that require permission (so users can respond)

The fix uses the same permission data structure (x.tool?.callID) as the existing code, aligning with the new permission system introduced in the rework.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7285 **State:** closed **Merged:** Yes --- Fixes #7286 ## Problem The 'Hide tool details' toggle in the command palette (Ctrl+P) has no effect on the UI - completed tools are always displayed regardless of the setting. ## Root Cause The Permission rework commit 351ddeed9 (merged 2026-01-01, PR #6319) accidentally removed the `showDetails` check from the `ToolPart` function when refactoring the tool rendering system. ### Before Permission rework (working): ```typescript function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) { const { theme } = useTheme() const { showDetails } = use() // <-- Gets showDetails from context const sync = useSync() const [margin, setMargin] = createSignal(0) const component = createMemo(() => { // Hide tool if showDetails is false and tool completed successfully // But always show if there's an error or permission is required const shouldHide = !showDetails() && props.part.state.status === "completed" && !sync.data.permission[props.message.sessionID]?.some((x) => x.callID === props.part.callID) if (shouldHide) { return undefined // <-- Returns nothing, hiding the tool } // ... }) } ``` ### After Permission rework (broken): ```typescript function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) { const sync = useSync() // <-- No use() call! // <-- No showDetails check! const toolprops = { /* ... */ } return ( <Switch> // <-- Always renders all tools unconditionally </Switch> ) } ``` ## Fix Restore the showDetails check by: 1. Adding `const ctx = use()` to access the context 2. Adding a `shouldHide` memo with the original logic 3. Wrapping the return in `<Show when={!shouldHide()}>` The fix preserves the original behavior: - Hide completed tools when showDetails is false - Always show tools that are pending/running (so users see progress) - Always show tools that require permission (so users can respond) The fix uses the same permission data structure (`x.tool?.callID`) as the existing code, aligning with the new permission system introduced in the rework.
yindo added the pull-request label 2026-02-16 18:17:15 -05:00
yindo closed this issue 2026-02-16 18:17:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12337