Skip to content

飞书 /agent:派出任务后等最终回复再收尾、回复里的 @ 只用核实过的成员 - #39

Merged
NginxL merged 11 commits into
mainfrom
feat-feishu-align-1127-agent
Nov 27, 2026
Merged

NginxL merged 11 commits into
mainfrom
feat-feishu-align-1127-agent

Conversation

@NginxL

@NginxL NginxL commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

对齐 /agent 的两处行为(第 5、9 项,openlark 的做法,只按任务里的描述自己写,没有看或用 openlark 的代码和提示词),只改飞书;微信不变(两个开关 agent_task_wait、verify_at 只在飞书的 Platform 里打开)。叠在 #38 之上。

做了什么

  1. 派出任务后的异步生命周期(第 9 项)
    • progress=true 本来就是中途进度(原地更新的一条消息),不算答案;这次补上:一轮结束时如果还没有最终回复(只有进度或什么都没有),而会话还有它派出、没完成的待办(/api/v1/todos 里 origin 是这个会话),或者读不到待办,就不自动收尾:请求照常记为结束(转发、续问、/stop、回复路由都和原来一样),但 🤔 留着、不换 ✅,这一轮最后说的话只作为进度消息发出,不当成答案。
    • 最终回复(不带 progress)经回复工具发出时换成 ✅,进度消息标成已完成;没有回复的话,后台每隔一分钟看一次,它派出的待办都结束了、或过了 24 小时,就把 🤔 换成 ✅,不再另发消息。
    • 会话状态读不出来时本来就不自动收尾(_settled 只认 done/idle),这里保持。
    • 提示词里写明:派活后可以先发进度,有结果再发最终回复。
  2. /agent 回复的 @(第 5 项)
    • 提示词写明回复默认就是答给提问的人,不要在开头称呼或 @ 谁;正文里打的「@名字」只是普通文字,不要用它假装 @。
    • matefeishu_agent_reply 新增 at: [{id, name}]:每个都要在这个群的成员列表里(matefeishu_members),名字是在这个群里显示的名字或本名,正文里要原样写「@名字」;进度消息、自动代答、文档代答不能带,不能 @ 自己;同样的正文带不同的 @ 算另一条回复。微信的回复工具没有这个参数,传了也照旧忽略。

怎么验证的

没做什么

  • /stop 和最终回复同时到达时的竞态是改动前就有的,不在这次范围。

🤖 Generated with Claude Code

已知限制(审查中提出、决定不改)

  • 几处重启窗口:表情已记为换过、实际换表情前进程退出,🤔 可能留着;记为结束后、发出最后那条进度前退出,那条进度不补发。
  • 同一账号在取到客户端后、读会话号前重新登录,旧客户端读到的成员名单可能沿用 5 分钟(同一个账号的名单)。
  • 最终回复和最后一条进度几乎同时到达时,已标“已完成”的进度消息可能又被改成“进行中”。
  • 对同会话的追问发 /stop 后,原请求的晚到回复会被拒绝,后台仍可能把它标 ✅。

NginxL and others added 11 commits November 27, 2026 11:04
…roups for AI triage, direct chats no model reads

- A group muted in Feishu (消息免打扰: Chat.isRemind / userSetting.isRemind, both read, a disagreement or a
  missing field not known) keeps what does not @ the user out of the Inbox; still archived, an @ sorted as usual,
  a state not known as before. Asked in the background, an hour at a time, ten groups a round.
- A group's topics are Inbox items of their own ("<chat>:<root>"): their context, done state, page and reply
  that topic's; what is said outside any topic stays the chat's item, its id as before.
- inbox_triage_chats (empty by default): those groups' messages without an @ go to the triage model, muted or not.
- inbox_private_dms (empty by default): those direct chats stay in the Inbox with the rule's tier, no model.
- WeChat: none of it (no topics, no mute state, the settings not in its manifest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tter, private chats carry no words, topics per group mode

- A muted group's thing without an @ is handed over done (read), so an item kept from before ends too; in a muted
  group the @ stays the thing's last, not the chatter after it; a failed read is "unknown" (the old way) till the
  next hour; a state is the account's own (owner), the retry clock forgotten at an account switch.
- inbox_private_dms: the other person found from the chat's lines too; the item carries no words of it.
- Topics: a group in topic mode has a thing per topic (roots without replies too); in an ordinary group a topic's
  thing is its replies, its root the chat's own (the user's reply in that topic ends both); 300 lines per group, a
  topic older than the Inbox's days left out, rows by (position, when, seq).
- A topic's page pages back and replies through the send tool, which reads "<chat>:<root>" as that topic.
- A live reading's placement corrects the thread a history read kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead across an account switch, topic pages by place

- inbox_private_dms: a chat listed by its id is hidden whatever kind the store took it for.
- inbox.collect hands over nothing read partly for another account (a sign-in meanwhile).
- A muted group's @: its sender is the item's sender tag too.
- A topic group's one item from before topics were items of their own is handed over done (inbox_topics_at), once.
- A topic page pages by place (position, when, seq): a newer line moves no page; no cap below the whole topic.
- The send tool refuses a reply_to of another topic than the topic chat it was given.
- A mutes table made without owner (an unreleased build) gains the column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… yet sent as asked, the old item ended even when replied

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts placement is the live row's alone, as before)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and pictures for /agent, matefeishu_members

- A formatted TEXT or POST (bold, italics, lists, quotes, headings, code, links) shows on the thread page as safe
  Markdown (richmd: every word escaped, http(s) links only, code fenced past its backticks); kept in a table of its
  own. Commands, @s, the archive, quotes and the models' lines read the plain text as before.
- A POST's inline pictures are the message's media (seen, fetched, archived like a picture's), in the order shown.
- /agent: the prefix right after a POST's title line is a request; up to four of its pictures (3 MiB each) go
  with the request to the conversation (images on the start, and on a follow-up's message).
- matefeishu_members (read-only): a chat's people and bots (chats.PullChatChattersRequest) with their ids and the
  names shown there, kept 5 minutes per sign-in; the send tool's at finds a bot's name there.
- WeChat: none of it (no such tool, no POST, no Markdown).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…members of the account asked, Markdown with no formula

- /agent: a request's pictures fetched once and kept in the data directory till its start is over, so a resume sends
  the same body under its operation; a follow-up handed to the task's Agent carries them too.
- The prefix after a POST's title is looked for in the reading with its code blocks (text_after_mentions), the title
  as written; a POST with only code reads as its code's words (it is never dropped from the page).
- A later reading of a POST renews its pictures.
- chat_members: a list read for an account signed out meanwhile is never handed over; group nicknames by number,
  displayName never read as an object; 20 pages, a longer list says it is partial. matefeishu_members in agent_tools.
- richmd: "(", ")" and "]" not escaped ("\(" and "\[" open formulas in renderers with math), "$" escaped; a list item's
  paragraph and code (indented whole), inline code and its words read once; two bold runs that meet read as one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…@s in the reply only of verified members

- agent_task_wait (Feishu): a turn that ends with no answer yet (only progress, or nothing) while the conversation's
  to-do is still open, or the to-dos cannot be read, is not the request's end: it is done as before (so a follow-up,
  a stop and the routing see it as ever), but its 🤔 stays and its last words go as its progress message, never as
  the answer. The answer through the reply tool swaps it for ✅ (and closes the progress); otherwise once no such
  to-do is left, or agent_task_wait_most went by (_tasks_sweep, every agent_task_recheck), nothing said.
- verify_at (Feishu): matefeishu_agent_reply takes at [{id, name}], each checked against the chat's members
  (matefeishu_members) and written in the text as "@name"; not on progress, not for 自动代答 or 文档代答, never the
  user; the same words with an @ are another reply. The instructions say the reply answers the one who asked and a
  typed "@name" is no @.
- WeChat: neither (its platform sets neither: its prompt, its tool and an `at` it is given as before).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…res kept when none came, members per session

- /agent waiting for its answer: a reply still on its way at the turn's end waits too; the last words edit the
  progress there is; the 🤔 swapped before the mark comes off; a /stop ends the wait; a waiting run is never pruned;
  the sweep reads the to-dos once a round.
- at: two members of one name refused; their order is no other reply.
- Pictures of a request: none fetched is kept too, and a shutdown midway keeps them for the resume; a follow-up's
  are fetched before its checks, dropped after a resumed hand-on.
- The prefix after a POST's title read from its text too when the reading with code has no words; never from a
  blocked line.
- chat_members: a list kept for the session that read it only; a link's words keep their brackets (character
  references).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th some), one read of the to-dos a sweep, a title with an @ in front

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, topics and private chats in the Inbox; rich text as Markdown; matefeishu_members; /agent waits for its answer and @s verified members

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant