fix(docker): add wait parameter to cleanup and call from /stop command - #20569
fix(docker): add wait parameter to cleanup and call from /stop command#20569liuhao1024 wants to merge 3 commits into
Conversation
…INSTALL_TIMEOUT Increase the default npm install timeout for WhatsApp bridge from 60s to 300s (5 minutes) to accommodate slower systems like Unraid NAS. Make it configurable via WHATSAPP_NPM_INSTALL_TIMEOUT environment variable for users who need even longer timeouts. Closes NousResearch#14980
- Add 'path', 'old_string', 'new_string', and 'patch' to required list - Update description to clarify mode-specific parameter requirements - This addresses issue where LLMs would omit these parameters because they were not marked as required in the schema, even though they are required depending on the mode Fixes NousResearch#15524
- Add `wait` parameter to DockerEnvironment.cleanup() for synchronous cleanup - Update /stop command to call cleanup(wait=True) on all environments - Fixes orphaned Docker containers that accumulate across sessions - Prevents zombie containers by ensuring cleanup completes on /stop Tests: tests/tools/test_docker_cleanup_stop.py
974462e to
3872687
Compare
|
Thanks for this, @liuhao1024 — closing it, but the real half is carried forward into a focused issue, not dropped. Reviewing against current Cleanup-synchronization half — now superseded. The
Two more reasons to close rather than rebase: this PR also bundled unrelated changes to Closing in favor of #39489 — thanks for getting the |
What does this PR do?
/stopcommand.Root Cause
The
/stopcommand (cli.py) only callsprocess_registry.kill_all()to kill background processes, but it does not call environment cleanup methods. Additionally,DockerEnvironment.cleanup()uses fire-and-forget async cleanup (subprocess.Popenwith&), which:Related Issue
Fixes #20561
Type of Change
Changes Made
1.
tools/environments/docker.pywait: bool = Falseparameter tocleanup()methodwait=True: usessubprocess.run()to synchronously stop and remove containerswait=False(default): preserves original async behavior2.
cli.py_cleanup_environments()helper method_handle_stop_command()to call cleanup on all environment objects after killing processeswait=Trueto ensure containers are actually removed before/stopreturns3.
tests/tools/test_docker_cleanup_stop.pywaitparametercleanup(wait=True)usessubprocess.run()(sync)cleanup(wait=False)usessubprocess.Popen()(async)How to Test
pytest tests/ -q— all tests should passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture and workflows — or N/A