Skip to content

fix(as_llm): close owned OpenAI clients safely - #725

Open
fredheathcote007 wants to merge 3 commits into
agentscope-ai:mainfrom
fredheathcote007:upstream/fix-openai-client-lifecycle-20261107
Open

fredheathcote007 wants to merge 3 commits into
agentscope-ai:mainfrom
fredheathcote007:upstream/fix-openai-client-lifecycle-20261107

Conversation

@fredheathcote007

Copy link
Copy Markdown

Summary

  • Close internally owned asynchronous OpenAI chat clients when their ReMe component is closed; retain externally injected clients as borrowed resources.
  • Finish provider cleanup safely under repeated cancellation and handle failed close/startup without losing ownership tracking.
  • Account for lazy client construction before startup, model replacement, shutdown/restart and access after shutdown.
  • Add adversarial lifecycle tests for these boundaries while preserving existing component behaviour.

Validation

  • Python 3.12: 42 passed across OpenAI model-adapter and base-component lifecycle tests.
  • Python compilation, focused Ruff correctness checks and git diff --check passed.

Scope

Only the OpenAI chat adapter and its unit tests are changed. No dependencies or configuration defaults are changed.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

2 participants