Skip to content

Commit aa636c6

Browse files
MaxFreedomPollardteknium1
authored andcommitted
fix(config): merge duplicate kanban block so auto_subscribe_on_create default survives
DEFAULT_CONFIG declared "kanban" twice. Python keeps only the last literal for a duplicate key, so the first kanban block was silently dropped and its "auto_subscribe_on_create": True default never made it into DEFAULT_CONFIG. The consumer in tools/kanban_tools.py masks the miss with cfg_get(..., default=True), but the documented default was absent from DEFAULT_CONFIG (so config templates / 'hermes config show' omit it), and the duplicate key is a standing hazard: any future key added to the first block would also vanish. Merge auto_subscribe_on_create into the single canonical kanban block. Adds a regression test asserting both default sets survive and a guard against any duplicate top-level DEFAULT_CONFIG key.
1 parent 2365fed commit aa636c6

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MaxFreedomPollard

‎hermes_cli/config.py‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,21 +1562,6 @@ def _ensure_hermes_home_managed(home: Path):
15621562
# Example: 1800 = compact after 30 min idle.
15631563
},
15641564

1565-
# Kanban subsystem (orchestrator workers + dispatcher-driven child tasks).
1566-
# See tools/kanban_tools.py and hermes_cli/kanban_db.py for the actual
1567-
# implementations. Per-platform notification opt-out is handled by the
1568-
# kanban dashboard (see ``hermes dashboard`` -> Notifications).
1569-
"kanban": {
1570-
# Auto-subscribe the originating gateway/TUI session to task
1571-
# completion + block events when ``kanban_create`` is called from
1572-
# inside a session that has a persistent delivery channel. The
1573-
# agent that dispatched the task will get notified automatically
1574-
# instead of having to poll. Disable to mirror pre-feature
1575-
# behaviour — e.g. for a profile that prefers explicit
1576-
# ``kanban_notify-subscribe`` calls per task.
1577-
"auto_subscribe_on_create": True,
1578-
},
1579-
15801565
# Anthropic prompt caching (Claude via OpenRouter or native Anthropic API).
15811566
# cache_ttl must be "5m" or "1h" (Anthropic-supported tiers); other values are ignored.
15821567
"prompt_caching": {
@@ -2920,6 +2905,14 @@ def _ensure_hermes_home_managed(home: Path):
29202905
# each claimable ready task. One dispatcher per profile is sufficient;
29212906
# running more than one on the same kanban.db will race for claims.
29222907
"kanban": {
2908+
# Auto-subscribe the originating gateway/TUI session to task
2909+
# completion + block events when ``kanban_create`` is called from
2910+
# inside a session that has a persistent delivery channel. The
2911+
# agent that dispatched the task will get notified automatically
2912+
# instead of having to poll. Disable to mirror pre-feature
2913+
# behaviour — e.g. for a profile that prefers explicit
2914+
# ``kanban_notify-subscribe`` calls per task.
2915+
"auto_subscribe_on_create": True,
29232916
# Run the dispatcher inside the gateway process. On by default —
29242917
# the cost is ~300µs every `dispatch_interval_seconds` when idle,
29252918
# and gateway is the supervisor users already have. Set to false

‎tests/hermes_cli/test_config.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,3 +2385,35 @@ def test_enabled_provider_does_not_raise(self, tmp_path, monkeypatch):
23852385
assert "disabled" not in str(e).lower()
23862386
except Exception:
23872387
pass # any non-ValueError is fine; we only gate the disabled path
2388+
2389+
2390+
# ---------------------------------------------------------------------------
2391+
# DEFAULT_CONFIG must not carry a duplicate "kanban" key
2392+
# ---------------------------------------------------------------------------
2393+
2394+
def test_default_config_kanban_block_not_dropped_by_duplicate_key():
2395+
"""DEFAULT_CONFIG previously declared ``"kanban"`` twice, so Python kept
2396+
only the second literal and silently dropped the first — losing the
2397+
``auto_subscribe_on_create`` default. Both sets of defaults must survive.
2398+
"""
2399+
kanban = DEFAULT_CONFIG["kanban"]
2400+
# From the first (dropped) block:
2401+
assert kanban.get("auto_subscribe_on_create") is True
2402+
# From the second block:
2403+
assert "dispatch_in_gateway" in kanban
2404+
assert "auto_decompose" in kanban
2405+
2406+
2407+
def test_default_config_has_no_duplicate_top_level_keys():
2408+
"""Guard against any duplicate key silently shadowing a default."""
2409+
import ast
2410+
import hermes_cli.config as cfg_mod
2411+
2412+
src = open(cfg_mod.__file__, encoding="utf-8").read()
2413+
tree = ast.parse(src)
2414+
for node in ast.walk(tree):
2415+
if isinstance(node, ast.Dict):
2416+
keys = [k.value for k in node.keys if isinstance(k, ast.Constant)]
2417+
if "model" in keys and "kanban" in keys: # the DEFAULT_CONFIG literal
2418+
dupes = {k for k in keys if keys.count(k) > 1}
2419+
assert not dupes, f"duplicate DEFAULT_CONFIG keys: {sorted(dupes)}"

0 commit comments

Comments
 (0)