claude-code-best/src/commands
Dosion 52b61c2c06
fix: bound agent communication memory growth (#369)
* fix: bound agent communication memory growth

UDS messaging now uses private local capabilities instead of exposing auth tokens through SDK metadata, environment variables, session registry, peer listing, or tool output. The receive path bounds NDJSON frames, response buffers, active clients, and pending inbox bytes, and strips auth metadata before messages enter the prompt queue.

Teammate mailboxes now validate file and message sizes, fail closed on corrupt mutation inputs, compact by count and retained bytes, and use stable message identity for in-process acknowledgements. Agent summaries now fork only a bounded recent context using lazy size estimation and content fingerprints instead of retaining or serializing unbounded histories.

Constraint: PR #361 was already merged; this branch is based on upstream/main@c2ac9a74.
Rejected: Default-disabling COORDINATOR_MODE/TEAMMEM only | explicit feature enablement still hit unbounded paths.
Rejected: Persisting UDS auth in SDK/env/session registry | bridge/remote metadata can leak local capability secrets.
Rejected: Inline uds #token addresses | observable/tool/classifier paths can reflect raw addresses outside the UDS request frame.
Rejected: Positional mailbox marking after compaction | compaction can shift indices across the lock boundary.
Confidence: high
Scope-risk: moderate
Directive: Do not expose UDS capability tokens through SDK messages, environment variables, session registry, peer-list output, or SendMessage result/classifier surfaces.
Directive: Do not reintroduce positional mailbox acknowledgements unless compaction is removed or read+mark is atomic under one lock.
Tested: bun test src/utils/__tests__/ndjsonFramer.test.ts src/utils/__tests__/udsMessaging.test.ts packages/builtin-tools/src/tools/SendMessageTool/__tests__/udsRecipientSanitization.test.ts
Tested: bunx tsc --noEmit --pretty false
Tested: bun run lint
Tested: bunx biome lint modified src/package files
Tested: bun run test:all (3704 pass, 0 fail, 6734 expects)
Tested: bun audit (No vulnerabilities found)
Tested: bun run build
Tested: bun run build:vite
Tested: git diff --check
Not-tested: End-to-end external UDS client driving a full production headless model turn.

* fix: harden bounded agent communication review fixes

CodeRabbit and Codecov surfaced real gaps in UDS framing, peer discovery, mailbox retention, and summary context coverage. This tightens those paths without suppressing review or coverage signals.

Constraint: PR #369 must address CodeRabbit and Codecov findings without warning suppression or fake fallbacks

Rejected: Suppress Codecov or CodeRabbit warnings | leaves real receive-path and test-isolation gaps

Rejected: Add unreachable feature-gated tests | bun:bundle keeps those branches compile-time gated in local tests

Confidence: high

Scope-risk: moderate

Directive: Keep UDS auth-token rejection outside feature flags; do not reintroduce inline token fallbacks

Tested: bun test --coverage --coverage-reporter lcov --coverage-dir coverage; bun run test:all; bun run lint; bun run build; bun run build:vite; bun audit; git diff --cached --check

Not-tested: Remote Codecov/CodeRabbit refreshed reports until pushed

* fix: prevent agent communication bounds from hiding CI regressions

Tighten the UDS auth, framing, and response-reader boundaries while keeping the AgentSummary lifecycle covered so Codecov and CI fail on real regressions instead of missing coverage. The poorMode settings mock mirrors unrelated real settings defaults to avoid Bun mock retention changing later permission tests.

Constraint: PR #369 must fix Codecov/CI precisely without warning suppression, fallback masking, or mock pollution

Rejected: Delete AgentSummary lifecycle coverage | would hide Codecov loss and stale-summary behavior

Rejected: Store inline UDS rejection in a hidden input sentinel | cloned observable inputs can drop it and bypass rejection

Rejected: Ignore malformed UDS frames until timeout | leaves client slots and SendMessage calls open to exhaustion

Confidence: high

Scope-risk: moderate

Directive: Keep empty #token= markers rejected; do not require a non-empty token value in hasInlineUdsToken

Tested: bun test packages/builtin-tools/src/tools/SendMessageTool/__tests__/udsRecipientSanitization.test.ts src/utils/__tests__/udsMessaging.test.ts src/utils/__tests__/udsResponseReader.test.ts src/utils/__tests__/ndjsonFramer.test.ts

Tested: bunx tsc --noEmit --pretty false

Tested: bun run lint

Tested: bun test --coverage --coverage-reporter lcov --coverage-dir coverage

Tested: bun run test:all

Tested: bun audit

Tested: bun run build

Tested: bun run build:vite

Not-tested: GitHub-hosted Codecov upload until pushed PR checks rerun

---------

Co-authored-by: unraid <local@unraid.local>
2026-04-27 14:47:18 +08:00
..
__tests__ feat: 添加 autonomy 自主模式命令系统 2026-04-22 22:38:09 +08:00
add-dir Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
agents 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
agents-platform feat: 完成stub 2026-03-31 20:40:16 +08:00
ant-trace feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
assistant Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
attach feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
autofix-pr feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
backfill-sessions feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
branch feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
break-cache feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
bridge feat: 添加 summary 命令 TypeScript 重写与其他命令增强 2026-04-22 22:38:09 +08:00
btw feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
buddy feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
bughunter feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
chrome fix(types): clean type fixes across 92 files 2026-04-09 23:45:56 +08:00
claim-main feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
clear fix: 修复长时间运行会话的内存泄漏问题 2026-04-26 21:14:00 +08:00
color feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
compact chore: 清理仓库审计问题——修正 CLAUDE.md、删除冗余 yoga-layout、清除 621 个未使用的类型 stub (#354) 2026-04-25 08:54:18 +08:00
config 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
context feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
copy Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
cost feat: build 2026-03-31 19:22:47 +08:00
ctx_viz feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
daemon Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
debug-tool-call feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
desktop 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
detach feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
diff 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
doctor 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
effort 添加deepseek-v4-pro支持选择max思考深度 (#365) 2026-04-26 09:00:43 +08:00
env feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
exit 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
export 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
extra-usage 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
fast Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
feedback 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
files feat: build 2026-03-31 19:22:47 +08:00
fork feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
good-claude feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
heapdump feat: build 2026-03-31 19:22:47 +08:00
help 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
history feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
hooks 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
ide fix: resolve dependency audit findings precisely (#361) 2026-04-26 19:49:54 +08:00
install-github-app chore: 清理仓库审计问题——修正 CLAUDE.md、删除冗余 yoga-layout、清除 621 个未使用的类型 stub (#354) 2026-04-25 08:54:18 +08:00
install-slack-app feat: build 2026-03-31 19:22:47 +08:00
issue feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
job Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
keybindings feat: build 2026-03-31 19:22:47 +08:00
lang Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
login feat: 正式启用 auto mode (#307) 2026-04-20 10:20:27 +08:00
logout Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
mcp 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
memory Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
mobile Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
mock-limits feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
model fix: resolve dependency audit findings precisely (#361) 2026-04-26 19:49:54 +08:00
oauth-refresh feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
onboarding feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
output-style 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
passes 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
peers fix: bound agent communication memory growth (#369) 2026-04-27 14:47:18 +08:00
perf-issue feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
permissions 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
pipe-status feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
pipes feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
plan feat(remote-control): 优化 Web 展示、状态同步与桥接控制流程 (#288) 2026-04-17 16:21:27 +08:00
plugin fix: resolve dependency audit findings precisely (#361) 2026-04-26 19:49:54 +08:00
poor fix: bound agent communication memory growth (#369) 2026-04-27 14:47:18 +08:00
pr_comments feat: build 2026-03-31 19:22:47 +08:00
privacy-settings 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
rate-limit-options Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
release-notes feat: build 2026-03-31 19:22:47 +08:00
reload-plugins feat: build 2026-03-31 19:22:47 +08:00
remote-env 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
remote-setup fix(types): clean type fixes across 92 files 2026-04-09 23:45:56 +08:00
remoteControlServer refactor: 解耦 BRIDGE_MODE 与 DAEMON,禁用 DAEMON 降低内存占用 2026-04-24 10:01:05 +08:00
rename feat: 完成第二版类型清理 2026-03-31 23:03:47 +08:00
reset-limits feat: 问就是封包 2026-03-31 23:32:58 +08:00
resume fix(types): clean type fixes across 92 files 2026-04-09 23:45:56 +08:00
review feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
rewind feat: build 2026-03-31 19:22:47 +08:00
sandbox-toggle Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
send Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
session Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
share feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
skill-learning feat: 添加 skill learning 技能学习闭环系统 2026-04-22 22:38:09 +08:00
skill-search feat: 添加 skill learning 技能学习闭环系统 2026-04-22 22:38:09 +08:00
skills 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
stats 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
status 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
stickers feat: build 2026-03-31 19:22:47 +08:00
summary feat: 添加 summary 命令 TypeScript 重写与其他命令增强 2026-04-22 22:38:09 +08:00
tag Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
tasks 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
teleport feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
terminalSetup chore: 清理仓库审计问题——修正 CLAUDE.md、删除冗余 yoga-layout、清除 621 个未使用的类型 stub (#354) 2026-04-25 08:54:18 +08:00
theme Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
thinkback Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
thinkback-play feat: build 2026-03-31 19:22:47 +08:00
upgrade 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
usage 更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121) 2026-04-04 23:24:27 +08:00
vim feat: build 2026-03-31 19:22:47 +08:00
voice feat: 集成豆包 ASR 语音识别后端,支持 /voice doubao 切换 (#357) 2026-04-25 13:57:30 +08:00
workflows feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
advisor.ts feat: build 2026-03-31 19:22:47 +08:00
autonomy.ts feat: 添加 autonomy 自主模式命令系统 2026-04-22 22:38:09 +08:00
autonomyPanel.tsx feat: 添加 autonomy 自主模式命令系统 2026-04-22 22:38:09 +08:00
bridge-kick.ts feat: build 2026-03-31 19:22:47 +08:00
brief.ts feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
commit-push-pr.ts feat: build 2026-03-31 19:22:47 +08:00
commit.ts feat: build 2026-03-31 19:22:47 +08:00
coordinator.ts feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
createMovedToPluginCommand.ts feat: build 2026-03-31 19:22:47 +08:00
force-snip.ts feat: 添加 summary 命令 TypeScript 重写与其他命令增强 2026-04-22 22:38:09 +08:00
init-verifiers.ts feat: build 2026-03-31 19:22:47 +08:00
init.ts Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
insights.ts feat: 添加 summary 命令 TypeScript 重写与其他命令增强 2026-04-22 22:38:09 +08:00
install.tsx Revert "Revert "feat: 第一个可以用的 ink 组件抽象 (#158)" (#175)" 2026-04-07 16:17:48 +08:00
monitor.ts feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
proactive.ts feat(remote-control): 优化 Web 展示、状态同步与桥接控制流程 (#288) 2026-04-17 16:21:27 +08:00
provider.ts feat: 全部类型问题解决 2026-04-11 10:24:00 +08:00
review.ts feat: build 2026-03-31 19:22:47 +08:00
security-review.ts feat: build 2026-03-31 19:22:47 +08:00
statusline.tsx feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
subscribe-pr.ts feat: 远程群控 (#243) 2026-04-11 23:22:55 +08:00
torch.ts Feat/integrate lint preview (#285) 2026-04-16 20:59:29 +08:00
ultraplan.tsx feat: 添加 summary 命令 TypeScript 重写与其他命令增强 2026-04-22 22:38:09 +08:00
version.ts feat: build 2026-03-31 19:22:47 +08:00