feishu: card rollover never fires — long tasks silently stop updating

Author: cuipengcx90Created Sep 21, 2026Updated Oct 1, 2026

Symptom

Long Feishu tasks stop updating their card around step ~50 while the agent keeps running. The user has to send "继续" to get a working card back, and any long task reproduces it (198 occurrences of the card failure in a single session log).

Root cause (two defects)

  1. _rollover_locked() bumps page_no and clears msg_id but not self.steps. _build_locked() iterates the full self.steps, so the "new" card is exactly as large as the overflowing one and fails the same way — rollover is a no-op.

  2. _push_sync() returns (False, False) when the create path fails, while _worker_loop rolls over only on limit=True. Once msg_id is None, every later push takes the create path, returns limit=False, and rollover never runs again — the card becomes permanently unsendable.

Reproduction

Any session where accumulated steps exceed the card size limit (roughly 50 steps at _DETAIL_LIMIT = 4000). The log then repeats:

发送失败: 230099, Failed to create card content, ext=ErrCode: 200800; ErrMsg: create universal card fail;

while 上一张工作卡片达到飞书限制 (the rollover note) never appears — direct proof that rollover never fired.

Suggested fix

  • Clear self.steps in _rollover_locked() and carry turn_base so step numbering stays contiguous.
  • Roll over proactively when steps reaches a threshold, instead of waiting for the API to reject the card.
  • Return limit=True from the create path on failure so the caller can roll over and retry.