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
fix(connectors): carried messages keep their senders' authority and image cap - #48662
Follow-up to #48493. Fixes STA-18053, STA-18060, STA-18062.
What changed
Carried messages keep their senders' authority (STA-18053). When a Slack message fails to start (agent signed out, CLI missing…), the conversation's next message carries it into its turn. That turn was stamped with only the newest sender, so an owner's reply could carry a member's request and run it with owner rights. The carrying message now records every carried sender (nested carries included) as a host-only carriedAskers field, and the acting-turn reader counts them as stamped askers, so the existing least-trusted rule covers them. A carried message whose sender couldn't be read counts as unknown, as it does on its own.
The same carry now keeps a batch that couldn't leave its thread from becoming leave-eligible when carried again.
Image cap (STA-18060). Carried cards are taken oldest first while the total images (carried plus the new message's own) stay within the 20-image message cap. Cards that don't fit stay returned and ride the next message.
Returned-card query (STA-18062). Uses INDEXED BY journal_queue_order, the pattern the same file already uses, so it no longer walks the chat's whole queue history when the database has no planner stats.
Nothing is refused that wasn't before: every eligible card is still carried, some just one message later when images don't fit.
carriedAskers is in the journal storage schema and the send-payload strip list, like carriedCards, so it is never sent to the agent and doesn't change body fingerprints. Messages saved before this change have no carriedAskers and read exactly as before (tested).
Testing
New tests in external-conversation-returned-carry.test.ts drive the real journal writer and the real acting-turn reader:
a member's failed message carried by the owner's message doesn't act for the owner, and still doesn't when that carrying message fails and is carried again. Against main's code this fails with expected true to be false.
a carrying message saved without carriedAskers reads as it did before.
three cards with 8 + 8 + 4 images and a 4-image new message: the first two are carried (20 images), the third stays returned.
pnpm tc:node, oxlint, and the changed/adjacent test files (returned-carry, chat-send, bot-request-asker, leave-thread-authority): 38 passed.
Performance
The image budget is one pass over the carried cards' blocks, once per connector delivery, and only when a carry happens.
Reading carriedAskers adds one map over a small array per message in the acting turn's window.
The returned-card query now searches journal_queue_order directly. Measured earlier on the real schema: 0.65 ms at 10,000 cards and 12.6 ms at 100,000 cards before, 0.001 ms at 100,000 after. It runs on a journal reader worker thread.
No actionable comments were generated in the recent review.
Walkthrough
Carried messages now include asker metadata, including nested carried askers and unknown asker entries. Carry selection accounts for outgoing images and carries eligible cards oldest-first within the image limit. Bot conversation and turn resolution incorporate carried askers. The message payload excludes carried asker metadata.
Merge Risk: Minimal · up to d4a66
Carried Slack messages now record their senders, including nested carries, so the existing least-trusted rule applies when resolving who a bot turn acts for. Carried cards are selected oldest first within the image cap, and the returned-card query is faster. No merge-blocking risk was found. Messages saved before this change keep their previous behavior.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix (carried messages keep senders' authority) and the image cap. Both appear in the changeset: carriedAskers feed the acting-turn authority check, and carriedMessages caps carried…
Description check
The description follows the template. It has What Changed, Why (via the mechanism and the alternative of carrying one message later), Testing with a checklist, a Performance section with a concrete li…
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 fix (carried messages keep senders' authority) and the image cap. Both appear in the changeset: carriedAskers feed the acting-turn authority check, and carriedMessages caps carried images at 20. The title covers the two main changes and omits the indexed query fix, which is an expected omission.
Full details: Description check
Explanation
The description follows the template. It has What Changed, Why (via the mechanism and the alternative of carrying one message later), Testing with a checklist, a Performance section with a concrete line, and tests and measurements. It has no Linked Issue section content, since it cites STA-18053, STA-18060, and STA-18062 but not a GitHub issue. It omits the ELI5, Visual Proof, Risk level, AI Disclosure, and Review sections.
Resolution
Optional improvements: add the ELI5 summary, a Visual Proof line (for example 'N/A' with the reason, since this is a backend behavior change), a Risk level with the backout method (a plain revert, noting that carriedAskers rows stay in saved journal data), a Linked Issue entry (Fixes #<issue> if a GitHub issue exists), and the AI Disclosure section if applicable.
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; 7 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.
Follow-up to #48493. Fixes STA-18053, STA-18060, STA-18062.
What changed
carriedAskersfield, and the acting-turn reader counts them as stamped askers, so the existing least-trusted rule covers them. A carried message whose sender couldn't be read counts as unknown, as it does on its own.INDEXED BY journal_queue_order, the pattern the same file already uses, so it no longer walks the chat's whole queue history when the database has no planner stats.Nothing is refused that wasn't before: every eligible card is still carried, some just one message later when images don't fit.
carriedAskersis in the journal storage schema and the send-payload strip list, likecarriedCards, so it is never sent to the agent and doesn't change body fingerprints. Messages saved before this change have nocarriedAskersand read exactly as before (tested).Testing
external-conversation-returned-carry.test.tsdrive the real journal writer and the real acting-turn reader:expected true to be false.carriedAskersreads as it did before.pnpm tc:node, oxlint, and the changed/adjacent test files (returned-carry, chat-send, bot-request-asker, leave-thread-authority): 38 passed.Performance
carriedAskersadds one map over a small array per message in the acting turn's window.journal_queue_orderdirectly. Measured earlier on the real schema: 0.65 ms at 10,000 cards and 12.6 ms at 100,000 cards before, 0.001 ms at 100,000 after. It runs on a journal reader worker thread.