Skip to content

Feature/reload ws polish 0902 - #528

Closed
Bosheng0422 wants to merge 4 commits into
mainfrom
feature/reload-ws-polish-0902
Closed

Feature/reload ws polish 0902#528
Bosheng0422 wants to merge 4 commits into
mainfrom
feature/reload-ws-polish-0902

Conversation

@Bosheng0422

Copy link
Copy Markdown
Collaborator

Summary

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

  • make all passes locally
  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed)

Bosheng0422 and others added 4 commits September 2, 2026 10:38
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>
@Bosheng0422 Bosheng0422 closed this Sep 2, 2026
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