ReMe/tests
Chen Wang a6509ff479
fix(agent_wrapper): release Codex threads after each turn (#621)
* fix(agent_wrapper): release Codex threads after each turn

Loaded Codex threads and their per-thread MCP server subprocesses were
never unloaded from the app-server, growing file descriptors and child
processes monotonically until the wrapper was closed (fd exhaustion,
os error 24). Reply, streaming reply, and compact_session now
unsubscribe the thread in a turn-scoped finally block by default; the
new release_threads=False option restores the previous behavior.
Unsubscribe failures are logged and never break the turn, and threads
remain resumable after being unloaded.

Closes agentscope-ai/ReMe#609

* fix(agent_wrapper): keep tool-context guard on failed release and cover stream startup

A failed thread/unsubscribe left the thread loaded in the app-server
but dropped its tool-context entry, so a later resume with changed
tool_context_id or injected_job_kwargs would silently bypass the
constraint check. Keep the guard entry unless the unsubscribe request
succeeds.

reply_stream now releases the thread from an outer try/finally scoped
right after _open_thread, so threads are also unloaded when turn/start
raises or the caller is cancelled while awaiting it.
2026-10-16 13:59:30 +08:00
..
fixtures/config fix(ci): support AgentScope 2.0.6 initialization (#457) 2026-08-19 11:33:52 +08:00
integration feat(integrations): add automatic memory plugins for Claude Code and Codex (#575) 2026-10-12 20:12:47 +08:00
unit fix(agent_wrapper): release Codex threads after each turn (#621) 2026-10-16 13:59:30 +08:00