Skip to content

Conversation

@Vidit-Ostwal
Copy link
Contributor

This fixes the tool input console formatting
Fixes #3474

@Vidit-Ostwal
Copy link
Contributor Author

Before
Screenshot 2025-09-07 at 12 16 04

After

Screenshot 2025-09-07 at 12 16 41

Comment on lines 1592 to 1606
sources_branch = None

# Try to find an existing "Sources Used" branch
for sub_child in child.children:
if "Sources Used" in str(sub_child.label):
sources_branch = sub_child
break
else:
sources_branch = child.add("Sources Used")
sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
break

# If not found, create it under this child
if sources_branch is None:
sources_branch = child.add("🧠 Sources Used")

sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
break

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is was a logic change done, because of linter.

Comment on lines 1631 to 1645
sources_branch = None

# Try to find an existing "Sources Used" branch
for sub_child in child.children:
if "Sources Used" in str(sub_child.label):
sources_branch = sub_child
break
else:

# If not found, create it under this child
if sources_branch is None:
sources_branch = child.add("🧠 Sources Used")
sources_branch.add(f"❌ {memory_type} - Error: {error}")
break

sources_branch.add(f"❌ {memory_type} - Error: {error}")
break

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one as well

@Vidit-Ostwal
Copy link
Contributor Author

Vidit-Ostwal commented Sep 11, 2025

Requesting @lorenzejay, @lucasgomide for review

cursor[bot]

This comment was marked as outdated.


sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
break

Copy link

Choose a reason for hiding this comment

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

Bug: Memory Query Handling Fails

The refactored logic in handle_memory_query_completed and handle_memory_query_failed incorrectly replaces the for...else construct. The sources_branch variable is reassigned to each inner_child during iteration, making the subsequent if sources_branch is None: check ineffective. This leads to new memory entries being added to the wrong child when no "Sources Used" branch is found, or duplicated if one is found and updated.

Additional Locations (1)

Fix in Cursor Fix in Web

def __init__(self, verbose: bool = False):
self.console = Console(width=None)
self.verbose = verbose
self.tool_usage_counts: dict[str, int] = {}
Copy link

Choose a reason for hiding this comment

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

Bug: Instance Variable Shadows Class Variable

The tool_usage_counts instance variable, initialized in __init__, shadows the class variable of the same name. This prevents tool usage from being tracked globally across all instances, leading to each instance having its own isolated count instead of a shared one.

Fix in Cursor Fix in Web

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.

[FEATURE] JSON console formatting for tool input

1 participant