fix(kanban): stop dispatcher terminal config leaking into assignee workers - #66575
fix(kanban): stop dispatcher terminal config leaking into assignee workers#66575stantheman0128 wants to merge 1 commit into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment
Critical
- None
Assessment
Kanban worker isolation fix: strips dispatcher/gateway profile-derived TERMINAL_* env vars before spawning assignee workers on a different profile. Prevents the dispatcher's docker image/volumes/network/container limits from leaking across profile boundaries.
Looks Good
- Correctly strips
TERMINAL_CONFIG_ENV_MAP.values()from child env - Task-specific
TERMINAL_CWD/TERMINAL_TIMEOUTstill re-applied as intended - New regression test
test_default_spawn_strips_dispatcher_terminal_profile_envcovers the isolation boundary
Reviewed by Hermes Agent
|
Thanks for the focused isolation fix. Current The change removes the canonical configuration-derived set from No post-base changes touch either modified file ( Automated hermes-sweeper review. |
…rkers _default_spawn copied the dispatcher's full environment (env = dict(os.environ)) including its already-exported profile-derived TERMINAL_* values (docker image/volumes/network, container limits, ssh target, backend, sandbox, ...), switched HERMES_HOME to the assignee profile, but never rebuilt those TERMINAL_*. A Kanban task on a non-default profile therefore ran with the dispatcher's terminal isolation config instead of its own: it could receive host paths and container options meant only for the dispatcher, or miss its own approved Docker volumes. Strip the profile-derived TERMINAL_* (the config.TERMINAL_CONFIG_ENV_MAP keys) after copying the env so the child hermes -p <assignee> rebuilds them from the assignee profile via apply_terminal_config_to_env. Task-specific TERMINAL_CWD and TERMINAL_TIMEOUT are re-applied afterward and are unaffected. Fixes NousResearch#66541.
4a5411a to
c9130df
Compare
|
Closing as author to bring our open PRs on hermes-agent back within a healthy throttle (we had 10 open with only sweeper keep_open and no concrete maintainer change requests for days). Keeping three Windows-focused PRs open for now:
Happy to reopen this one if a maintainer wants it prioritized. Thanks for the patience. |
What does this PR do?
A Kanban task assigned to a non-default profile could start a worker whose terminal tool used the dispatcher/gateway profile's
terminal:configuration instead of the assignee profile's. This PR keeps the profile boundary intact so a worker uses its own profile's terminal isolation settings.Verified against
origin/maind9ee3424:hermes_cli/kanban_db.py::_default_spawnbuilds the worker env withenv = dict(os.environ), which copies the dispatcher's already-exported profile-derivedTERMINAL_*values (docker image/volumes/network, container limits, ssh target, backend, sandbox, ...). It switchesHERMES_HOMEto the assignee profile but never rebuilds thoseTERMINAL_*. When the childhermes -p <assignee>starts,config.apply_terminal_config_to_envonly overrides a var when the assigneeconfig.yamlsets thatterminal.*key, so any key the assignee does not set keeps the dispatcher's inherited value. The boundary leaks both ways: an assignee can receive host paths / container options meant only for the dispatcher, and can miss its own approved Docker volumes.The fix strips the profile-derived
TERMINAL_*(theconfig.TERMINAL_CONFIG_ENV_MAPvalues) right after the env copy, so the child rebuilds terminal config from the assignee profile viaapply_terminal_config_to_env. This mirrors the existing precedent of dropping leaked env vars from spawned workers (for example #63189). The task-specificTERMINAL_CWD/TERMINAL_TIMEOUTthat_default_spawnsets are applied afterward and are unaffected (_worker_terminal_timeout_envalready handles an absent baseline).Related Issue
Fixes #66541
Type of Change
Changes Made
hermes_cli/kanban_db.py: in_default_spawn, after copying the environment and switchingHERMES_HOME, pop theTERMINAL_CONFIG_ENV_MAPenv vars so the assignee profile's terminal config is rebuilt in the child instead of inherited from the dispatcher.tests/hermes_cli/test_kanban_boards.py: addtest_default_spawn_strips_dispatcher_terminal_profile_env.How to Test
TERMINAL_DOCKER_IMAGE,TERMINAL_DOCKER_VOLUMES,TERMINAL_DOCKER_NETWORK,TERMINAL_CONTAINER_MEMORY,TERMINAL_ENV.TERMINAL_CWDis still pinned.Real output (Windows 11, pytest 8.4.2):
The two failures are
test_remove_clears_init_cache_for_recreated_db[True/False], a pre-existing Windows-onlyos.renamePermissionError during board removal that also fails on origin/main with this change stashed (A/B confirmed), unrelated to this diff.Checklist
Code
fix(kanban): ...)pytest tests/tree is not run here because it has pre-existing Windows-only failures unrelated to this change (documented above)Documentation & Housekeeping
dict.pop, platform-neutral; footgun scan clean