Skip to content

fix: clear stale tenant model ids - #18205

Closed
01JohnMa wants to merge 1 commit into
infiniflow:mainfrom
01JohnMa:codex/clear-chat-rerank
Closed

01JohnMa wants to merge 1 commit into
infiniflow:mainfrom
01JohnMa:codex/clear-chat-rerank

Conversation

@01JohnMa

Copy link
Copy Markdown
Contributor

Summary

Clear the paired tenant model ID when a model selection is explicitly cleared in a whitelisted API request.

Chat settings currently merge the fetched chat object into the update payload. Clearing the rerank selector sets rerank_id to an empty string, but the previously fetched tenant_rerank_id remains in the payload. The backend then resolves that stale tenant model ID back into the rerank model name, so reranking stays enabled after the user saves the cleared selection.

This change makes addTenantParams set the paired tenant_*_id to null when the corresponding model field is explicitly "", null, or undefined. Requests that omit the model field continue to preserve an existing tenant model ID.

User impact

Users can clear the rerank model in chat settings without the previous tenant-scoped model ID silently restoring it. The same synchronization rule applies to other model selectors handled by addTenantParams.

Validation

  • npm test -- --runInBand src/utils/tests/llm-util.test.ts (20 tests passed)
  • npx oxlint src/utils/llm-util.ts src/utils/tests/llm-util.test.ts
  • npx oxfmt --check src/utils/llm-util.ts src/utils/tests/llm-util.test.ts
  • git diff --check

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b0d3c50-9e2f-45a6-83d1-f713e45cc4ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@01JohnMa

Copy link
Copy Markdown
Contributor Author

Superseded by #18210, which contains the same commit and diff under the renamed fix/clear-stale-tenant-model-ids branch.

@01JohnMa

Copy link
Copy Markdown
Contributor Author

Closing in favor of #18210.

@01JohnMa 01JohnMa closed this Aug 13, 2026
@01JohnMa
01JohnMa deleted the codex/clear-chat-rerank branch August 13, 2026 06:44
JinHai-CN added a commit that referenced this pull request Aug 19, 2026
### Summary

Clear the paired tenant model ID when a model selection is explicitly
cleared in a whitelisted API request.

Replaces #18205.

Co-authored-by: Jin Hai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant