You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(connectors): keep one carried stamp per sender across failed starts - #48734
When a connector message fails to start (signed out, CLI missing, start failed), the conversation's next message carries it. Each carried card copied every earlier sender stamp with no de-duplication, so card n held n-1 stamps and total stamp storage grew quadratically with the length of a failed-start chain.
carriedMessages now keeps one stamp per sender, using the same key the authority check reads (source:userId:role, another app counted as app, an unnamed sender kept once). The first stamp for each sender is kept, so the sender order and the names of who typed are unchanged. Cards saved by earlier builds with repeated stamps are collapsed the next time they are carried, and they already read correctly because distinctAskers collapses them on read.
Performance
Measured with the real carriedMessages / carriedFields code, 366 B Slack stamp, 300 B of text per message:
N messages
stamps on last card
last card: stamps / whole body
all cards: stamps / whole bodies
CPU total
10
9
3.3 KB / 7.5 KB
17 KB / 42 KB
1.4 ms
100
99
36 KB / 73 KB
1.8 MB / 3.7 MB
7 ms
1000
999
367 KB / 732 KB
183 MB / 367 MB
615 ms
After this change each card holds at most one stamp per distinct sender, so stamp storage grows linearly (one sender: 1 stamp per card instead of n-1).
Testing
external-conversation-returned-carry.test.ts: 20 failed starts from one sender, and from two alternating senders, through the real journal writer; plus a saved card with repeated stamps. All three fail with the fix reverted.
No actionable comments were generated in the recent review.
Walkthrough
The carried asker collection now keeps the first asker for each sender key, based on source, user ID, and app marker or role. Null askers share an empty key, so only the first is retained. Tests cover single and alternating senders across 20 failed starts, repeated senders in a saved card, and a trailing null entry.
Merge Risk: Minimal · up to d7238
Failed connector starts no longer cause carried sender stamps to grow quadratically. Each carried card keeps one stamp per sender, and authority behavior is preserved. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: carried stamps are reduced to one per sender across failed connector starts. It follows the conventional commit style and states the performance purpose. It matches th…
Description check
The description follows the repository template closely. It explains the mechanism (one stamp per sender keyed by source:userId:role, with app and unnamed-sender handling), the before and after, and t…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: carried stamps are reduced to one per sender across failed connector starts. It follows the conventional commit style and states the performance purpose. It matches the changeset, which de-duplicates carriedAskers and carriedMessages by sender.
Full details: Description check
Explanation
The description follows the repository template closely. It explains the mechanism (one stamp per sender keyed by source:userId:role, with app and unnamed-sender handling), the before and after, and the quadratic growth problem. It includes a Performance section with measurements and a Testing section that names the test file and its three cases. The Linked Issue section uses STA-18126 as a reference, but the template expects a 'Fixes #' issue link. Several template sections are missing or unfilled: ELI5, Visual Proof (required for behavior changes, or N/A with reason), Risk level and rollback plan, the testing checklist, and the Review and Agent skill sections. The description still covers most of the required content.
Resolution
Optionally add: an ELI5 summary; a Visual Proof entry (or N/A with reason); a Risk section with the Level and a rollback note (a plain revert is sufficient, but note that saved cards with duplicates are rewritten when carried); a GitHub issue link in the Linked Issue section in the 'Fixes #' form; and the Testing checklist items.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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
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.
Fixes STA-18126.
Summary
When a connector message fails to start (signed out, CLI missing, start failed), the conversation's next message carries it. Each carried card copied every earlier sender stamp with no de-duplication, so card n held n-1 stamps and total stamp storage grew quadratically with the length of a failed-start chain.
carriedMessagesnow keeps one stamp per sender, using the same key the authority check reads (source:userId:role, another app counted asapp, an unnamed sender kept once). The first stamp for each sender is kept, so the sender order and the names of who typed are unchanged. Cards saved by earlier builds with repeated stamps are collapsed the next time they are carried, and they already read correctly becausedistinctAskerscollapses them on read.Performance
Measured with the real
carriedMessages/carriedFieldscode, 366 B Slack stamp, 300 B of text per message:After this change each card holds at most one stamp per distinct sender, so stamp storage grows linearly (one sender: 1 stamp per card instead of n-1).
Testing
external-conversation-returned-carry.test.ts: 20 failed starts from one sender, and from two alternating senders, through the real journal writer; plus a saved card with repeated stamps. All three fail with the fix reverted.