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() 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.
-
_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.
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:while
上一张工作卡片达到飞书限制(the rollover note) never appears — direct proof that rollover never fired.Suggested fix
self.stepsin_rollover_locked()and carryturn_baseso step numbering stays contiguous.stepsreaches a threshold, instead of waiting for the API to reject the card.limit=Truefrom the create path on failure so the caller can roll over and retry.