I found the prior implementation was 100% reliable when āpreload top hitā was disabled in Safari settings.
Iām guessing the new implementation is using declarative net requests to rewrite the URL of the selected search engine. The buggy behaviour suggests to me that the rewrites are generated dynamically from the selected default search engine. After some time when the Kagi extension is backgrounded, the rewrite is lost.
If that assumption is correct, then you would be better off writing a static set of rewrite rules that ship with the extension and not asking users to select the search engine in the extension, but instead ask them to enable permissions to use the extension on the domain of the Safari default search engine that they have selected.