Repository navigation
fix(db): preserve explicit provider priorities on edit - #15485
Merged
diegosouzapw merged 2 commits intoOct 6, 2026
Merged
diegosouzapw merged 2 commits into
diegosouzapw merged 2 commits into
Conversation
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
Saving a connection's priority succeeds but silently changes the value in SQLite. With one connection, saving
5returns5in the response but stores1; with multiple connections, the same edit renumbers every sibling. This also happens when an unrelated dashboard edit resubmits the existing priority.The update path now preserves explicit positive priorities. The existing internal
priority: 0move-to-top operation still compacts the provider's order, but returns the reread connection so its response agrees with the database.Related Issues
Closes #15014.
Validation
npm run lintVerified against
release/v3.8.52at23a11484862b3bb589a55e85b00e4ac53ffeb234, with Node 22.23.3:1instead of5; editing the first of two connections changed both priorities to ranks instead of keeping2and10.db-providers-crud.test.ts,codex-connection-edit-6562.test.ts, andcodex-bulk-import-preserve-state-11954.test.ts, run as separate processes with the repo's data-directory isolation andDISABLE_SQLITE_AUTO_BACKUP=true.npm run lint: passed.npm run typecheck:core: passed.npm run typecheck:noimplicit:core: blocked by the existingopen-sse/services/combo/autoStrategy.ts:519TS7006 error. I reran it with the original, unmodifiedproviders.tsand got the identical failure. No changes to that unrelated file.The full unit matrix, coverage, and production build are left to PR CI, as the contribution guide recommends.
Tests Added Or Updated
tests/unit/db-providers-crud.test.ts: exact priority survives update, read-by-ID, cached list, and unrelated rename; sibling priorities remain unchanged while ordering follows the new value; internal zero/move-to-top still works and its response matches the final rank.tests/unit/codex-connection-edit-6562.test.ts: real authenticated PUT preserves priority142in both its response and SQLite instead of silently normalizing to1.Coverage Notes
The added tests exercise the real SQLite write/read path, including cached reads, and the existing management API test drives the real PUT handler. No mocks replace the priority persistence behavior. Existing creation, deletion, and bulk-import tests still pass.
Reviewer Notes
This is deliberately an update-path fix. Creation and single-deletion retain their existing priority compaction behavior; it does not promise lifecycle-wide preservation of sparse priorities. No schema migration, feature flag, or live-provider credentials are needed. My running gateway was not modified.