hermes - ✅(Solved) Fix bug(dingtalk): startup requirement check ignores credentials from platform config [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#11769Fetched 2026-04-18 05:58:56
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
cross-referenced ×2referenced ×1

Fix Action

Fixed

PR fix notes

PR #11783: fix(dingtalk): allow config credentials in startup checks

Description (problem / solution / changelog)

Summary

  • let DingTalk startup requirement checks accept credentials from platform config as well as env vars
  • pass the platform config into the gateway adapter factory check so config-driven setups are not rejected early
  • add focused regression tests for both the helper and the gateway runner path

Testing

  • python3 -m pytest -o addopts='' tests/gateway/test_dingtalk.py -k 'DingTalkRequirements'

Closes #11769

Changed files

  • gateway/platforms/dingtalk.py (modified, +7/-3)
  • gateway/run.py (modified, +2/-2)
  • tests/gateway/test_dingtalk.py (modified, +45/-1)

Code Example

from gateway.config import PlatformConfig
from gateway.platforms.dingtalk import DingTalkAdapter, check_dingtalk_requirements

cfg = PlatformConfig(enabled=True, token='x', extra={
    'client_id': 'cfg-id',
    'client_secret': 'cfg-secret',
})

adapter = DingTalkAdapter(cfg)
print(bool(adapter._client_id), bool(adapter._client_secret))  # True True
print(check_dingtalk_requirements())  # False
RAW_BUFFERClick to expand / collapse

Bug Description

Gateway startup uses check_dingtalk_requirements() before constructing DingTalkAdapter, but the requirement check only looks at environment variables. The adapter itself supports credentials from PlatformConfig.extra, so a valid config-driven DingTalk setup is rejected before it can connect.

Affected Files / Lines

  • gateway/platforms/dingtalk.py:60-66
  • gateway/platforms/dingtalk.py:82-84
  • gateway/run.py:2185-2190

Why this is a bug

DingTalkAdapter.__init__() intentionally reads client_id / client_secret from config.extra or environment variables, but check_dingtalk_requirements() only checks env vars. That makes the documented config path unusable during gateway startup.

Minimal Reproduction

from gateway.config import PlatformConfig
from gateway.platforms.dingtalk import DingTalkAdapter, check_dingtalk_requirements

cfg = PlatformConfig(enabled=True, token='x', extra={
    'client_id': 'cfg-id',
    'client_secret': 'cfg-secret',
})

adapter = DingTalkAdapter(cfg)
print(bool(adapter._client_id), bool(adapter._client_secret))  # True True
print(check_dingtalk_requirements())  # False

Expected Behavior

If credentials are present in platforms.dingtalk.extra, gateway startup should allow the DingTalk adapter to initialize.

Actual Behavior

Gateway startup rejects DingTalk unless DINGTALK_CLIENT_ID and DINGTALK_CLIENT_SECRET are set in the environment, even when equivalent credentials are already present in config.

Suggested Investigation Direction

  • Make the startup requirement check accept the same credential sources as DingTalkAdapter.
  • Alternatively, move the validation into adapter construction/connection so config-driven credentials are handled consistently.

extent analysis

TL;DR

Update the check_dingtalk_requirements() function to also check for credentials in PlatformConfig.extra to align with DingTalkAdapter's credential sources.

Guidance

  • Review the check_dingtalk_requirements() function in gateway/platforms/dingtalk.py to understand its current implementation and how it only checks environment variables.
  • Modify check_dingtalk_requirements() to also check for client_id and client_secret in PlatformConfig.extra, similar to how DingTalkAdapter initializes.
  • Consider moving the validation into the adapter construction or connection phase to handle config-driven credentials consistently, as suggested in the issue.
  • Verify the fix by running the minimal reproduction code provided and checking that check_dingtalk_requirements() returns True when credentials are present in PlatformConfig.extra.

Example

def check_dingtalk_requirements(config):
    # Check environment variables
    env_vars_set = 'DINGTALK_CLIENT_ID' in os.environ and 'DINGTALK_CLIENT_SECRET' in os.environ
    
    # Check config.extra for credentials
    config_vars_set = 'client_id' in config.extra and 'client_secret' in config.extra
    
    return env_vars_set or config_vars_set

Notes

This solution assumes that the check_dingtalk_requirements() function is the primary blocker for using config-driven credentials. If there are other parts of the code that also need updating, additional changes may be necessary.

Recommendation

Apply the workaround by updating the check_dingtalk_requirements() function to check both environment variables and PlatformConfig.extra for credentials, as this directly addresses the inconsistency between the requirement check and the adapter's initialization.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix bug(dingtalk): startup requirement check ignores credentials from platform config [1 pull requests, 1 participants]