Baseline
Reproduced from v1.3.1 at 5a306f8956cb1eeae69f9709de0e4d61b44e11e7.
Reproduction
- Start the local background server through a normal
agents-cli run. This starts it with the historical default USE_IN_MEMORY_SESSION=true.
- In the same project, run local eval generation.
_run_against_local_server() calls ensure_server(..., use_in_memory_session=False).
- The PID metadata has no session-mode field, and
ensure_server() reuses any live, non-idle server without comparing the requested mode.
The same behavior is reproducible without launching a process by providing live PID metadata to ensure_server() and requesting the opposite use_in_memory_session value.
Actual behavior
The eval path reuses a server configured for in-memory sessions even though it explicitly requested persistent sessions. The reverse mismatch is also accepted.
Expected behavior
Reuse only when the existing server's session mode matches the requested mode. For legacy metadata with no field, preserve the historical default of true: normal run may reuse it, while eval's false request must fail closed and tell the user to stop the old server first. A mismatch must not terminate the existing process.
Minimal fix
Record use_in_memory_session in the PID metadata and compare it before reuse. Treat a missing field as true; reject a mismatch with a concise Click error before idle cleanup or any mutation.
Reference implementation: benagentai93-dot@970ed96
Test evidence
Runnable regressions cover matching true/false reuse, both mismatches, legacy normal-run reuse, legacy eval fail-closed, no cleanup on mismatch, and metadata persistence.
Fork verification:
- focused lifecycle suite: 22 passed
- full root suite: 41 passed
ruff check src tests: passed
ty check src: passed
uv build: passed
- installed-wheel
agents-cli --version: 1.3.1 on Python 3.11 and 3.13
Baseline
Reproduced from v1.3.1 at
5a306f8956cb1eeae69f9709de0e4d61b44e11e7.Reproduction
agents-cli run. This starts it with the historical defaultUSE_IN_MEMORY_SESSION=true._run_against_local_server()callsensure_server(..., use_in_memory_session=False).ensure_server()reuses any live, non-idle server without comparing the requested mode.The same behavior is reproducible without launching a process by providing live PID metadata to
ensure_server()and requesting the oppositeuse_in_memory_sessionvalue.Actual behavior
The eval path reuses a server configured for in-memory sessions even though it explicitly requested persistent sessions. The reverse mismatch is also accepted.
Expected behavior
Reuse only when the existing server's session mode matches the requested mode. For legacy metadata with no field, preserve the historical default of
true: normal run may reuse it, while eval'sfalserequest must fail closed and tell the user to stop the old server first. A mismatch must not terminate the existing process.Minimal fix
Record
use_in_memory_sessionin the PID metadata and compare it before reuse. Treat a missing field astrue; reject a mismatch with a concise Click error before idle cleanup or any mutation.Reference implementation: benagentai93-dot@970ed96
Test evidence
Runnable regressions cover matching
true/falsereuse, both mismatches, legacy normal-run reuse, legacy eval fail-closed, no cleanup on mismatch, and metadata persistence.Fork verification:
ruff check src tests: passedty check src: passeduv build: passedagents-cli --version: 1.3.1 on Python 3.11 and 3.13