Skip to content

fix: unify context_window_size fallback defaults across all channels #238

@yaojin3616

Description

@yaojin3616

Background

PR #232 fixed context_window_size persistence and usage in websocket.py and feishu.py. However, multiple other channel integrations still use inconsistent fallback default values.

Problem

When agent.context_window_size is None or 0, different channels fall back to different values:

File Current Fallback Expected
websocket.py:462 or 100
feishu.py:398 or 100
feishu.py:932 or 100
feishu.py:1235 or 100
discord_gateway.py:173 or 20
wecom_stream.py:292 or 20
wecom.py:473 or 20
slack.py:232 or 20
discord_bot.py:294 or 20
teams.py:482 or 20
dingtalk.py:169 or 20

Suggested Fix

  1. Define a single constant (e.g. DEFAULT_CONTEXT_WINDOW_SIZE = 100) in a shared location like app/models/agent.py or a config module.
  2. Replace all or 20 / or 100 fallbacks with the shared constant.
  3. This ensures consistent behavior across web chat, Feishu, Slack, Discord, WeCom, DingTalk, and Teams channels.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions