feat: expose Smart sticky sessions#5198
Open
eyaeya wants to merge 1 commit into
Open
Conversation
|
用ai用魔怔了? |
Contributor
Author
@Pluviophile714 |
This was referenced Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency chain
This PR is part of a three-PR change set for Smart
strategy: sticky-sessionssupport:This OpenClash PR depends on compatible core support. It only exposes and writes
strategy: sticky-sessions; the actual affinity behavior must be implemented by the selected core.Compatibility dependency by selected core:
Recommended merge/release order:
strategy: sticky-sessions.On older cores, generated YAML containing Smart
strategymay fail config parsing. That is why this PR keeps the option opt-in, leaves defaults unchanged, and includes LuCI wording that calls out the core dependency.Summary
Expose Smart
strategy: sticky-sessionsin OpenClash without changing existing defaults.This PR only wires configuration and LuCI. The actual sticky behavior must be provided by a compatible Smart-capable core.
Root cause
Router-side investigation found that OpenClash had partial Smart strategy plumbing but no working end-to-end path:
yml_groups_get.shcould import a Smart YAMLstrategyinto UCI asstrategy_smart.yml_groups_set.shdid not read or writestrategy_smart, so exporting/regenerating YAML dropped it.strategyonly forload-balance, not Smart.url-test/load-balancegroups tosmartand added LightGBM/collect/prefer-ASN fields, but never wrote a Smart strategy.strategy, so OpenClash must not present this as an OpenClash-only fix.Design
strategy_smartLuCI option for Smart groups.sticky-sessionsfor Smart groups; do not offerround-robinorconsistent-hashingbecause those remain load-balance strategies.strategy_smartinyml_groups_set.shand writestrategy: sticky-sessionsonly when explicitly set.smart_strategy, defaulting to0, for Smart auto-switch/overwrite flows.smart_strategyintoyml_rules_change.shand only writegroup['strategy'] = 'sticky-sessions'when the user explicitly selects it.strategyunless explicitly configured.smart_strategyto groups newly converted by Smart auto-switch; existing Smart groups continue to use their per-groupstrategy_smartsetting.Validation
bash -n luci-app-openclash/root/usr/share/openclash/*.sh luci-app-openclash/root/etc/init.d/openclash tests/openclash_smart_strategy_test.shtests/openclash_smart_strategy_test.shgit diff --check HEAD^ HEAD