fix(config): deep-compare arrays in config diff to eliminate reload false-positives#154
Open
Gucc111 wants to merge 2 commits into
Open
fix(config): deep-compare arrays in config diff to eliminate reload false-positives#154Gucc111 wants to merge 2 commits into
Gucc111 wants to merge 2 commits into
Conversation
…alse-positives (OpenBMB#147) diffValues treated arrays as leaf values and compared them by reference (Object.is), so every reload created new array instances that were always reported as changed. This caused spurious runtime invalidation and always-on stop/start cycles. Add recursive element-wise comparison for arrays alongside the existing object diff logic. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
diffValuesinclassifyChanges.tsto recursively compare arrays element-by-element instead of usingObject.is()reference equality. This eliminates false-positive config change detection that caused unnecessary runtime invalidation and always-on restart cycles.Closes #147
Root Cause
diffValuesusedisDiffableObject()which explicitly excludes arrays (!Array.isArray(value)), causing arrays to fall through to theObject.is()leaf comparison. Since everyloadPilotConfig()call creates new array instances via[...DEFAULT_*]/.map()/.filter(), identical arrays with different references were always reported as changed.The 6 affected fields —
alwaysOn.dormancy.ignoreGlobs,model.providers.*.models.*.multimodal.input,router.autoOrchestrate.allowedTools,router.autoOrchestrate.triggerTiers,router.fallback.default,router.tokenSaver.rules— are all array-typed config values that get freshly allocated on each parse.Test plan
node --test)Config reloaded, invalidating runtimeslog should appearpilotdeck.yaml(e.g.alwaysOn.dormancy.debounceMs) — only that field is reported, no array fields leak into the diffMade with Cursor