feishu: card rollover never fires — long tasks silently stop updating
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)
_rollover_locked()bumpspage_noand clearsmsg_idbut notself.steps._build_locked()iterates the fullself.steps, so the "new" card is exactly as large as the overflowing one and fails the same way — rollover is a no-op._push_sync()returns(False, False)when the create path fails, while_worker_looprolls over only onlimit=True. Oncemsg_idisNone, every later push takes the create path, returnslimit=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.stepsin_rollover_locked()and carryturn_baseso step numbering stays contiguous. - Roll over proactively when
stepsreaches a threshold, instead of waiting for the API to reject the card. - Return
limit=Truefrom the create path on failure so the caller can roll over and retry.
Source: lsdefine/GenericAgent