Repository navigation
📺 feat: Render Followed Chats With Main Chat's Message List - #18193
Conversation
f7dd788 to
33c9d5b
Compare
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33c9d5b546
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <ScreenMessages | ||
| messagesTree={messagesTree} | ||
| messages={messages} | ||
| slots={listSlots} | ||
| primary={false} |
There was a problem hiding this comment.
Propagate read-only mode to the followed message renderer
When a followed conversation is rendered with the app's message hosts, ScreenMessages installs MessagesViewProvider, which unconditionally sets readOnly: false. Making the contract's submission handlers inert does not disable actions that bypass them: for a non-subagent conversation, the row's Edit → Save action calls useUpdateMessageMutation directly and persists changes, while embedded MCP apps see a writable view and enable authenticated tool/resource operations through useAppBridge. Thus the supposedly display-only thread still permits writes and host-bound actions. Propagate an explicit read-only mode through the view provider and row controls rather than relying solely on no-op submission handlers.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid. Fixed in a8889397b2 (import order in a4e1169d5f). Read-only is now part of the contract a followed thread hands its rows, not only a set of inert handlers:
ChatContract.readOnlyis set byuseFollowedContract.MessagesViewProviderreports it, souseIsMessagesViewReadOnly()is true inside a followed thread and the host-bound actions that read it (the MCP app bridge and frame, error recovery) stay off.- The row controls honor it: no regenerate or continue, and the edit button is hidden, so Edit → Save cannot be reached.
The contract field and the row-control gating were in #18196, two PRs up; they moved down into this one so the followed view is read-only from the PR that introduces it. #18196 keeps the tool-call-limit notice. Pinned by tells its rows the view is read-only, so host-bound actions in them stay off in pane/__tests__/followed.spec.tsx (fails with the provider left at readOnly: false), plus the moved generations and HoverButtons cases.
33c9d5b to
a888939
Compare
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
f3978de to
e543239
Compare
e543239 to
98f9682
Compare
98f9682 to
b808869
Compare
b808869 to
0bcddea
Compare
0bcddea to
1d0ffce
Compare
1d0ffce to
812db7a
Compare
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Main chat's message list (
MessagesView, its thread, rows and parts) reads aChatContractfromChatContext, and the only thing that produces one is the hooks session (useChatHelpers), which is bound to the app's pane store, route and composer. A conversation held by aChattherefore has nothing to render it with except hand-built rows, which is how the subagent panel ended up with its own transcript.This adds the adapter and the component that close that gap for a conversation the reader follows rather than drives.
useFollowedContractbuilds theChatContractthe rows read from a followedChat(#18192), andFollowedThreadmounts main chat's own list under it. The rows, parts, scrolling and progressive mounting are the ones main chat uses, not copies.Fifth in a stack, on #18192. The subagent panel mounts it in the next PR; nothing in the app renders it yet.
How it works
The contract's reads are real and its writes are inert, because the reader takes no turn in a followed conversation. Inert handlers alone would leave actions that bypass them, so the contract also says so:
ChatContract.readOnly, optional and absent for a chat the reader drives. Where it is set, a row offers no regenerate, edit or continue (copy and fork stay: a fork makes a conversation of the reader's own), andMessagesViewProviderreports the view as read-only, which is what the MCP app bridge and frame and the error-recovery prompts read throughuseIsMessagesViewReadOnly()before offering a host-bound action. The tail of the branch on screen comes fromuseBranchTailSelectover the conversation's cache entry, the projectionuseChatHelpersuses, so it does not re-render per streamed token.Three of the list's slots are empty by default here: the pending turn and pending steers (the reader has neither in a conversation they do not drive) and the navigation rail (the surface sits beside a chat). A host can supply any of them through
slots.indexis a required argument. The package's own state for rows is keyed by conversation, but a host may key per-pane state by it, so the host passes a pane number no driven chat renders into.FollowedThreadloads throughloadFollowedThread, the same dynamic import asloadScreenMessages, so the message renderer stays out of the components entry.Type of change
Testing
Tested environments/configuration:
jsdom, with a real
QueryClient, a realChatthroughuseFollowChat, and the package's real thread and row components; the transport and the two body slots are test doubles. Not yet seen in a browser: there is no app surface that mounts it until the next PR.Automated tests:
packages/chat/src/components/pane/__tests__/followed.spec.tsx(6 cases): a stored conversation drawn by the real thread with the contract the rows read (messagesKey,latestMessageId,isSubmitting,getMessages); a running generation drawn as it streams and then as its stored result, withisSubmittingfollowing it; send, regenerate and stop reaching neither the transport nor the list; the navigation rail absent by default and present when a host supplies one; nomessages-endid or screenshot target written; the view reported read-only inside the list (fails with the provider left atreadOnly: false).generations.spec.ts: the same message offers rerun, edit and continue when driven, and none of them (fork still offered) when read-only.HoverButtons.spec.tsx: a read-only chat draws Copy and neither Regenerate nor Edit.npx jest src/components/pane src/components/messages/threadinpackages/chatplusMessagesView.spec.tsxand the thread specs (110 tests);npx tsc --noEmit;npm run static-checks -- --against origin/dev.Screenshots / recordings
No user-facing change in this PR: the component has no caller in the app. The panel PR that mounts it carries the captures.
Risk / compatibility
MessagesViewis main chat's component and gains one prop.primarydefaults totrue, which is today's output exactly; a followed thread passesfalse. The reason is two page-wide hooks the list writes:id="messages-end", whichgetMainScrollContainer(keyboard shortcuts) andscrollToEndfind withdocument.getElementById, anddata-testid="screenshot-target", which the export path's host ref and several e2e specs look up. A second list on the page would duplicate both, so a non-primary list writes neither and does not take the host's screenshot ref.readOnlyis absent for every chat the app renders today, so main chat, the added pane and the shared view offer what they did.Everything else is additive.