Repository navigation
/agent:等审批卡时结束的那一轮不再当成回复发出 - #67
Merged
Merged
Conversation
When a command in an /agent conversation is held for the owner's approval and
nobody answers in time, Persona gives the tool call a non-final result that
ends the turn, keeps the card waiting for 24 hours and tells the conversation
its outcome later, which starts the next turn. The turn's last words ("still
waiting on the approval card") were posted as the answer, and on WeChat that
took the one reply: the real result after the approval, with its picture, was
refused.
At a turn's end with no reply yet, the session's row (pending_interactions)
and the hub's waiting cards now say whether a card raised since the request
was asked still waits. If one does, nothing is posted and the reply stays
free; the run keeps waiting (agent_approval_wait, 25 h) and the turn after the
card's outcome answers as usual. A card from an earlier request does not hold
a later one. A read the hub cannot answer now is asked again before anything
is posted.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on; a card comes before awaited work; the put-off is bounded (review 1) - A turn whose end was put off (the hub could not say whether a card waited) is no longer forced to end once its conversation goes on: any new item clears it, its words are not posted, and the turn under way ends as usual. Before, the card's outcome arriving with the hub back posted the old words or the next turn's half-written ones and ended the run. - A card waiting is checked before the work the conversation handed out (Feishu's agent_task_wait): such a run is held and still followed, instead of ending as awaiting and missing the next turn's last words. - The put-off lasts at most agent_hub_wait: then a row that cannot be read means the last words are the answer, as before, and a card list that cannot be read while the row counts a card holds the run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…当成回复发出 - 核心(飞书、微信都生效):/agent 会话里的命令被 Persona 拦下等主人审批、本轮因此结束时,不再把「还卡在审批卡上」这段话当成回复发出,也不占掉微信唯一一次回复。 - 判断依据:hub 会话行的待处理卡片数,再看待处理卡片列表里有没有本次请求之后新建的卡;同一会话里更早请求留下的卡不压住这次的答复。 - 审批有结果(批准、拒绝、过期)后,Persona 把结果送进会话开始下一轮,下一轮按原规则回复,可以带图。 - 卡片最多等 25 小时(Persona 的卡等 24 小时后过期),真没等到就发一次超时说明。 - hub 暂时答不上来时先不发,最多再问 5 分钟。 - 不新增权限,不新增以用户身份发的消息,不默认打开新功能。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
/agent 会话里一条命令被 Persona 命令闸拦下、主人 75 秒内没批时,Persona 给这次工具调用返回「The owner has not answered this approval yet … End this turn now … A later message will report its outcome」,会话照做结束本轮。OpenMate 在本轮结束、还没有经工具回复时,会把本轮最后一段文字当成答复发出(
core/openmate_core/agent.py的_turn_ended兜底)。于是「还卡在审批卡上…」被当成唯一一次回复发进群;微信只能回复一次,批准后真正的结果和截图被_reply_tool以「只回复一次,这条已经回复过了」拒掉。做了什么
GET /api/v1/sessions?machine_id=&session_id=的pending_interactions(hub 用同一份待处理卡片表计算,命令闸的卡在返回 WaitingText 之前已经续期 24 小时并挂在表里);GET /api/v1/interactions,按machine_id/session_id/created_at只认本次请求创建之后的卡(同一会话里更早请求留下的卡不压住这次的答复);hub 不给扩展看的私密卡按「可能是本次的」处理。agents.read权限内,不要新权限。agent_approval_wait(25 小时,覆盖 Persona 卡片的 24 小时等待期),期间每agent_hold_poll(30 秒)读一次会话;真没等到结果就发一次超时说明「要你处理的卡片等了 25 小时还没有结果…」。审批后的下一轮重新计agent_timeout。怎么验证的
tests/test_agent_approval.py(第一版 11 条,审查后共 15 条):fallback未占用、发送日志里没有兜底记录;core/改动撤掉在旧代码上跑:8 条失败、1 条报错(旧代码没有新的时序参数),普通流程的 2 条照常通过。bash scripts/test.sh:三组测试 960 / 419 / 191 全部通过(发版前的包校验在发版提交里处理)。审查
card_unsure)期间,审批结果先到、新一轮已经开始,下一次轮询会被强制收尾,把旧话或半截话发出去。→ 会话出现任何新条目就取消推迟、丢弃旧话,新一轮按原规则收尾。awaiting)分支跳过了卡片检查。→ 先查卡,没卡才走 awaiting。agent_hub_wait(5 分钟);之后读不到会话行就按原行为发出,会话行有计数但读不到卡片列表就挂起。scripts/test.sh三组 965 / 419 / 191 全过。package.py --check --published origin/main通过。没做什么
agent_task_wait的飞书「等任务结果」路径保持原样。🤖 Generated with Claude Code