Fix tool block auto-expand bug across sessions in Vue chat UI
Session from pi-web on Hugging Face by woxQAQ · MIT · condensed by Coders Talk
Click a segment to jump to that moment
30msession
0interventions
by library · 2d
GOAL
Investigate a bug where tool call blocks in the chat transcript UI would randomly expand on their own, and fix the root cause.
- +22mPrompt · +22mTool blocks keep expanding on their own, figure out why
- +23mAgent did · +23mSearched and read through ChatTranscript.vue, transcript.ts, bridge types.ts, and useBridgeClient.ts to trace how tool block expand/collapse state keys are generated and stored
- +27mAgent did · +27mEdited ChatTranscript.vue to scope the toolBlockKey function by sessionPath so expand state isn't shared across sessions with reused message keys
- +28mAgent did · +28mRan pnpm build:web to verify the fix builds successfully
- +29mAgent did · +29mRe-checked toolBlockKey implementation, the ChatTranscript session-path prop wiring in AppMainContent.vue, and the transcriptKey normalization in useBridgeClient.ts to confirm the root cause and fix location
- +30mOutcome · +30mRoot cause identified: ChatTranscript.vue is reused across sessions and its message keys (e.g. snapshot:${index}) can repeat, so tool block expand state leaked between sessions. Fixed by scoping toolBlockKey with sessionPath; pnpm build:web passed.
VERDICT
Next time I'd describe the bug with more specifics up front, like which sessions or scroll actions trigger it, since that would have saved a lot of exploratory code reading. The fix itself worked on the first try once the agent traced the key reuse across the reused ChatTranscript component, but I haven't confirmed yet that the actual repro case (switching sessions) is fixed since I never followed up with an interruption or further test.