Bug Description
After upgrading Hermes Agent from a previous version to v0.18.0, the gateway enters an infinite crash-restart loop when the Weixin platform has dm_policy or group_policy set to open but neither WEIXIN_ALLOW_ALL_USERS nor GATEWAY_ALLOW_ALL_USERS is enabled. Each cycle: gateway starts → fails the safety check → exits → systemd restarts → repeat. The restart counter reached 1705 before the issue was manually diagnosed.
Steps to Reproduce
- Configure weixin platform with
WEIXIN_DM_POLICY=open in .env (no WEIXIN_ALLOW_ALL_USERS)
- Start gateway via
hermes gateway start or systemd service
- Gateway exits immediately and systemd restarts it in a loop
Expected Behavior
One of:
- Gateway should start successfully (config was valid in the previous version), or
- Gateway should exit with an actionable error message telling the user how to fix it, and not restart in a loop
Actual Behavior
Gateway enters an infinite crash-restart loop. systemd counter exceeded 1700. The error message states the problem but does not suggest the fix:
ERROR gateway.run: Refusing to start: weixin has dm_policy/group_policy set to "open" but neither GATEWAY_ALLOW_ALL_USERS nor WEIXIN_ALLOW_ALL_USERS is enabled.
ERROR gateway.run: Gateway exiting cleanly: weixin: open policy without allow-all opt-in
Systemd journal:
hermes-gateway.service: Scheduled restart job, restart counter is at 1702.
hermes-gateway.service: Scheduled restart job, restart counter is at 1703.
Affected Component
Gateway (WeChat/Weixin platform adapter)
Environment
- OS: Linux (Ubuntu)
- Python: 3.11.15
- Hermes Version: v0.18.0 (2026.7.1, commit 63354ed)
Root Cause Analysis
The gateway startup validation in gateway/run.py enforces that open DM/group policies must be paired with an explicit ALLOW_ALL_USERS opt-in. This is a sensible safety check, but:
- No backward compatibility — configs valid in the previous version break silently after upgrade
- The error message does not tell the user how to resolve it (e.g. "set
WEIXIN_ALLOW_ALL_USERS=true or change dm_policy to pairing")
- Immediate exit on this check triggers a systemd restart loop (exponential backoff notwithstanding, still 1700+ cycles overnight)
Suggested Fix
- Add an upgrade migration or startup warning that detects the incompatible config before the hard exit
- Improve the error message to include resolution steps
- Consider whether exiting on a config validation error is the right behavior (vs. skipping the platform with a warning log)
Bug Description
After upgrading Hermes Agent from a previous version to v0.18.0, the gateway enters an infinite crash-restart loop when the Weixin platform has
dm_policyorgroup_policyset toopenbut neitherWEIXIN_ALLOW_ALL_USERSnorGATEWAY_ALLOW_ALL_USERSis enabled. Each cycle: gateway starts → fails the safety check → exits → systemd restarts → repeat. The restart counter reached 1705 before the issue was manually diagnosed.Steps to Reproduce
WEIXIN_DM_POLICY=openin.env(noWEIXIN_ALLOW_ALL_USERS)hermes gateway startor systemd serviceExpected Behavior
One of:
Actual Behavior
Gateway enters an infinite crash-restart loop. systemd counter exceeded 1700. The error message states the problem but does not suggest the fix:
Systemd journal:
Affected Component
Gateway (WeChat/Weixin platform adapter)
Environment
Root Cause Analysis
The gateway startup validation in
gateway/run.pyenforces thatopenDM/group policies must be paired with an explicitALLOW_ALL_USERSopt-in. This is a sensible safety check, but:WEIXIN_ALLOW_ALL_USERS=trueor changedm_policytopairing")Suggested Fix