From 7d7c7e72d9d5f59b2eccea465c088afc4b6cde04 Mon Sep 17 00:00:00 2001 From: Jackson Miller Date: Sun, 1 Nov 2026 21:42:20 -0500 Subject: [PATCH] fix(mobile): an answered question reads as its question, answer and who gave it Opening a resolved native question drew its raw item JSON under the readable answer, and in the folded row a long question pushed the answer out of the one truncating label, leaving only the question. An answered question's opened row now stops at its question and answer, as on web, and the folded row keeps the answer and who gave it outside the label so the question truncates first. Closes #891 Closes #869 Co-Authored-By: Claude Opus 5.5 --- FORK.md | 2 +- .../src/features/threads/thread-work-log.tsx | 27 +++++++++---------- .../src/j5/sharing/sharedConversation.tsx | 25 +++++++++++------ apps/mobile/src/j5/upstreamSeams.test.ts | 4 +-- apps/mobile/src/lib/filePreview.test.ts | 2 +- 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/FORK.md b/FORK.md index 71528164db1a6..853cb1e160cf9 100644 --- a/FORK.md +++ b/FORK.md @@ -513,7 +513,7 @@ migrations after upstream migrations. 98. Mobile reads artifacts ([#833](https://github.com/Jacksondr5/j5code/issues/833)), landing two reserved mobile seams. Route registration: `apps/mobile/src/Stack.tsx` imports J5-owned `j5ThreadArtifactRoutes` (`apps/mobile/src/j5/artifacts/routes.ts`) and spreads it after `ThreadFile`, adding the thread-scoped `ThreadArtifacts` list and `ThreadArtifact` viewer (`apps/mobile/src/j5/artifacts/ThreadArtifactsScreen.tsx`), read-only, with no delete. Link resolver: `onMarkdownLinkPress` in `apps/mobile/src/features/threads/ThreadFeed.tsx` makes one call to J5-owned `openArtifactLink` before its thread, media and file branches, so an `artifacts/…` link opens the viewer instead of a missing workspace file; its `fileContextMenu` and `onFileContextMenuAction` each make one call first (`artifactLinkContextMenu`, `onArtifactLinkMenuAction`), so an artifact link's long press offers Open artifact and Copy path instead of workspace-file actions. Links inside a Markdown artifact go through the same helpers in the J5 viewer. Recognition, preview kind and the HTTP read are shared with web in `packages/client-runtime/src/j5/artifacts.ts`. No upstream entry point reaches the list yet; it is one tap from any opened artifact. -99. Mobile's shared conversations show who wrote each message and who answered each prompt, the mobile half of case 80 ([#832](https://github.com/Jacksondr5/j5code/issues/832), register D33, Shared conversations AC9 to AC11, AC14 and AC16). The record and its change feed are `threadAuthors` and `threadAuthorsChanges` in `packages/client-runtime/src/j5/sharing.ts`, beside who reaches the thread (`scopePeople` and `scopePeopleChanges`), which says the thread is shared before any author is recorded (`mayBeSharedConversation`, [#871](https://github.com/Jacksondr5/j5code/issues/871)); and the reading of it (`sharedMessageView`, the typed text, the answers without their mark, the search label) is `packages/client-runtime/src/j5/sharedConversation.ts`, both shared with web. `apps/mobile/src/features/threads/ThreadRouteScreen.tsx` imports `useSharedConversationFeed` from J5-owned `apps/mobile/src/j5/sharing/sharedConversation.tsx` and passes its answer as `ThreadDetailScreen`'s `selectedThreadFeed` in place of `composer.selectedThreadFeed`: an authored message shows as typed, after its note to the agent as a muted line that opens (drawn by case 97's `renderJ5TimelineNotice`), a message whose author is not read yet is held back or shown as this client typed it, and a question's answers lose the platform's `[Answer from …]` mark. Case 97's `useJ5Timeline` also reads the record, so `resolveJ5FeedMessage` puts another person's message on the left and `J5MessageAuthorLine` names them, or says who edited the reader's own. `apps/mobile/src/features/threads/thread-work-log.tsx` mounts `PromptAnsweredBy` after a work row's label (" · answered by Priya" on a settled question or approval). `apps/mobile/src/features/threads/ThreadQueueControl.tsx` reads its rows through `useSharedQueuedRuns`, so a queued message's row and the text an edit loads are the words typed. `apps/mobile/src/features/threads/thread-search-match.tsx` labels a hit with `threadSearchMatchLabel` instead of "You:" for every user-role hit. `apps/mobile/src/lib/filePreview.test.ts` mocks `sharedConversation.tsx` as it mocks case 97's `timelineState.ts`. Proofs: `apps/mobile/src/j5/sharing/sharedConversationFeed.test.ts`, `apps/mobile/src/j5/a2a/timelinePresentation.test.ts`, `packages/client-runtime/src/j5/sharedConversation.test.ts`, `packages/client-runtime/src/j5/threadSearchMatchLabel.test.ts`, and the four files' rows in `apps/mobile/src/j5/upstreamSeams.test.ts`. On every rebase, keep the calls that test lists. +99. Mobile's shared conversations show who wrote each message and who answered each prompt, the mobile half of case 80 ([#832](https://github.com/Jacksondr5/j5code/issues/832), register D33, Shared conversations AC9 to AC11, AC14 and AC16). The record and its change feed are `threadAuthors` and `threadAuthorsChanges` in `packages/client-runtime/src/j5/sharing.ts`, beside who reaches the thread (`scopePeople` and `scopePeopleChanges`), which says the thread is shared before any author is recorded (`mayBeSharedConversation`, [#871](https://github.com/Jacksondr5/j5code/issues/871)); and the reading of it (`sharedMessageView`, the typed text, the answers without their mark, the search label) is `packages/client-runtime/src/j5/sharedConversation.ts`, both shared with web. `apps/mobile/src/features/threads/ThreadRouteScreen.tsx` imports `useSharedConversationFeed` from J5-owned `apps/mobile/src/j5/sharing/sharedConversation.tsx` and passes its answer as `ThreadDetailScreen`'s `selectedThreadFeed` in place of `composer.selectedThreadFeed`: an authored message shows as typed, after its note to the agent as a muted line that opens (drawn by case 97's `renderJ5TimelineNotice`), a message whose author is not read yet is held back or shown as this client typed it, and a question's answers lose the platform's `[Answer from …]` mark. Case 97's `useJ5Timeline` also reads the record, so `resolveJ5FeedMessage` puts another person's message on the left and `J5MessageAuthorLine` names them, or says who edited the reader's own. `apps/mobile/src/features/threads/thread-work-log.tsx` mounts `PromptAnswerTail` after a work row's label: a question's answer and who gave it (" · answered by Priya", on an approval too), outside the label so the question truncates first. An answered question's opened row no longer draws the raw item JSON beneath its question and answer, as web draws neither ([#891](https://github.com/Jacksondr5/j5code/issues/891)). `apps/mobile/src/features/threads/ThreadQueueControl.tsx` reads its rows through `useSharedQueuedRuns`, so a queued message's row and the text an edit loads are the words typed. `apps/mobile/src/features/threads/thread-search-match.tsx` labels a hit with `threadSearchMatchLabel` instead of "You:" for every user-role hit. `apps/mobile/src/lib/filePreview.test.ts` mocks `sharedConversation.tsx` as it mocks case 97's `timelineState.ts`. Proofs: `apps/mobile/src/j5/sharing/sharedConversationFeed.test.ts`, `apps/mobile/src/j5/a2a/timelinePresentation.test.ts`, `packages/client-runtime/src/j5/sharedConversation.test.ts`, `packages/client-runtime/src/j5/threadSearchMatchLabel.test.ts`, and the four files' rows in `apps/mobile/src/j5/upstreamSeams.test.ts`. On every rebase, keep the calls that test lists. 100. The mobile new-task composer gives a saved agent its own row and lets the slash menu cover the draft rows ([#866](https://github.com/Jacksondr5/j5code/issues/866), Jackson's direction at Checkpoint 1, 2026-11-01; register entry in the wave-2 docs PR). Upstream's composer shows the model in its input row and opens the slash menu above everything stacked over the input. In `apps/mobile/src/features/threads/NewTaskDraftScreen.tsx`, the draft controls render J5-owned `j5/agents/DraftAgentRow.tsx` under the checkout row: the saved-agent picker, then the chosen agent's persona, route and remove action. `apps/mobile/src/features/threads/ThreadComposer.tsx` renders the persona lock control only when `!props.isDraft`, so a draft's input row stays the editor, and wraps `ComposerPopoverAnchor` in a zero-height `relative` view placed after `draftControls`. The anchor's `bottom-full` (and the Android anchor's measured frame) then starts at the top of the input, so the menu draws over the checkout and agent rows instead of above them. A started thread has no draft controls, so its menu opens where it did. diff --git a/apps/mobile/src/features/threads/thread-work-log.tsx b/apps/mobile/src/features/threads/thread-work-log.tsx index 22c6dd8516439..5894f47061a70 100644 --- a/apps/mobile/src/features/threads/thread-work-log.tsx +++ b/apps/mobile/src/features/threads/thread-work-log.tsx @@ -60,7 +60,7 @@ import { useMarkdownCodeHighlight } from "./markdownCodeHighlightState"; import { AppText as Text } from "../../components/ui/AppText"; import { J5Wordmark } from "../../j5/branding/J5Wordmark"; -import { PromptAnsweredBy } from "../../j5/sharing/sharedConversation"; +import { PromptAnswerTail } from "../../j5/sharing/sharedConversation"; import { BrowserAppIcon } from "./BrowserAppIcon"; import { useAppActive, useReduceMotionEnabled } from "../../lib/appState"; import { cn } from "../../lib/cn"; @@ -975,8 +975,9 @@ const ThreadWorkLogRow = function ThreadWorkLogRow( call && shownItem.type === "command_execution" && shownItem.exitCode ? shownItem.exitCode : null; + // J5 (case 99): an answered question reads as its question and answer, not as its raw item. const fullDetail = - expanded && !reasoning && !call + expanded && !reasoning && !call && !row.workEntry.questionAnswer ? fetchedItem && !isRead ? formatItemFullDetail(row.projectedItem, fetchedItem) : row.getFullDetail() @@ -1009,6 +1010,8 @@ const ThreadWorkLogRow = function ThreadWorkLogRow( const answerPreview = row.workEntry.questionAnswer ? getQuestionAnswerPreview(row.workEntry.questionAnswer) : null; + const answered = + row.workEntry.questionAnswer !== undefined && hasQuestionAnswer(row.workEntry.questionAnswer); const accessiblePreview = [previewText, answerPreview].filter(Boolean).join(": "); const displayText = row.groupStandIn?.label ?? workEntryRowLabel(row.workEntry, expanded); const isSystemNotice = row.projectedItem.item.type === "system_notice"; @@ -1097,20 +1100,16 @@ const ThreadWorkLogRow = function ThreadWorkLogRow( tone={isUsageLimit ? "warning" : iconIsDestructive ? "danger" : "default"} > {displayText} - {answerPreview ? ( - {` ${answerPreview}`} + {answerPreview && !answered ? ( + {` ${answerPreview}`} ) : null} - {/* J5 (case 99): who answered a settled prompt; outside the label so it never truncates. */} - + {/* J5 (case 99): the answer and who gave it, outside the label so the question truncates first. */} + )} diff --git a/apps/mobile/src/j5/sharing/sharedConversation.tsx b/apps/mobile/src/j5/sharing/sharedConversation.tsx index 9a9a70f9b1fbd..6ccc23af12bd7 100644 --- a/apps/mobile/src/j5/sharing/sharedConversation.tsx +++ b/apps/mobile/src/j5/sharing/sharedConversation.tsx @@ -133,19 +133,28 @@ export function useSharedConversationFeed( } /** - * Who answered one of the agent's prompts, after the prompt's own line: " · answered by Priya". - * Nothing for a prompt nobody is recorded as answering, or one still open (AC10). + * The end of a work row for one of the agent's prompts: the answer, then who gave it (AC10). The + * question truncates before either. Who is drawn only for a prompt someone is recorded as answering. */ -export function PromptAnsweredBy(props: { +export function PromptAnswerTail(props: { readonly environmentId: EnvironmentId; readonly item: { readonly threadId: ThreadId }; + readonly answer: string | null; }) { const { answers } = useThreadAuthorIndex(props.environmentId, props.item.threadId); - const answer = isSettledPrompt(props.item) ? answers.get(props.item.requestId) : undefined; - if (answer === undefined) return null; + const by = isSettledPrompt(props.item) ? answers.get(props.item.requestId) : undefined; return ( - - · answered by {answer.you ? "you" : (answer.name ?? "someone")} - + <> + {props.answer === null ? null : ( + + {props.answer} + + )} + {by === undefined ? null : ( + + · answered by {by.you ? "you" : (by.name ?? "someone")} + + )} + ); } diff --git a/apps/mobile/src/j5/upstreamSeams.test.ts b/apps/mobile/src/j5/upstreamSeams.test.ts index 82d770b3ae2e0..04e49b07b079b 100644 --- a/apps/mobile/src/j5/upstreamSeams.test.ts +++ b/apps/mobile/src/j5/upstreamSeams.test.ts @@ -151,9 +151,7 @@ const SEAMS: ReadonlyArray = [ file: "features/threads/thread-work-log.tsx", record: "case 99: answered by", from: "../../j5/sharing/sharedConversation", - reaches: [ - "", - ], + reaches: [" ({ sharedAuthors: new Map(), }), })); -vi.mock("../j5/sharing/sharedConversation", () => ({ PromptAnsweredBy: () => null })); +vi.mock("../j5/sharing/sharedConversation", () => ({ PromptAnswerTail: () => null })); vi.mock("../j5/sharing/startAccess", () => ({ useCanForkThread: () => true })); vi.mock("../state/threads", () => ({ environmentThreadShells: {}, threadEnvironment: {} })); vi.mock("../state/entities", () => ({