Skip to content

fix(chat): show typed model-capacity failures in Lark conversations - #5657

Merged
loopx-agent merged 2 commits into
mainfrom
codex/native-model-capacity-feedback-20261005
Oct 5, 2026
Merged

loopx-agent merged 2 commits into
mainfrom
codex/native-model-capacity-feedback-20261005

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

A typed Codex serverOverloaded failure previously became a generic failure in Lark DMs. Preserve the typed category and reuse the existing safe failure formatter for an accurate busy-model response, while retaining the original Session, Turn and delivery receipt.

Current main was integrated with a normal merge. Its per-record concurrency, images, reaction feedback, outbound normalization and timeout handling are retained. This adds no automatic retry, model fallback, replacement thread or new state owner.

Validation at 6f9a859: 185 related tests; eight real isolated native Core/file/transport base-head journeys; typed/prose oracle; Ruff and compile; native standard premerge 5 direct +18 selected pass. Eight existing adapter type diagnostics reproduce on the immutable main base with the same identities and details, insertion offsets only. CI was not consulted. External provider/model are synthetic in the isolated fixture; final installed/live Bot acceptance remains separate.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@mergify

mergify Bot commented Oct 5, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Oct 5, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration=runtime_reported; effort=xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

源码结论 APPROVE,绑定 head c61a4b348295f05c8ac86059c7afa0e92df47bd4。未发现新增阻塞性代码问题;与当前主干存在内容冲突,集成和新 head 验证需要另行完成。

动机

给飞书 Bot 发消息的用户。模型报告明确的容量错误时,旧版只给普通执行失败;新版保留错误类别,提示先查看已有结果,再由用户决定是否发送新请求。已验证安全反馈、原会话保留、重复事件不重放,以及新的人类输入在原线程继续。不增加模型重试、切换或新的执行权限,也不证明真实模型持续可用。

这里最重要的是让用户知道本轮没有完整完成,并先核对可能已产生的结果。仅把错误说得更友好、随后自动再次执行,会把已有副作用做两遍。当前修复给原始失败保留明确类别,不把繁忙解释成权限不足,也不把等待或局部输出冒充成功。

真实容量错误与安装态飞书展示仍未独立验收;本结论限当前源码切片。

改动思路

沿用已有 Codex 错误适配器、Chat 的持久会话和轮次,以及飞书回复通道。宿主提供终止事件,适配器只按明确的错误标识分类;Chat 保存原始失败,飞书使用共同的安全 formatter 给出恢复建议。私聊直接复用已有 manager_failure_reply,而不是另建重试器、状态表或模型选择逻辑。未知自由文本仍走普通失败路径。

最小替代方案是保留现状,但旧版本反事实已经复现丢失分类和解释的问题;用英文句子匹配繁忙原因会错误采纳未经结构化验证的上游文字。当前改动扩展最近的既有 owner,Python 留在稳定宿主/领域适配层,未复制 TypeScript 状态或 effect 决策。

具体改动

验收参考 docs/architecture/rfcs/capable-manager-semantic-handoff-v0.md,读取的不可变版本是 4b99d7139a59c29795d50b79ab4bbad3f815f9a2,先读该版本再读本 PR 新增的契约段落。逐项映射:A22 的失败真实呈现及重复回放不重开轮次,在原生文件链路得到验证;A23 的原轮次隔离、重复模型调用禁止及显式后续输入继续得到验证;A12 的模型配置升级不是本次修改范围;S5 的真实安装态 provider/host 切换资格仍 deferred,不能由模拟输入闭合。

关键代码讲解

  • _terminal_turn_error 在现有精确映射表内增加 serverOverloaded → server_overloaded,保留 host failure 与 policy failure 的差别。终止状态才形成失败;willRetry 通知及其他线程/轮次不能提前终止当前回答。
  • manager_failure_reply 同时接受既有异常与持久轮次 Mapping,用安全类别输出繁忙说明、/status 与已有结果提示,未转发任意 provider message/additionalDetails。
  • LarkPrivateConversations.reconcile 只在原轮次 failed 且类别完全匹配时使用共享说明,继续对同一 source 发送、验证和 ACK;completed、interrupted 及其他失败保留原分支。

全量七文件差异为 +76/-7:三处现有生产适配路径、三处测试文件和一处公开契约说明,无新模块、请求协议或生成物。源码测试独立运行 146 项通过,不是采纳作者报告的测试数字。

对主干的风险

最强反例是上游自由文本包含“繁忙”但没有明确类型,或者失败前有部分输出,随后重复事件、重新协调导致第二次模型执行。对两个 App 配置各跑 typed/unknown 四组相同原生文件链路:旧 base 的 typed 两组保留 host_gate,head 正确保留 server_overloaded;unknown 两组在两个版本均普通失败。所有案例的 canonical response 保持空,私有上游详情和部分答案没有进入终止回复;重复 source 与重建 transport 未追加模型调用,只有新的用户输入启动第二轮,并且 Session 和上游线程不变。

语义与 CI 对齐

新增类别是既有 provider 输入到 error_code 的局部映射扩展;failed 生命周期与原始权限 owner 未改。开发期语义 advisory 无 supported 新 vocabulary carrier,但该分析有范围限制;随后全树 semantic-vocabulary-drift smoke 通过。Ruff、diff hygiene 及仓库配置的 19 文件严格 kernel Mypy 通过。另对三处适配器运行 imports-skip Mypy,base/head 都有 8 项相同文件、错误文本及代码的旧错误,仅行号偏移;逐项比对,没有放宽检查或靠相等总数归因。这是既有适配器类型债务,当前改动分类、持久化和不重放的不变量有独立通过证据。CI 按当前评审配置没有查询、轮询或等待。

当前主干的私聊与相关测试路径已有新修改;本地 merge-tree 也确认这两处内容冲突。代码评审通过不等于合并可执行:维护者解决冲突后,必须重新绑定新 head 并重跑受影响的原会话、投递及恢复验证。

我的整体评价

这是一个可独立回滚的 justified_increment。long_horizon 保持原轮次/会话和后续继续能力;user_experience 在已验证的原生传输路径改善为真实、可行动的繁忙反馈。模型真实可用性、失败前没有副作用、安装态采用和切换验收均未证明,不能从本结论推出。

相邻边界的未来重构检查已经做过:本 PR 对私聊复用了共同 failure formatter,这个小范围去重复值得保留;额外抽取新 registry、模块或迁移通用 TS owner 暂无必要。其余错误分类、retry 归属和权限仍使用原有协议。剩余风险是 live provider 行为、旧类型债务以及冲突后的集成 head,需要各自 owning path 的证据,不能继承此 head 的批准。

English verdict: APPROVE - c61a4b3; typed capacity feedback preserves the original failed Turn and prevents automatic replay. Independently validated 146 relevant tests and paired native file lifecycle counterfactuals; eight adapter type errors are base-equivalent. Current main conflicts and live-provider qualification remain separate holds.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; GPT-6; OpenAI; self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

Exact head: 5657@6f9a85971ccf4af254b48d8895ac87ba244bd927; immutable main base: 3b454ab3652ae6c204233535be18ef031e34c29d.

动机

飞书个人助手或管家遇到模型明确返回繁忙错误的用户。 此前模型明确报繁忙时只显示笼统失败;现在给出繁忙原因,保留原会话,提示先核对结果再决定是否重试。 两个 App 的隔离原生链路已验证准确反馈;新输入沿用原 Session 和模型线程,相同请求不重跑。 本改动不自动切模型、重建线程或重试,也不证明上游可用、此前没有副作用或全部消息已完成。 正式安装、真实外部来源读取和原渠道消息交付仍需单独验证。

“原会话”是原生 Chat 保留的上下文;模型繁忙不等于权限不足,也不能证明此前文件写入没有发生。反馈应帮助用户继续,不能把半截答案说成已完成。

改动思路

最强反方是:提示繁忙仍不能替用户读文章和整理素材,另做重试状态机反而更重。本次只补实际类型信息丢失:现有Codex adapter识别明确host错误,现有安全formatter由管家异常和私聊终态共用。Core仍拥有Session/Turn/队列/授权,传输仍负责回复读回和ACK,没有新配置、Goal、daemon、自动切模型或重建thread。

旧c61a4b3评审不能继承到当前head。正常merge最新main时,保留完整per-record reconcile、图片、表情、Markdown规范化和timeout终态,只在failed+精确capacitycode处复用formatter。旧分支的大段循环冲突采用main结构,没有倒退并发、附件或反馈功能。

具体改动

完整差异7文件 +77/-8,其中production三文件 +23/-6,测试三文件 +45/-2,RFC9行;uv.lock未跟踪不提交,main ancestry的已合并文件不算新增scope。

阅读先于实现的规范为 docs/architecture/rfcs/capable-manager-semantic-handoff-v0.md,spec_revision=3b454ab3652ae6c204233535be18ef031e34c29d。原ID映射:A12 implemented,原线程和后续输入保持;A22 implemented,终态真实、delivery dedup不重开Turn;A23 implemented,main精确stop/queue/lateTurn隔离保持并回归;S10 implemented,不可用/繁忙反馈准确且不重跑;S5 deferred,完整实际安装/provider/model/原人类请求仍是已有交付缺口。新增capacity段落是本PR要审查的说明,未当作独立规范反推要求。

关键代码讲解

  • chat_agent.py:104 _terminal_turn_error 在原typed map加入serverOverloaded,只相信codexErrorInfo discriminator;unknown/prose仍host_gate。原run_turn willRetry和otherTurn过滤保持,终态沿原存储写error_code,无新权威状态。
  • manager_context.py:37 manager_failure_reply 从当前Exception或原生终态Mapping读取已知error_code,两种实际caller共享safe label/message。繁忙建议先查/status与已有结果再决定重试,任意私密上游文本不回显。
  • private_conversations.py:416 LarkPrivateConversations.reconcile_record 仅failed/server_overloaded调用formatter,成功/timed_out/interrupted/generic保留main逻辑。原App/受众/per-record lock/reply readback/ACK继续决定投递,没有权限放宽。

真实隔离正向旅程通过原App消息入Core/FileStore,本地fake appserver进程返回typed繁忙,生成一条failedTurn并回原App。相同消息重admit、新transport对象重concile不重start模型/重复回复;下一条明确输入才产生新Turn,同Session/upstream thread完成。两个App都通过,无Goal。

对主干的风险

185项当前相关tests通过,覆盖队列/stop/App隔离/图片/表情/timeout/host retryable与wrongTurn过滤。八组完整原生admission、file、transport和下一轮观察在固定main/head实际运行;两组capacity仅改类别/error/display,六组other/rate/policy的稳定完整观察相同。provider/model为合成外部边界,Core/存储/本地进程不是mock返回成功。

最危险反例是私密message包含capacity但typedother,以及willRetry=true后成功;前者generic且不泄漏,后者等真正终态。独立oracle在固定main失败(host_gate不满足capacity断言)、当前head通过。Late旧Turn事件不能覆盖新Turn,现有断言保持。

Ruff/compile通过,native premerge5direct+18selected全通过,0failure/warning/advisory。adapter Mypy仍有8项既有错误;固定main和head同命令检查,filename、errorcode和完整诊断逐条相同,仅插入行号偏移。未变helper返回类型/nullcallback/eventparams路径与新formatter/mapping因果独立;变化不泄漏/终态/continuation/replay有独立通过证据。没有降低上限、删除断言或声称修好既有类型问题。

语义与 CI 对齐

这是既有typed error vocabulary扩展,不是消息substring分类、新调度或授权语义。没有schema/flag/手动同步state/版本分叉;Exception/Mapping是当前实际消费者,共用formatter小于复制policy。旧receipt仍按原恢复读回。按Goal政策没有查/轮询/等待CI。工具self_merge_allowed=false不授予维护者权限;当前人类另行授权已评审管家/chat PR自修复自合并,仍必须紧邻操作的native exact-head ready=true。

初次对照后处理把名为pending()的完整历史request inventory误当待处理队列,断言0失败;核查原函数后保留两条实际request观察,不把它们称为排队。错误后处理不是通过项,真实fixture和独立oracle已按实际语义完成。首个shell quoting错误未执行fixture,后用正确命令完成;正常FF push已独立远端核对,未声称前一次被后处理阻断的assert执行成功。

我的整体评价

APPROVE,justified_increment:真实类型丢失修复,没有把素材未完成包装成能力完成。long_horizon=preserved,原失败/receipt持久保留,delivery恢复不重跑,新输入仍原会话;user_experience=improved,原因和下一步明确,无重新配置/建会话的额外步骤。

整体仍为有界adapter/provider修复,main冲突已消除,新能力不退回,没有阻塞finding。正式Bot安装、真实文章/图片和原消息回传仍归已有任务,当前测试不代替live结果。精确build观察不可用,Reviewer如实声明GPT-6家族self_reported,不借用上一reviewer runtime身份。批准只评当前head;closeout与独立native合并门禁通过才执行授权合并。

English verdict: APPROVE - Typed capacity feedback reuses existing owners and preserves the original Session, Turn and delivery without automatic replay.

@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Oct 5, 2026
@loopx-agent
loopx-agent merged commit c0d91ed into main Oct 5, 2026
6 of 23 checks passed
@loopx-agent
loopx-agent deleted the codex/native-model-capacity-feedback-20261005 branch October 5, 2026 21:44
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