Skip to content

fix: from_system_async now reuses provided system instead of creating new one#6874

Open
YizukiAme wants to merge 1 commit intochroma-core:mainfrom
YizukiAme:fix/async-from-system-reuse
Open

fix: from_system_async now reuses provided system instead of creating new one#6874
YizukiAme wants to merge 1 commit intochroma-core:mainfrom
YizukiAme:fix/async-from-system-reuse

Conversation

@YizukiAme
Copy link
Copy Markdown

Fixes #6871

Root cause
AsyncClient.from_system_async() ignored the system object it was given and rebuilt a client from system.settings, which created a fresh shared system instead of binding to the caller's existing component graph.

Fix
This change makes from_system_async() populate and reuse the provided System directly, preserves the existing async initialization flow on top of that system, and adds a regression test that asserts the returned client references the same System instance.

@github-actions
Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Copy Markdown
Contributor

Fix AsyncClient.from_system_async() to Reuse Provided System Instance

This PR fixes a bug where AsyncClient.from_system_async() ignored the input system and instead rebuilt a client using system.settings, which could create a different shared system graph. The method now initializes an AsyncClient directly from the provided System by populating shared system data and incrementing refcounts on that exact instance.

The async initialization flow (identity fetch, tenant/database resolution, admin client creation, validation, and startup event emission) is preserved, and explicit exception cleanup was added to release both client/admin system references when initialization fails. A regression test in chromadb/test/test_async_client_from_system.py verifies that the returned client keeps the same System object via assert client._system is system.

This summary was automatically generated by @propel-code-bot

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues were identified; the fix and regression coverage appear sound.

Status: No Issues Found | Risk: Low

Review Details

📁 2 files reviewed | 💬 0 comments

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.

[Bug]: from_system_async() builds a fresh client system instead of reusing the provided one

1 participant