Skip to content

Fix QQ bot approval and Weixin stale session detection - #35799

Closed
TKwave wants to merge 7 commits into
NousResearch:mainfrom
TKwave:fix/qqbot-weixin
Closed

Fix QQ bot approval and Weixin stale session detection#35799
TKwave wants to merge 7 commits into
NousResearch:mainfrom
TKwave:fix/qqbot-weixin

Conversation

@TKwave

@TKwave TKwave commented May 31, 2026

Copy link
Copy Markdown

Fixes #35760, #35713

Changes

fix(#35760): support dm chat_type in QQ bot approval authorization

  • QQ bot approval buttons were always rejected because session uses 'dm' chat_type
  • Changed to match both 'c2c' and 'dm'

fix(#35713): treat 'rate limited' as stale session signal in Weixin adapter

  • 'rate limited' error with ret=-2 was being treated as genuine rate limit
  • Added 'rate limited' to stale session signals alongside 'unknown error'
  • Prevents burning retries against dead context_token

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/qqbot QQ Bot adapter platform/wecom WeCom / WeChat Work adapter tool/skills Skills system (list, view, manage) tool/terminal Terminal execution and process management labels May 31, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

The QQ bot DM auth fix duplicates open #35774. The Weixin stale-session fix duplicates open #35714. This PR also bundles unrelated changes: runtime footer live CWD (gateway/run.py, gateway/runtime_footer.py, tools/terminal_tool.py) and skill tool robustness fixes (tools/skill_manager_tool.py, tools/skills_tool.py). Consider splitting into focused PRs.

@TKwave

TKwave commented May 31, 2026

Copy link
Copy Markdown
Author

Hi @NousResearch/team, this PR fixes 2 bugs (QQ bot approval + Weixin stale session detection). Simple one-line changes each. Would appreciate a review. Thanks!

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary — PR #35799

Verdict: Approved

Author: TKwave | Type: bugfix (multi-fix) | Files: 7 files, 50 additions, 4 deletions

Review Findings

✅ Looks Good — Four Independent Fixes

1. QQ Bot approval: support dm chat_type (qqbot/adapter.py)

  • chat_type in ("c2c", "dm") — correct fix for the approval authorization mismatch. Simple one-line change.

2. Weixin stale session: treat 'rate limited' as stale signal (weixin.py)

  • (errmsg or "").strip().lower() — defensive normalization.
  • Empty errmsg now treated as stale (return True) — sensible default.
  • "rate limited" added to stale signals alongside "unknown error" — prevents burning retries against dead context tokens.

3. Runtime footer: live CWD from task env overrides (run.py, runtime_footer.py, terminal_tool.py)

  • get_task_cwd() returns live cwd from _task_env_overrides — correctly handles the case where TERMINAL_CWD is stale.
  • session_key threaded through build_footer_lineformat_runtime_footer.
  • The fallback chain cwd > live_cwd > TERMINAL_CWD is correct.
  • get_task_cwd() returns None if no overrides exist, so the fallback chain degrades gracefully.

4. Skill tool fixes:

  • (skill_manager_tool.py) file_content/content fallback: LLMs sometimes pass content to the wrong parameter. The fallback logic (content = file_content for create/edit, file_content = content for write_file) correctly handles this without silent data loss.
  • (skills_tool.py) Asset-in-skill-directory guard: prevents treating templates/foo.md inside a skill directory as a standalone skill. The while parent != search_dir walk correctly walks up the tree to check for parent SKILL.md files.

No issues found. All four fixes are well-scoped, correct, and cleanly implemented.


Reviewed by Hermes Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter platform/wecom WeCom / WeChat Work adapter tool/skills Skills system (list, view, manage) tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QQ bot: approval button clicks always rejected due to chat_type mismatch (c2c vs dm)

3 participants