Saved-session refresh reconciles the full catalog per streamed item #1801
Replies: 1 comment
|
Investigated this report and produced a candidate fix, validated on a fork of this repository. Root cause, fix and validation from the working notes:
Diff: awhite0030/prime-agent@main...fix-throttle-saved-session-updates-372602986612314753 The change passes |
Uh oh!
There was an error while loading. Please reload this page.
When the saved-session view refreshes, it streams items one at a time, and for each one it runs a full catalog reconciliation. As the saved-session catalog grows, that repeated per-item work scales badly: the same reconciliation logic runs again and again instead of once for the batch.
The fix I'm proposing is small: throttle progressive updates during the refresh to a bounded 100 ms window, without resetting the timer for each new item that arrives inside that window. The final result still goes through immediate, full reconciliation, so the authoritative payload and the daemon/catalog protocol don't change at all. This only affects how often the intermediate UI updates happen while streaming.
The change touches exactly two files: the source file with the throttling logic, and its test file.
Validation:
An independent review also looked at this and approved the direction.
I opened PR #1800 (#1800) with the implementation, but it was automatically closed by the contribution gate. Per CONTRIBUTING.md, public contributions are supposed to start here in Discussions, so I'm posting this to get maintainer feedback on the approach before going further.
Happy to share more detail on the implementation if useful.
All reactions