AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

v4.28.1: ImageCaptionCachePatcher crashes on quoted images with unexpected keyword argument 'image_ref'

Open Bronsan opened this issue 2 months ago • 2 comments

Description

On AstrBot v4.28.1, processing an agent request that involves a quoted image fails with a TypeError inside ImageCaptionCachePatcher.

After rolling back AstrBot to a previous version, the error no longer occurs.

Environment

  • AstrBot version: v4.28.1
  • Platform adapter: aiocqhttp (OneBot / QQ)
  • Trigger: message that quotes/references an image while the agent pipeline runs
  • Rollback: fixes the issue

Error

Error occurred while processing agent: ImageCaptionCachePatcher._patch_quoted_message.<locals>.cached_process_quote_message() got an unexpected keyword argument 'image_ref'                                                                         Steps to reproduce
Run AstrBot v4.28.1
Connect a platform (e.g. aiocqhttp)
Send a message that quotes/references an image (or otherwise hits the quoted-image cache path)
Observe the agent pipeline crash with the TypeError above
Expected behavior
Quoted-image processing should accept the current call signature (including image_ref if the new API requires it), or the patcher should forward/handle the parameter without raising.

Actual behavior
cached_process_quote_message() does not accept image_ref, so the agent request fails.

Workaround
Roll back AstrBot to a version before the regression
Or avoid quoting images until fixed
Additional context
Related log line from the same session: [v4.28.1] marker appears in the error path
Possible signature mismatch between ImageCaptionCachePatcher._patch_quoted_message and a newer caller that passes image_ref

Bronsan avatar Sep 18 '26 11:09 Bronsan

Conclusion: Not a core bug — the traceback comes from a third-party plugin patching a private core function, with a wrapper signature that has not kept up with the v4.28.1 change.

Root cause: ImageCaptionCachePatcher belongs to the plugin FloranceYeh/astrbot_plugin_image_caption_cache (v1.3.0, last commit 2026-08-05). Its _patch_quoted_message wraps the private core function _process_quote_message with a fixed signature, while that function gained a new keyword argument image_ref in bd046ed29 (#9703, shipped in v4.28.1) — see astrbot/core/astr_main_agent.py:821, called from :1625 and pipeline/process_stage/method/agent_sub_stages/internal.py:298. The plugin wrapper accepts neither image_ref nor **kwargs, hence the TypeError; its _signature_has_prefix guard only inspects the first four parameters, so it did not catch this change.

Suggestion: The plugin should forward **kwargs or sync its signature (it also still carries a config parameter that no longer exists in core). Core could document that private APIs carry no signature stability guarantee. Recommend tracking this in the plugin repository.

Suggested labels: area:plugin


🤖 This comment was generated by AI, with conclusions verified against the repository source. If anything is off, the maintainers' judgement prevails.

silvaling avatar Sep 18 '26 16:09 silvaling

Plugin-side problem, we cannot fix.

Soulter avatar Sep 18 '26 16:09 Soulter