gptel icon indicating copy to clipboard operation
gptel copied to clipboard

Fix memory-report error with gptel's transient history

Open jwiegley opened this issue 3 months ago • 0 comments

Summary

  • Fixes #1032 where memory-report fails when trying to compute the size of gptel's transient history
  • Prevents storing backend structs (which contain bytecode) in transient's history
  • Adds test to verify the fix works correctly

Problem

When memory-report tries to traverse the gptel-gemini struct stored in transient-history, it encounters an out-of-bounds error when accessing the struct's slots. This happens because the struct contains a compiled function (bytecode) in its :url slot, which memory-report doesn't handle correctly.

Solution

The fix adds history-key and history-default slots (both set to nil) to the gptel-provider-variable class. This prevents transient from storing the backend struct in its history, avoiding the memory-report error while maintaining full functionality of the transient menu.

Test plan

  • [x] Added test file gptel-transient-memory-test.el to verify the fix
  • [x] Verified that gptel-menu still works correctly
  • [x] Confirmed that backend switching and model selection still function properly

🤖 Generated with Claude Code

jwiegley avatar Aug 21 '25 21:08 jwiegley