feat(tools): add Podman as a supported terminal backend - #8158
Conversation
|
Hey @ksze, thanks for taking this on — Podman support is something we've wanted and the core architecture here is solid. Inheriting from A few things to address before we can move forward: 1. Unrelated changes need to be removedThe branch has accumulated a lot of changes unrelated to Podman — likely from your fork diverging from main over time. These need to be stripped out so the PR only contains Podman work. The big ones:
The cleanest path: rebase onto current 2. Runtime bugs in the Podman code
# Bug (terminal_tool.py, code_execution_tool.py, file_tools.py):
if isinstance(podman_extra_args, list) and all(podman_extra_args, lambda x: isinstance(x, str)):
# Fix:
if isinstance(podman_extra_args, list) and all(isinstance(x, str) for x in podman_extra_args):
# Bug:
extra_caps.split(" ").filter(lambda x: len(x) > 0)
# Fix:
[x for x in extra_caps.split(" ") if x]Missing comma in # Bug:
_PODMAN_SEARCH_PATHS = [
"/usr/bin/podman" # ← no comma!
"/usr/local/bin/podman",
...
]
# Fix:
_PODMAN_SEARCH_PATHS = [
"/usr/bin/podman",
"/usr/local/bin/podman",
...
]Typo: 3. Code duplicationThe Podman config extraction block is copy-pasted identically into 3 files (terminal_tool.py, code_execution_tool.py, file_tools.py). Consider extracting it into a shared helper — 4. About the test failuresYou mentioned test failures on vanilla main — that's likely an environment issue (missing optional deps, or python -m pytest tests/ -n0 -qOr if xdist isn't installed: python -m pytest tests/ -o "addopts=" -qThe Podman work itself — the |
Add native Podman support as an alternative to Docker for sandboxed command execution, implementing the feature requested in NousResearch#4084. Architecture: - PodmanEnvironment extends DockerEnvironment via hook methods (_resolve_cli_binary, _ensure_cli_available, _get_security_args, _get_extra_run_args, _build_run_cmd) — no code duplication - DockerEnvironment gains 5 overridable hooks for extensibility; existing Docker behavior is unchanged - Podman-specific options: rootful/rootless, --userns mapping, --privileged, extra capabilities, extra CLI args Files changed: - tools/environments/podman.py (new) — PodmanEnvironment class - tools/environments/docker.py — add hook methods for subclassing - tools/terminal_tool.py — wire podman env_type, config keys - tools/code_execution_tool.py — podman image selection + config - tools/file_tools.py — podman image selection + config - gateway/run.py — podman env var mappings from config.yaml - cli.py — podman defaults and env var mapping - hermes_cli/doctor.py — podman availability check - batch_runner.py — podman image pull/check using find_podman() - tests/tools/test_podman_environment.py (new) — 15 unit tests Fixes all bugs from PR NousResearch#8158 review: - all() two-arg misuse → generator expression - .filter() on list → list comprehension (not needed here) - Missing comma in search paths → verified in tests - podman_privilged typo → podman_privileged throughout - No code duplication — single podman config block per file Based on the approach in NousResearch#8158 by @ksze, with architectural feedback from @teknium1's review. Closes NousResearch#4084 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hey @ksze — thanks for pioneering this. I've submitted #8391 as a clean reimplementation that builds on your approach and addresses @teknium1's feedback. The core idea of extending DockerEnvironment is preserved, but with proper inheritance via hook methods instead of bypassing Your work on the setup wizard flow, doctor checks, and config plumbing was particularly helpful as reference. Credited in the PR description and commit message. |
|
Note: PR #8391 appears to be a cleaner reimplementation addressing review feedback on this PR. |
|
Hi @ksze — thanks for the work on this, but closing because Podman support landed via a different (lighter) approach a few days after this PR opened, and the design here is no longer the right fit. Timeline:
What landed instead: a drop-in approach — Status of the features this PR offered:
The 4,023-line standalone Same applies to #8391 — closing both. If you'd like to pick up the |
What does this PR do?
Adds support for Podman as a terminal backend. Very similar to the Docker backend, but with explicit options for rootless vs rootful, user namespace remapping, and Podman with extended privileges.
Related Issue
#4084
Fixes #
Type of Change
Changes Made
tools/environments/utils.pytools/environments/podman.pymodule, with aPodmanEnvironmentclasstools/terminal_tool.pyhermes_cli/config.py_create_environmentfunction to support Podman as a terminal backendHow to Test
Checklist
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 or workflows — or N/AScreenshots / Logs