Repository navigation
Attribute thread summary avatars to the copilot who commented - #100012
Conversation
The thread summary under a message builds its avatars only from childOldestFourAccountIDs on the parent action. That field was written from the session account, which while connected as a copilot is the account being acted for, not the copilot. The same send stamps the copilot onto the reply via delegateAccountID, so one optimistic write produced two different identities and the summary showed a different person than the comment above it. Pass the effective author the optimistic action was already stamped with into the ancestor update, and use it for the duplicate check as well so a copilot replying twice is still counted as one commenter. The server writes the same field delegate-blind, so this keeps only the pending and offline states consistent until that is changed too.
|
@thelullabyy Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@mollfpr can you pls assign an internal engineer for BE changes?
The thread summary avatar is built only from Evidence, two 1. The thread's reply — attributed to the copilot POST /api/OpenReport
reportID=6971765021051531
reportActions_6971765021051531:
{
"reportActionID": "8998634924973878647",
"actionName": "ADDCOMMENT",
"actorAccountID": 22532870,
"delegateAccountID": 22340909, <-- copilot
"message": [{"text": "green run reply"}]
}2. Its parent action — summary records the account acted for POST /api/OpenReport
reportID=7283996934100375
reportActionID=7571172644691364988
reportActions_7283996934100375["7571172644691364988"]:
{
"reportActionID": "7571172644691364988",
"actorAccountID": 22532870,
"delegateAccountID": 22340909,
"childReportID": "6971765021051531",
"childOldestFourAccountIDs": "22532870", <-- account acted for, not the copilot
"childCommenterCount": 1,
"childVisibleActionCount": 1
}The only reply in that thread is when maintaining |
|
The BE PR is open! |
|
@mukhrr Could you please add prefix [Hold] to this PR until BE PR is merged |
@mollfpr any news on this BE PR? |
|
@mukhrr the BE PR is in production now 🙌 |
thanks! @thelullabyy I think we are good to move now |
|
@thelullabyy kindly bump |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / SafariScreen.Recording.2026-09-19.at.02.07.27.mov |
|
@mukhrr Could you please merge main? |
| return update.value?.[PARENT_REPORT_ACTION_ID]; | ||
| } | ||
|
|
||
| function buildReply(delegateAccountIDParam: number | undefined) { |
There was a problem hiding this comment.
I think the unit tests don't cover the actual fix, we should add test that drives addActions / addComment end-to-end
There was a problem hiding this comment.
ok i will add necessary ones
| * @param type The type of action in the child report | ||
| */ | ||
| function getOptimisticDataForAncestors(ancestors: Ancestor[], lastVisibleActionCreated: string, type: string): Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS>> { | ||
| function getOptimisticDataForAncestors( |
There was a problem hiding this comment.
Should we update two other places write the same field optimistically?
- src/libs/actions/IOU/Hold.ts:145 - delegateAccountID is already used to stamp buildOptimisticHoldReportActionComment, but isn't forwarded here.
- src/libs/actions/Task.ts:375 - delegateAccountID is a param of createTaskAndNavigate and is already used for buildOptimisticTaskCommentReportAction.
…d summary Hold and task comments already stamp delegateAccountID on the comment action but did not pass it to the ancestor update, so a copilot's hold or task comment still recorded the account acted for in the parent's childOldestFourAccountIDs. Read the effective author back off the built action, as addActions does, so the summary and the comment agree. Also cover addComment end to end: the existing tests exercised the ReportUtils helper directly and passed with the addActions call site reverted, so they did not prove the call site forwarded the delegate.
|
🚧 mollfpr has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mollfpr in version: 9.4.91-0 🚀
|
|
🤖 No help site changes are required for this PR, so I did not create a docs PR. Why: this is an internal correctness fix to optimistic (pending/offline) data, not a product change. It makes What I checked in
|
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.4.91-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The thread summary avatars come only from
childOldestFourAccountIDson the parent report action. That field was written from the session account, which while connected as a copilot is the account being acted for, not the copilot. The same send stamps the copilot onto the reply viadelegateAccountID, so the summary showed a different person than the comment above it.This writes the same effective author into the field, and uses it for the duplicate check so a copilot replying twice still counts as one commenter. Ordinary comments are unaffected, and the new parameter defaults to the previous behaviour so other callers are untouched.
The API now stores the copilot in this field for new replies, so once the server responds the summary is already correct. This change makes the pending and offline states match it, so the avatar no longer flips to the account acted for while a reply is in flight.
Fixed Issues
$ #98573
PROPOSAL: #98573 (comment)
Tests
Requires two accounts with a Full copilot relationship and different avatars.
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari