feat: enable chat sharing - #24987
Conversation
d444306 to
2d9652d
Compare
e042cb8 to
2ae63e4
Compare
100cc49 to
a001ff0
Compare
a17dd8a to
c6170a4
Compare
a001ff0 to
baeaf16
Compare
ab613c7 to
e005315
Compare
baeaf16 to
806e74d
Compare
e005315 to
4d00998
Compare
806e74d to
f77ce50
Compare
04d428d to
3eb0e2e
Compare
|
/coder-agents-review |
7f45110 to
fbb5847
Compare
997fc49 to
b3c954b
Compare
52f8308 to
8f9483a
Compare
b3c954b to
bc38364
Compare
8f9483a to
bdfd540
Compare
bc38364 to
04709b3
Compare
257580b to
e65ee30
Compare
04709b3 to
c90b664
Compare
e65ee30 to
4161734
Compare
c90b664 to
2e9d542
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
Clean feature PR. The authorization model is well-designed: ActionUpdate gates writes, ActionShare gates ACL changes, and the owner-only guard on postChatMessages prevents credential leakage. Test coverage is thorough across all three layers (API client, query factory, Storybook). Component reuse from the workspace sharing module is a good call.
The strongest convergence across the panel is on the stale mutation error state (DEREM-2, flagged by 9 reviewers independently). The split-table accessibility issue (DEREM-3) and the table layout duplication from WorkspaceSharingForm (DEREM-8) also saw multiple reviewers.
Severity breakdown: 9 P3, 5 Nit, 4 Note. No blocking findings.
"The operator sees an error banner alongside a success toast." (Chopper, on the stale mutation state)
🤖 This review was automatically generated with Coder Agents.
4144eda to
9c71ded
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
Re-review of the fix commit (4144eda94c). 12 of the original 18 findings are fixed; all verified by Netero and the panel. 5 contested findings were evaluated by the panel and closed (author defenses accepted). Two new findings emerged.
The fixes are thorough. The mutation error reset lifecycle is well-designed (ref-gated reset on open, explicit clear before each mutation, two stories covering cross-type and cross-session scenarios). The split-table accessibility fix uses a single semantic table with sticky headers. The prop rename, toast messages, and convention fixes are all clean.
DEREM-20 is a regression introduced by the DEREM-13 fix: isLoading || isFetching causes the input to disable and banner to disappear on every background refetch (tab switch), not just the initial load. Two reviewers converged on this independently.
Severity breakdown: 2 new P3, 1 new Note. No blocking findings.
"Every tab switch triggers this cycle. An admin typing in another user's chat gets their cursor kicked out of the input momentarily." (Mafuuu)
🤖 This review was automatically generated with Coder Agents.
| }, | ||
| }; | ||
|
|
||
| export const RemoveUser: Story = { |
There was a problem hiding this comment.
P3 [DEREM-19] RemoveUser and RemoveGroup stories skip toast verification.
AddUser and AddGroup include decorators: [withToaster] and assert their success toasts. RemoveUser and RemoveGroup omit both. The production code calls toast.success("Member removed from chat.") and toast.success("Group removed from chat.") on remove success. Without the toaster decorator and an assertion, these stories would pass even if the toast calls were removed.
Fix: add decorators: [withToaster] and assert the toast text in both stories.
(Bisky P3)
🤖
There was a problem hiding this comment.
🤖 This comment was written by Coder Agent on behalf of Danielle Maywood 🤖
Fixed in 6a4a93db0fe236f57a303fb3f051308370e0a11b. Added toaster coverage to the remove stories and asserted both remove success messages.
| canUpdateOtherUserChatQuery.data?.canUpdateChat, | ||
| ); | ||
| const canUpdateOtherUserChatLoading = | ||
| canUpdateOtherUserChatQuery.isLoading || |
There was a problem hiding this comment.
P3 [DEREM-20] Background refetches disable input and suppress banner via isFetching.
canUpdateOtherUserChatLoading uses isLoading || isFetching (lines 865-866). In TanStack Query v5, isFetching is true during background refetches (window focus, staleTime: 0). When it fires:
canUpdateOtherUserChatLoadingbecomes true.isInputDisabledevaluates true. Input locks.chatOwnerWarninghits the loading guard and returnsundefined. Banner disappears.- Refetch completes (~200ms). Input re-enables, banner reappears.
Every tab switch triggers this cycle. An admin typing in another user's chat gets their cursor kicked momentarily. A read-only viewer's banner flickers.
Compare with canShareChat, which uses canShareChatQuery.data directly with no loading guard and has no jitter.
Fix: replace isLoading || isFetching with just isLoading. isLoading is true only on the first fetch with no cached data, which is the only case where the permission is genuinely unknown.
(Mafuuu P3, Pariston P3)
🤖
There was a problem hiding this comment.
🤖 This comment was written by Coder Agent on behalf of Danielle Maywood 🤖
Fixed in 6a4a93db0fe236f57a303fb3f051308370e0a11b. Treating only the initial authorization load as unknown so background refetches no longer disable input or hide the owner warning.
| const chatOwnerQuery = useQuery({ | ||
| ...userQuery(chatRecord?.owner_id ?? ""), | ||
| enabled: isViewerNotOwner && !isArchived, | ||
| const canUpdateOtherUserChatQuery = useQuery({ |
There was a problem hiding this comment.
Note [DEREM-21] Two separate checkAuthorization HTTP requests for the same chat resource object.
canUpdateOtherUserChatQuery (line 846) and canShareChatQuery (line 869) both construct identical object: { resource_type: "chat", owner_id, organization_id } but fire as separate roundtrips. The checkAuthorization API accepts multiple checks in one request. For a non-owner viewer of a root non-archived chat, both fire, doubling authz latency. At current scale this is invisible; worth combining if shared chats see significant traffic.
(Hisoka P3)
🤖
There was a problem hiding this comment.
🤖 This comment was written by Coder Agent on behalf of Danielle Maywood 🤖
Fixed in 6a4a93db0fe236f57a303fb3f051308370e0a11b. Batched the update and share authorization checks into one authcheck request for the chat object.
|
/coder-agents-review |
There was a problem hiding this comment.
Round 3 re-review. All three R2 findings (DEREM-19, 20, 21) are fixed and verified by all 4 panel reviewers. The authz consolidation (DEREM-21) is well-designed: dynamic check batching with a clean enabled guard. The isFetching-to-isLoading fix (DEREM-20) eliminates the background refetch flicker at root cause. Toast assertions (DEREM-19) are now in place.
One new P3 finding from the test coverage audit. 21 of 22 findings across 3 rounds are now resolved.
"I traced the authorization flow through AgentChatPage.tsx lines 844-885 ... This is correct." (Pariston, verifying the DEREM-21 fix)
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
Round 4. All 22 findings across 4 rounds are resolved. DEREM-22 (archived root chat sharing) is addressed with a documenting story. CI is green.
Final tally: 15 fixed by author, 5 closed by panel (author defenses accepted), 1 acknowledged, 1 dropped by orchestrator. No open findings remain.
The PR is in good shape for human review and merge.
🤖 This review was automatically generated with Coder Agents.
629c9ec to
4b389f6
Compare
Note
🤖 This PR was written by Coder Agent on behalf of Danielle Maywood
Depends on #24968.
Adds frontend chat sharing controls for experimental Coder Agents chats. Authorized users can open the chat actions menu on root chats, add users or groups with read-only access, remove existing ACL entries, and see shared or read-only chat ownership state in the agents UI.
Implementation plan