mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-27 01:11:40 +00:00
fix(gateway): wrap cron helpers with staticmethod to prevent self-binding
Plain functions imported as class attributes in APIServerAdapter get auto-bound as methods via Python's descriptor protocol. Every self._cron_*() call injected self as the first positional argument, causing TypeError on all 8 cron API endpoints at runtime. Wrap each import with staticmethod() so self._cron_*() calls dispatch correctly without modifying any call sites. Co-authored-by: teknium <teknium@nousresearch.com>
This commit is contained in:
parent
cc2b56b26a
commit
c6793d6fc3
2 changed files with 78 additions and 0 deletions
|
|
@ -974,6 +974,18 @@ class APIServerAdapter(BasePlatformAdapter):
|
|||
resume_job as _cron_resume,
|
||||
trigger_job as _cron_trigger,
|
||||
)
|
||||
# Wrap as staticmethod to prevent descriptor binding — these are plain
|
||||
# module functions, not instance methods. Without this, self._cron_*()
|
||||
# injects ``self`` as the first positional argument and every call
|
||||
# raises TypeError.
|
||||
_cron_list = staticmethod(_cron_list)
|
||||
_cron_get = staticmethod(_cron_get)
|
||||
_cron_create = staticmethod(_cron_create)
|
||||
_cron_update = staticmethod(_cron_update)
|
||||
_cron_remove = staticmethod(_cron_remove)
|
||||
_cron_pause = staticmethod(_cron_pause)
|
||||
_cron_resume = staticmethod(_cron_resume)
|
||||
_cron_trigger = staticmethod(_cron_trigger)
|
||||
_CRON_AVAILABLE = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue