UAT: ExpandProtocol and space-to-expand/collapse not implemented for ToolCall, ActorThought, DiffView blocks #1354

Open
opened 2026-04-02 16:57:44 +00:00 by freemo · 0 comments
Owner

Bug Report: [tui] — ExpandProtocol and space-to-expand/collapse not implemented

Severity Assessment

  • Impact: Medium. Users cannot expand or collapse verbose blocks (tool calls, actor thoughts, diffs), making the conversation stream unmanageable for complex interactions.
  • Likelihood: 100% reproducible — the feature does not exist in master or in the unmerged PR branch.
  • Priority: Medium

Location

  • Missing protocol: No ExpandProtocol class anywhere in src/cleveragents/tui/
  • Missing binding: space key not bound in src/cleveragents/tui/screens/main_screen.py (PR branch)
  • Spec reference: docs/specification.md, lines 29668–29670, 29771

Description

The specification requires that blocks implementing the ExpandProtocol (specifically ToolCall, ActorThought, and DiffView) can be toggled between collapsed and expanded states using the space key when the block cursor is focused on them. The indicator (collapsed) changes to (expanded) on toggle.

Neither the ExpandProtocol nor the space key binding exists anywhere in the codebase.

Spec Requirements Not Met

Per docs/specification.md:

Requirement Status
ExpandProtocol interface for expandable blocks Missing
space key — expand/collapse focused block Missing
indicator for collapsed blocks Missing
indicator for expanded blocks Missing
ActorThought block: max 10 lines collapsed, full content expanded Missing
ToolCall block: expandable with content Missing
DiffView block: expandable diff content Missing
m in context menu — maximize/restore for expandable blocks Missing

Evidence

Spec requirement (docs/specification.md, line 29668):

space — Expand or collapse the focused block (if expandable)

Spec requirement (docs/specification.md, line 29670):

Blocks that implement the ExpandProtocol (ToolCall, ActorThought, DiffView) can be toggled with space. The indicator (collapsed) changes to (expanded) on toggle.

PR branch main_screen.py BINDINGS — no space binding:

BINDINGS: ClassVar[list[BindingType]] = [
    Binding("shift+tab", "cycle_sidebar", "Sidebar", show=True),
    Binding("ctrl+q", "quit_app", "Quit", show=True),
    Binding("escape", "escape_cascade", "Back", show=True),
    Binding("alt+up", "cursor_up", "Cursor Up", show=False),
    Binding("alt+down", "cursor_down", "Cursor Down", show=False),
    # No "space" binding
]

PR branch conversation.pyConversationBlock has expandable and expanded fields but no expand/collapse logic:

@dataclass(frozen=True, slots=True)
class ConversationBlock:
    block_id: str
    block_type: BlockType
    content: str
    timestamp: str = ""
    expandable: bool = False
    expanded: bool = False
    # No expand/collapse method; dataclass is frozen so cannot be mutated

The ConversationBlock dataclass is frozen=True, meaning expanded cannot be toggled in place. There is no mechanism to replace a block with an updated version.

Steps to Reproduce

  1. Run the TUI app with block cursor navigation enabled
  2. Navigate to a ToolCall or ActorThought block using alt+up/alt+down
  3. Press space — no expand/collapse occurs
  4. No / indicator is shown

Expected Behavior

  • Pressing space on an expandable block toggles it between collapsed () and expanded () states
  • ActorThought blocks show max 10 lines when collapsed, full content when expanded
  • ToolCall blocks show header only when collapsed, full content when expanded

Actual Behavior

No expand/collapse functionality exists. The space key is not bound. No / indicators are rendered.

Additional Issue: Frozen Dataclass

The ConversationBlock dataclass in the PR branch is frozen=True, which prevents toggling the expanded field. This design flaw must be addressed — either make the dataclass mutable, use a separate mutable state store, or replace the block with a new instance.

Category

tui / block-cursor / expand-protocol / uat


Metadata

  • Branch: feat/tui-expand-protocol
  • Commit Message: feat(tui): implement ExpandProtocol and space-to-expand for ToolCall, ActorThought, DiffView blocks
  • Milestone: v3.7.0
  • Parent Epic: #694

Subtasks

  • Define ExpandProtocol (typing.Protocol) in src/cleveragents/tui/widgets/conversation.py or a shared protocols module
  • Make ConversationBlock.expanded mutable (remove frozen=True or use a separate state dict)
  • Add space binding to MainScreen BINDINGS
  • Implement action_expand_block in MainScreen that toggles the focused block's expanded state
  • Update _render_stream in Conversation to show / indicators based on expandable/expanded
  • Implement ActorThought collapsed rendering (max 10 lines)
  • Write Behave BDD scenarios for expand/collapse behavior
  • Run nox -e typecheck, nox -e unit_tests, nox -e coverage_report

Definition of Done

  • ExpandProtocol is defined and implemented by ToolCall, ActorThought, DiffView block types
  • space key toggles expand/collapse on focused expandable blocks
  • / indicators render correctly
  • ActorThought respects 10-line max-height when collapsed
  • BDD scenarios cover expand/collapse for all three block types
  • All nox stages pass
  • Coverage ≥ 97%
## Bug Report: [tui] — ExpandProtocol and space-to-expand/collapse not implemented ### Severity Assessment - **Impact**: Medium. Users cannot expand or collapse verbose blocks (tool calls, actor thoughts, diffs), making the conversation stream unmanageable for complex interactions. - **Likelihood**: 100% reproducible — the feature does not exist in master or in the unmerged PR branch. - **Priority**: Medium ### Location - **Missing protocol**: No `ExpandProtocol` class anywhere in `src/cleveragents/tui/` - **Missing binding**: `space` key not bound in `src/cleveragents/tui/screens/main_screen.py` (PR branch) - **Spec reference**: `docs/specification.md`, lines 29668–29670, 29771 ### Description The specification requires that blocks implementing the `ExpandProtocol` (specifically `ToolCall`, `ActorThought`, and `DiffView`) can be toggled between collapsed and expanded states using the `space` key when the block cursor is focused on them. The `▶` indicator (collapsed) changes to `▼` (expanded) on toggle. Neither the `ExpandProtocol` nor the `space` key binding exists anywhere in the codebase. ### Spec Requirements Not Met Per `docs/specification.md`: | Requirement | Status | |---|---| | `ExpandProtocol` interface for expandable blocks | ❌ Missing | | `space` key — expand/collapse focused block | ❌ Missing | | `▶` indicator for collapsed blocks | ❌ Missing | | `▼` indicator for expanded blocks | ❌ Missing | | `ActorThought` block: max 10 lines collapsed, full content expanded | ❌ Missing | | `ToolCall` block: expandable with content | ❌ Missing | | `DiffView` block: expandable diff content | ❌ Missing | | `m` in context menu — maximize/restore for expandable blocks | ❌ Missing | ### Evidence **Spec requirement** (`docs/specification.md`, line 29668): > `space` — Expand or collapse the focused block (if expandable) **Spec requirement** (`docs/specification.md`, line 29670): > Blocks that implement the `ExpandProtocol` (ToolCall, ActorThought, DiffView) can be toggled with `space`. The `▶` indicator (collapsed) changes to `▼` (expanded) on toggle. **PR branch `main_screen.py` BINDINGS** — no `space` binding: ```python BINDINGS: ClassVar[list[BindingType]] = [ Binding("shift+tab", "cycle_sidebar", "Sidebar", show=True), Binding("ctrl+q", "quit_app", "Quit", show=True), Binding("escape", "escape_cascade", "Back", show=True), Binding("alt+up", "cursor_up", "Cursor Up", show=False), Binding("alt+down", "cursor_down", "Cursor Down", show=False), # No "space" binding ] ``` **PR branch `conversation.py`** — `ConversationBlock` has `expandable` and `expanded` fields but no expand/collapse logic: ```python @dataclass(frozen=True, slots=True) class ConversationBlock: block_id: str block_type: BlockType content: str timestamp: str = "" expandable: bool = False expanded: bool = False # No expand/collapse method; dataclass is frozen so cannot be mutated ``` The `ConversationBlock` dataclass is `frozen=True`, meaning `expanded` cannot be toggled in place. There is no mechanism to replace a block with an updated version. ### Steps to Reproduce 1. Run the TUI app with block cursor navigation enabled 2. Navigate to a `ToolCall` or `ActorThought` block using `alt+up`/`alt+down` 3. Press `space` — no expand/collapse occurs 4. No `▶`/`▼` indicator is shown ### Expected Behavior - Pressing `space` on an expandable block toggles it between collapsed (`▶`) and expanded (`▼`) states - `ActorThought` blocks show max 10 lines when collapsed, full content when expanded - `ToolCall` blocks show header only when collapsed, full content when expanded ### Actual Behavior No expand/collapse functionality exists. The `space` key is not bound. No `▶`/`▼` indicators are rendered. ### Additional Issue: Frozen Dataclass The `ConversationBlock` dataclass in the PR branch is `frozen=True`, which prevents toggling the `expanded` field. This design flaw must be addressed — either make the dataclass mutable, use a separate mutable state store, or replace the block with a new instance. ### Category tui / block-cursor / expand-protocol / uat --- ## Metadata - **Branch**: `feat/tui-expand-protocol` - **Commit Message**: `feat(tui): implement ExpandProtocol and space-to-expand for ToolCall, ActorThought, DiffView blocks` - **Milestone**: v3.7.0 - **Parent Epic**: #694 ## Subtasks - [ ] Define `ExpandProtocol` (typing.Protocol) in `src/cleveragents/tui/widgets/conversation.py` or a shared protocols module - [ ] Make `ConversationBlock.expanded` mutable (remove `frozen=True` or use a separate state dict) - [ ] Add `space` binding to `MainScreen` BINDINGS - [ ] Implement `action_expand_block` in `MainScreen` that toggles the focused block's expanded state - [ ] Update `_render_stream` in `Conversation` to show `▶`/`▼` indicators based on `expandable`/`expanded` - [ ] Implement `ActorThought` collapsed rendering (max 10 lines) - [ ] Write Behave BDD scenarios for expand/collapse behavior - [ ] Run `nox -e typecheck`, `nox -e unit_tests`, `nox -e coverage_report` ## Definition of Done - [ ] `ExpandProtocol` is defined and implemented by `ToolCall`, `ActorThought`, `DiffView` block types - [ ] `space` key toggles expand/collapse on focused expandable blocks - [ ] `▶`/`▼` indicators render correctly - [ ] `ActorThought` respects 10-line max-height when collapsed - [ ] BDD scenarios cover expand/collapse for all three block types - [ ] All nox stages pass - [ ] Coverage ≥ 97%
freemo self-assigned this 2026-04-02 18:45:19 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#1354
No description provided.