Skip to content

BUG: Delete agent dialog shows '(empty)' button + Treeview text overlap #40

@MelbourneDeveloper

Description

@MelbourneDeveloper

Bug Report: Too Many Cooks VSCode Extension Treeview Issues

Bug 1: Delete Agent Dialog Shows "(empty)" Button

Severity: High - visible UI bug affecting user experience

Description:
When clicking the delete (trash) icon on an agent in the TMC sidebar treeview, the confirmation dialog shows three buttons: "Remove", "(empty)", and "Cancel". The "(empty)" button should not exist.

Root Cause:
In packages/dart_node_vsix/lib/src/window.dart:17-32, the showWarningMessage Dart wrapper always passes 4 arguments to the underlying JS showWarningMessage, even when only one button item is needed:

JSPromise<JSString?> showWarningMessage(
    String message, [
    MessageOptions? options,
    String? item1,
    String? item2,
  ]) {
    if (options != null && item1 != null) {
      return _showWarningMessageWithOptions(
        message,
        options,
        item1,
        item2 ?? '',  // BUG: passes empty string '' when item2 is null
      );
    }
    return _showWarningMessage(message);
  }

When item2 is null (not provided by the caller), the code passes item2 ?? '' (empty string) as the 4th argument. VSCode's showWarningMessage API interprets this empty string as a button label and renders it as "(empty)".

The TypeScript version used variadic rest args and only passed defined items - it never sent empty strings.

Expected: Dialog shows only "Remove" and "Cancel" buttons
Actual: Dialog shows "Remove", "(empty)", and "Cancel" buttons

Fix needed: _showWarningMessageWithOptions should not be called with 4 args when item2 is null. Need either:

  • A separate overload _showWarningMessageWith1Item(message, options, item1)
  • Or conditional logic to only pass non-null items

Bug 2: Treeview Label/Description Text Rendering Overlap

Severity: Medium - visual rendering issue

Description:
In the TMC agents treeview, agent names and their descriptions (e.g., message counts) appear garbled/overlapping. For example:

  • "techdoc-buirider m8gaasgs" instead of clean "techdoc-builder" label with "18 msgs" as separate description
  • "tlahde-coagerit8 4nsgss" instead of "techdoc-agent" with "4 msgs"

The label text and description text appear to be rendering on top of each other in the VSCode treeview.

Possible Root Causes:

  1. JSTreeDataProvider getChildren callback (packages/dart_node_vsix/lib/src/tree_view.dart:149-151):

    _setProperty(
      obj,
      'getChildren',
      ((T? element) => provider.getChildren(element)?.toJS).toJS,
    );

    When VSCode calls getChildren() with no arguments (for root items), JS passes undefined. Dart's JS interop should map undefinednull for nullable T?, but there may be edge cases.

  2. TreeItem label/description property setting: The way TreeItem is constructed via Reflect.construct and then description is set via external setter may cause VSCode's treeview renderer to not properly distinguish label from description.

  3. Could also be a VSCode rendering artifact at certain resolutions/zoom levels, though the character substitution patterns suggest data corruption rather than visual overlap.

Investigation needed: This may require running the extension in debug mode and inspecting the actual TreeItem objects being returned to VSCode's treeview renderer to confirm whether the data is correct (rendering bug) or incorrect (data bug).


Test Coverage Added

A new test file has been created at:
examples/too_many_cooks_vscode_extension/test/suite/treeview_bugs_test.dart

Tests include:

  1. showWarningMessage empty string test - Captures arguments passed to showWarningMessage and asserts no empty string button items are passed
  2. Agent label integrity - Asserts agent label exactly matches agent name (no garbled text)
  3. Agent description format validation - Asserts description matches valid patterns ("idle", "N msgs", "N locks", etc.)
  4. Label/description separation - Asserts label doesn't contain description text and vice versa
  5. Agent children integrity - Validates child items have proper label/description separation

Files Involved

  • packages/dart_node_vsix/lib/src/window.dart - showWarningMessage wrapper (Bug 1 root cause)
  • packages/dart_node_vsix/lib/src/tree_view.dart - TreeItem/JSTreeDataProvider (Bug 2 investigation)
  • examples/too_many_cooks_vscode_extension/lib/ui/tree/agents_tree_provider.dart - Agent tree rendering
  • examples/too_many_cooks_vscode_extension/lib/extension.dart - deleteAgent command handler

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions