Repository navigation
电脑代理发件箱按字节设总量上限,超了原位收短最早的输出,不删帧不拒结局 - #131
Merged
Merged
Conversation
This was referenced Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G8qYwfPMY8BjZo7qE6XQUG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G8qYwfPMY8BjZo7qE6XQUG
agent.ts 三处把 options.log 直接交给发件箱,main.ts 和桌面端都不传 log,生产上收短、隔离的日志全丢。改用带默认值的 log。WorkAppendChannel 吞掉的 OversizedUplink 原因也记一笔。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
原来每批先追加原样再收短再整份重写,收不动的积压下每来一帧都重写一遍上限那么多字节。现在新帧写盘前就收,直接追加收短后的;#trim 按 #frames 下标定位,不再借 pending() 的下标。append 返回实际落盘的那一帧。e2e 用例原来靠收短日志推断已经掐断,落盘前收短后日志比第一次发送早,改成等掐断真的发生再接回去。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
joesmart
force-pushed
the
joesmart/fix-outbox-cap
branch
from
November 5, 2026 10:39
667e3ea to
c562d83
Compare
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.
改了什么
电脑代理的可靠发件箱加上总量上限(
packages/computer-agent/src/reliable-transport.ts、frame-limit.ts):OUTBOX_LIMITS,只在 computer-agent,不进 shared,不改协议号,不加迁移)。累计字节数在入队、确认、收短时增减,不每次重量整队。bot_text_done.text截到 64 KiB,agent_error.detail截到 4 KiB,末尾写「…(电脑离线太久,积压的输出太多,后面的已截掉)」;bot_tool_call.view复用单帧上限的compactView。run_done、审批、交接、各种 offer、poker_*原样照收。审批卡不收,用户是看着卡批的。收过的帧不再收(收不小就不换)。work_append会让总量超上限时拒收,走现有OversizedUplink,镜像回invalid停流,不拖累 run。ReliableOutbox.open/openForComputer的参数和AgentOptions.outboxLimits,测试用小上限。顺带修了同一处的一个已有问题:
#compact重写 journal 时会把还没落盘的帧也写进去,之后 flush 又追加一遍,同一序号两行,重开时被当成损坏隔离(确认时恰好有新帧入队就会触发)。现在只写已落盘的帧(pending())。rawNotice改为只替换超过 4 KiB 的原始参数:原来把小参数也换成「太大没有上传」,既不准,也让compactView收两遍结果会变。文档:
docs/部署.md的「电脑代理的发件箱」改成现在的行为;packages/computer-agent/README.md新增「发件箱上限」一节。为什么这么做
控制面只认连续的序号,删一条后面全成缺号,所以不能删帧也不能丢最早的。
open已有先例:超单帧上限的帧原位换掉、序号不变,控制面处理过的序号只回确认,没处理过的处理换上去的那条。总量控制沿用同一办法,控制面不需要知道发件箱满过。按字节不按条数,是因为占磁盘和内存的是字节,一条bot_text_done可能比一千条run_done还大。结局类报文代表决定,丢了 run 就收不了尾;靠它们自己涨满 128 MiB 要几十万个 run。怎么验证的
新加的测试:
computer-agent/test/reliable-transport.test.ts「发件箱总量上限」五条:在途收短到回落线、序号连续、结局帧原样、原因写明、盘上改掉;旧版留下的超量积压冷启动收短,审批不收、收过不再收;超限拒work_append不占序号、结局照收并告警;确认后字节回落、work_append放行;确认压缩时并发入队不写出重复序号。五条在改代码前都红。e2e/test/outbox-cap.test.ts:真控制面 + 真代理 + 真运行器,断线期间发件箱超上限,重连后群里是截短的正文加原因,run 照常收尾记费用,没有正文或 run 的报错。Closes #115
🤖 Generated with Claude Code
https://claude.ai/code/session_01G8qYwfPMY8BjZo7qE6XQUG