Loading
fix(agent): each request captures only its own output
Closes #19 (closed).
Cause of the JSONDecodeError and the []: the agent runs requests on a thread pool, and exec captured output with contextlib.redirect_stdout, which swaps sys.stdout for the whole process. Two requests at once — a client's command and the master console's poll — wrote into each other's capture: jobs cancel returned a poll's []; a followed install got an empty jobs log --json.
agent.py:_ThreadStreamstands in forsys.stdout/sys.stderronce; a capturing thread writes to its own buffer, others to the original stream (or nowhere, under pythonw).cli.py: a job command with--help/-his not followed; only a one-word last line is taken as a job id.client.py: an unreadablejobs logreply raisesBenchClientErrorsaying the job is still on the bench, instead of a traceback an operator retries.
Three new tests in test_agent.py; each fails without the fix.