fix: reset tool aggregator whenever something other than a tool card gets inserted - #870
Conversation
|
Thanks @kishore280 for opening the PR! Please add a changeset to your PR as well. |
akramcodez
left a comment
There was a problem hiding this comment.
Hey @kishore280, thanks for the fix! I tested it and the tool-call phase separation looks good. I noticed one small regression though: the copy button and timestamp footer can now appear multiple times within the same turn after each text chunk. Please keep a single footer per turn and move it to the latest text block as the response streams. Once that's fixed, this should be good to go.
d4c0b17 to
e4c3bb4
Compare
|
Pushed 3 commits. First one is the footer-per-turn change from the review. The other two are bugs I found while testing it, not extra scope:
jsdom repros: |
…ator-phase-reset # Conflicts: # assets/nanocoder-vscode.vsix # plugins/vscode/media/chat-panel.js
|
Hey @kishore280 - nice catch on the root cause, and mirroring the 1. The reset misses the edit-card and plan-card paths. Mutating tools ( function closeAggregatorIfIdle() {
if (currentAggregator && !aggregatorHasPendingTools(currentAggregator)) {
currentAggregator.close();
currentAggregator = null;
}
}2. Minor: the footer rework in |
…thought/message Also fixes close() re-expanding a manually collapsed card.
Fixes #856.
currentAggregator only reset at the end of a turn, not when a thought or text chunk interrupted a tool-call phase. Tool → Thought → Tool merged the second tool into the first card instead of starting a fresh one.
Review found the same gap in two more spots: a mutating-tool edit card and a plan update also skip the reset, so Tool → Edit → Tool hits the same bug. Pulled the check into one closeAggregatorIfIdle() helper instead of four copies of it.
close() was also re-expanding manually collapsed cards - toggle(force) never used the force argument, so close()'s toggle(false) just flipped whatever state it was already in. Fixed to match ThoughtAggregator's toggle, which already handles force correctly.
Testing the footer-per-turn change from the earlier review turned up two more bugs, both with repro tests: an old turn's copy button could grab a newer turn's text, and interrupting a still-pending tool could duplicate its card with a stuck spinner.