Skip to content

fix: MLPA disconnect causes Runtime Error#198

Merged
FieldMarshallObvious merged 3 commits into
mainfrom
fix/MLPAStreamDisconnect-AIPLAT-1124
Jul 9, 2026
Merged

fix: MLPA disconnect causes Runtime Error#198
FieldMarshallObvious merged 3 commits into
mainfrom
fix/MLPAStreamDisconnect-AIPLAT-1124

Conversation

@FieldMarshallObvious

@FieldMarshallObvious FieldMarshallObvious commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What's Changed

  • Removes manual await response.aclose() in cancel branch
  • Suppresses runtime errors in httpx teardown
  • Added tracking to capture dict to allow mocks to track how many times the stream was closed
  • Added tests to verify that stream close call and validate that errors are not thrown

QA Path

Added two test cases, added a test case to ensure that the stream is called once per close and that Runtime error is not thrown.

Close Count

In this test we run the close count validation on the old logic versus the new logic

Old Logic:
image

New Logic:
image

Runtime error

In this test we validate that runtime errors are suppressed in the httpx teardown

Old Logic:
image

New Logic:
image

Related Tickets & Documents

AIPLAT-1124

Comment thread src/mlpa/core/completions.py
@subpath

subpath commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

I suggest to approach it with TDD : )

First make a test to reproduce the same error from the ticket, it should be failing - that would be RED
then you make a fix in completions.py and the test from step 1 should start passing
then refactor if needed

@FieldMarshallObvious

Copy link
Copy Markdown
Contributor Author

I suggest to approach it with TDD : )

First make a test to reproduce the same error from the ticket, it should be failing - that would be RED then you make a fix in completions.py and the test from step 1 should start passing then refactor if needed

Added the tests you suggested and updated the PR message!

@subpath

subpath commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

I suggest to approach it with TDD : )
First make a test to reproduce the same error from the ticket, it should be failing - that would be RED then you make a fix in completions.py and the test from step 1 should start passing then refactor if needed

Added the tests you suggested and updated the PR message!

Thank you ❤️

Comment thread src/mlpa/core/completions.py

@subpath subpath left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

#198 (comment)

after than it's good to go, thank you ❤️

@FieldMarshallObvious FieldMarshallObvious merged commit 720d319 into main Jul 9, 2026
1 check passed
@FieldMarshallObvious FieldMarshallObvious deleted the fix/MLPAStreamDisconnect-AIPLAT-1124 branch July 9, 2026 15:07
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.

4 participants