| 3847 | 3855 | console.debug(`[WI] Sucessfully activated ${successfulNewEntries.length} new entries to prompt. ${allActivatedEntries.size} total entries activated.`, successfulNewEntries); |
| 3848 | 3856 | } |
| 3849 | 3857 | |
| 3850 | 3858 | // After processing and rolling entries is done, see if we should continue with normal recursion |
| 3851 | 3859 | if (world_info_recursive && !token_budget_overflowed && successfulNewEntriesForRecursion.length) { |
| 3852 | 3860 | nextScanState = scan_state.RECURSION; |
| 3853 | 3861 | } |
| 3854 | 3862 | |
| 3863 | + // If we are inside min activations scan, and we have recursive buffer, we should do a recursive scan before increasing the buffer again |
| 3864 | + // There might be recurse-trigger-able entries that match the buffer, so we need to check that |
| 3865 | + if (world_info_recursive && !token_budget_overflowed && scanState === scan_state.MIN_ACTIVATIONS && buffer.hasRecurse()) { |
| 3866 | + nextScanState = scan_state.RECURSION; |
| 3867 | + } |
| 3868 | + |
| 3855 | 3869 | // If scanning is planned to stop, but min activations is set and not satisfied, check if we should continue |
| 3856 | 3870 | const minActivationsNotSatisfied = world_info_min_activations > 0 && (allActivatedEntries.size < world_info_min_activations); |
| 3857 | 3871 | if (!nextScanState && !token_budget_overflowed && minActivationsNotSatisfied) { |