Commit f353eb0
unraid
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.1 parent c2ac9a7 commit f353eb0
17 files changed
Lines changed: 2086 additions & 136 deletions
File tree
- packages/builtin-tools/src/tools
- ListPeersTool
- SendMessageTool
- __tests__
- src
- cli
- commands/peers
- services/AgentSummary
- __tests__
- utils
- __tests__
- messages
- swarm
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
96 | | - | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
103 | 117 | | |
104 | 118 | | |
105 | 119 | | |
| |||
Lines changed: 73 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
133 | 170 | | |
134 | 171 | | |
135 | 172 | | |
| |||
541 | 578 | | |
542 | 579 | | |
543 | 580 | | |
544 | | - | |
545 | 581 | | |
546 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
547 | 588 | | |
548 | 589 | | |
549 | 590 | | |
550 | 591 | | |
551 | 592 | | |
552 | | - | |
| 593 | + | |
553 | 594 | | |
554 | 595 | | |
555 | 596 | | |
| |||
560 | 601 | | |
561 | 602 | | |
562 | 603 | | |
563 | | - | |
| 604 | + | |
564 | 605 | | |
565 | 606 | | |
566 | 607 | | |
| |||
569 | 610 | | |
570 | 611 | | |
571 | 612 | | |
| 613 | + | |
572 | 614 | | |
573 | | - | |
| 615 | + | |
574 | 616 | | |
575 | 617 | | |
576 | 618 | | |
577 | | - | |
| 619 | + | |
578 | 620 | | |
579 | 621 | | |
580 | 622 | | |
581 | | - | |
| 623 | + | |
582 | 624 | | |
583 | 625 | | |
584 | 626 | | |
| |||
630 | 672 | | |
631 | 673 | | |
632 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
633 | 688 | | |
634 | 689 | | |
635 | 690 | | |
| |||
787 | 842 | | |
788 | 843 | | |
789 | 844 | | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
790 | 855 | | |
791 | 856 | | |
792 | 857 | | |
| |||
797 | 862 | | |
798 | 863 | | |
799 | 864 | | |
800 | | - | |
| 865 | + | |
801 | 866 | | |
802 | 867 | | |
803 | 868 | | |
804 | 869 | | |
805 | 870 | | |
806 | 871 | | |
807 | | - | |
| 872 | + | |
808 | 873 | | |
809 | 874 | | |
810 | 875 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2763 | 2763 | | |
2764 | 2764 | | |
2765 | 2765 | | |
2766 | | - | |
| 2766 | + | |
| 2767 | + | |
2767 | 2768 | | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
2768 | 2786 | | |
2769 | 2787 | | |
2770 | | - | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
2771 | 2791 | | |
2772 | 2792 | | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
2773 | 2797 | | |
2774 | 2798 | | |
2775 | 2799 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
0 commit comments