[PR #2846] TUI: scope permission events to active session; eliminate cross-session churn #10459

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

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

State: closed
Merged: No


Summary

  • Scope permission prompts, chat re-renders, and editor spinner animation strictly to the active session (and its parent), eliminating cross‑session churn that produced idle CPU and shimmer stutter.

Motivation

The TUI previously treated all project permission updates as relevant. That kept the editor spinner alive and triggered re-renders for unrelated sessions—especially noticeable when the app was idle or in the background.

Changes

  • Gate permission.updated and permission.replied to the active session family (active or parent).
  • Only re-render chat on in-scope permission events.
  • Animate editor spinner only for in-scope permissions.
  • De-duplicate permission queue by ID.
  • Clean permission queue on session switch.
  • Scope SSE subscription to project worktree directory (EventListParams.Directory) with fallback to unscoped on error.

No flags or environment toggles—global efficiency improvement.

Behavior

  • Idle: no redraw/spinner churn from other sessions.
  • Active: full responsiveness unchanged for prompts, permissions, and animations.

Risk / Compatibility

  • Low: confines UI updates to the viewed session family. If deeper descendant trees become common, family scoping can be extended in a follow-up.

Testing

  • Built go build ./cmd/smartypants.
  • Verified unrelated sessions no longer trigger redraw/spinner churn; in-scope prompts behave as before.

Files

  • packages/tui/internal/tui/tui.go
  • packages/tui/internal/components/chat/messages.go
  • packages/tui/internal/components/chat/editor.go
  • packages/tui/cmd/smartypants/main.go
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2846 **State:** closed **Merged:** No --- ## Summary - Scope permission prompts, chat re-renders, and editor spinner animation strictly to the active session (and its parent), eliminating cross‑session churn that produced idle CPU and shimmer stutter. ## Motivation The TUI previously treated all project permission updates as relevant. That kept the editor spinner alive and triggered re-renders for unrelated sessions—especially noticeable when the app was idle or in the background. ## Changes - Gate `permission.updated` and `permission.replied` to the active session family (active or parent). - Only re-render chat on in-scope permission events. - Animate editor spinner only for in-scope permissions. - De-duplicate permission queue by ID. - Clean permission queue on session switch. - Scope SSE subscription to project worktree directory (`EventListParams.Directory`) with fallback to unscoped on error. No flags or environment toggles—global efficiency improvement. ## Behavior - Idle: no redraw/spinner churn from other sessions. - Active: full responsiveness unchanged for prompts, permissions, and animations. ## Risk / Compatibility - Low: confines UI updates to the viewed session family. If deeper descendant trees become common, family scoping can be extended in a follow-up. ## Testing - Built `go build ./cmd/smartypants`. - Verified unrelated sessions no longer trigger redraw/spinner churn; in-scope prompts behave as before. ## Files - `packages/tui/internal/tui/tui.go` - `packages/tui/internal/components/chat/messages.go` - `packages/tui/internal/components/chat/editor.go` - `packages/tui/cmd/smartypants/main.go`
yindo added the pull-request label 2026-02-16 18:15:07 -05:00
yindo closed this issue 2026-02-16 18:15:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10459