Feature/reload ws polish 0902 - #528
Closed
Bosheng0422 wants to merge 4 commits into
Closed
Conversation
Proactive care defaults to on, but the scheduler only listed persisted enabled rows, so most experts never entered the push loop. Co-authored-by: Cursor <cursoragent@cursor.com>
prepare_chat_mcp rebuilt the agent whenever a builtin MCP server was missing from the live runtime. For gateway-mode connectors that rebuild is pure loss: they carry no HTTP transport, their tools are built in-process from stored credentials, and _post_start_agent runs the very same injection at the end anyway. Meanwhile the rebuild drops the harness instance and with it the checkpointer pool an in-flight turn is still writing to. Split the missing names on connector mode: gateway ones refresh their credentials and inject into the running agent, the rest keep the existing reload path. Co-authored-by: Cursor <cursoragent@cursor.com>
…t of tests ProactiveCareScheduler.shutdown() cancelled each task and returned without awaiting it, so a loop parked in a multi-hour sleep could outlive the shutdown that was supposed to end it. It now gathers the cancelled tasks before returning. Proactive care defaults to on, so creating an agent starts one of those sleeps. pytest-asyncio waits for leftover tasks before fixture teardown, which hangs the suite. octop_client shuts the scheduler down and calls the new suspend() so nothing reschedules; an autouse fixture covers tests that boot OctopServer another way. The scheduler's own unit tests opt out. suspend() exists for the tests. The alternative — every test remembering to tear the scheduler down — is the arrangement that produced the hang. Co-authored-by: Cursor <cursoragent@cursor.com>
…workaround starlette's sync TestClient runs the app on its own anyio portal loop. That left the process with two loops over one OctopServer, so primitives bound to a loop and shared by both — AgentManager._lock — deadlocked or raised "bound to a different event loop". The tests worked around it by running the ws session in a worker thread. tests.support.http now speaks ASGI directly, so the handler, the gateway workers and the test all share one loop, the way uvicorn runs it in production. That removes the reason the production handlers marshalled every outbound frame across loops with run_coroutine_threadsafe + wrap_future. The comment on that code named the cause outright — "this handler may run on a different loop (e.g. starlette's TestClient portal)" — so it was test-shaped machinery sitting on the path of every frame the dashboard receives. Both handlers now await the send directly. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Target branch
develop(feature / fix — default)main(release/*orhotfix/*only)Type of change
Test plan
make allpasses locallyChecklist
CHANGELOG.md(if user-facing)