Skip to content

Commit 151cbdc

Browse files
fix(mobile): address Macroscope findings on feel-faster paths
Keep closed-PR comment/edit actions, wait for linked threads before ask, refresh draft/script chrome fingerprints, and fix stream keys plus work-log copy feedback. Co-authored-by: Cursor <[email protected]>
1 parent dc7fe2e commit 151cbdc

10 files changed

Lines changed: 55 additions & 17 deletions

‎apps/mobile/src/features/layout/workspace/workspace-detail-selection.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const options = {
3232
"Settings",
3333
"SettingsAppearance",
3434
"GitOverview",
35+
"AddProject",
36+
"AddProjectLocal",
3537
],
3638
routeParamList: {},
3739
routeGetIdList: {},
@@ -129,6 +131,12 @@ describe("selectWorkspaceDetail", () => {
129131
setNativelyPoppingWorkspaceRoute(null);
130132
}
131133
});
134+
135+
it("resets instead of pushing when a creation overlay is already open", () => {
136+
const creating = push(push(home(), "AddProject"), "AddProjectLocal");
137+
const opened = select(creating, threadA);
138+
expect(page(opened)).toEqual({ names: ["Home", "Thread"], index: 1 });
139+
});
132140
});
133141

134142
describe("workspaceDetailLinkAction", () => {

‎apps/mobile/src/features/layout/workspace/workspace-detail-selection.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ function canPushWorkspaceDetail<
9494
>(state: State, sheet: WorkspaceDetailSheet | undefined, popping: string | null) {
9595
// A native Back in flight must go through RESET so we don't push on top of the leaving card.
9696
if (sheet || popping) return false;
97-
const { workspace } = workspaceRoutesOf(state.routes.slice(0, state.index + 1));
98-
return workspace.length === 1 && workspace[0]?.name === "Home";
97+
const { workspace, overlays } = workspaceRoutesOf(state.routes.slice(0, state.index + 1));
98+
// Overlay stacks (Add project, New task picker) must RESET so Back does not return into them.
99+
return overlays.length === 0 && workspace.length === 1 && workspace[0]?.name === "Home";
99100
}
100101

101102
/** Root stack router overrides that handle `selectWorkspaceDetail`. */

‎apps/mobile/src/features/pull-requests/PullRequestControls.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ export function PullRequestActionToolbar(props: {
139139
// Keep the bar mounted from the list summary so PR→diff does not blank chrome.
140140
if (!props.pr && !props.params.initialSummary) return null;
141141
const primaryDisabled = pendingReview ? false : agent.disabled;
142-
const showPrimary = pendingReview || canOpenThread || Boolean(props.params.initialSummary);
142+
// Keep the bar for initialSummary, but do not offer Work on PR until detail exists.
143+
const showPrimary = pendingReview || canOpenThread;
143144
if (Platform.OS === "android") {
144145
const primary = (
145146
<Button

‎apps/mobile/src/features/pull-requests/pull-request-actions-menu.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,18 @@ export function buildPullRequestActionsMenu(
131131
handlers: PullRequestActionsMenuHandlers,
132132
): AppBarMenu {
133133
const items: AppBarMenuItem[] = [];
134+
// Reviews only apply to open change requests; comment/title/description can stay on closed ones.
134135
if (model.open && model.identity) {
136+
items.push({
137+
id: "submit-review",
138+
title: "Submit review",
139+
icon: "text.bubble",
140+
disabled: !model.canSubmitReview,
141+
onPress: handlers.onSubmitReview,
142+
});
143+
}
144+
if (model.identity) {
135145
items.push(
136-
{
137-
id: "submit-review",
138-
title: "Submit review",
139-
icon: "text.bubble",
140-
disabled: !model.canSubmitReview,
141-
onPress: handlers.onSubmitReview,
142-
},
143146
{
144147
id: "add-comment",
145148
title: "Add comment",

‎apps/mobile/src/features/pull-requests/usePullRequestAgentActions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export function usePullRequestAgentActions(
1919
const disabled = links.busy || (!pr && !params.initialSummary);
2020
const start = (task: PullRequestAgentTask, threadId?: string) => {
2121
if (disabled) return;
22+
// Wait for the first linked-threads result so cold opens do not invent a duplicate draft.
23+
if (pr && links.isPending && !threadId) return;
2224
const thread = pullRequestAgentThread(links.threads, threadId);
2325
if (threadId && threadId !== "new" && !thread) return;
2426
if (task === "ask" && thread && (!links.canAsk || thread.archivedAt)) {

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,17 @@ export function NewTaskDraftScreen(props: NewTaskDraftScreenProps) {
944944
<>
945945
<ThreadScreenBinding
946946
environmentId={selectedProject.environmentId}
947-
// Same key as the open shell so git/files chrome is not torn down mid-push.
948-
headerKey={["new-task", "chrome"]}
947+
// Include the draft target so Files/git follow a project or workspace switch.
948+
headerKey={[
949+
"new-task",
950+
"chrome",
951+
selectedProject.environmentId,
952+
selectedProject.id,
953+
flow.workspaceMode,
954+
flow.selectedBranchName ?? "",
955+
flow.selectedWorktreePath ?? "",
956+
composerWorkspaceCwd ?? "",
957+
]}
949958
header={
950959
<DraftThreadHeader thread={thread} project={selectedProject} cwd={composerWorkspaceCwd} />
951960
}

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,9 @@ function AssistantMarkdownBlocks(props: {
12801280
return streamParts.map((part, partIndex) => {
12811281
if (part.trim().length === 0) return null;
12821282
const settled = !trailing || partIndex < streamParts.length - 1;
1283-
// Prefix length is stable for finished stream blocks; the live tail uses "live".
1283+
// Prefix length alone collides when two settled parts share a length; index is stable.
12841284
const partKey = settled
1285-
? `markdown:${offset}:settled:${part.length}`
1285+
? `markdown:${offset}:settled:${partIndex}`
12861286
: `markdown:${offset}:live`;
12871287
return settled ? (
12881288
<SettledMarkdownText

‎apps/mobile/src/features/threads/ThreadGitControls.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export function threadGitControlsContentKey(props: ThreadGitControlsMenuKeyInput
154154
status?.pr?.state ?? "",
155155
String(status?.pr?.number ?? ""),
156156
status?.sourceControlProvider?.kind ?? "",
157+
// Script edits keep the same id; include fields so the retained menu runs the new command.
158+
props.projectScripts
159+
.map((script) => `${script.id}\t${script.name}\t${script.command}\t${script.icon}`)
160+
.join("\0"),
157161
props.terminalSessions
158162
.map(
159163
(session) =>

‎apps/mobile/src/features/threads/ThreadRouteScreen.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,15 @@ interface ThreadRouteScreenProps extends ThreadRouteScreenRouteProps {
187187
function ThreadUnavailableScreen(props: {
188188
readonly actionLabel: string;
189189
readonly onAction: () => void;
190+
readonly environmentId?: string | null;
191+
readonly threadId?: string | null;
190192
}) {
191193
return (
192-
<ThreadRouteFallbackLayout>
194+
<ThreadRouteFallbackLayout
195+
environmentId={props.environmentId}
196+
threadId={props.threadId}
197+
title="Thread unavailable"
198+
>
193199
<ScrollView
194200
contentInsetAdjustmentBehavior="automatic"
195201
contentContainerStyle={{
@@ -519,6 +525,8 @@ function LiveThreadRouteController(props: ThreadRouteScreenProps) {
519525

520526
return withInspectorHeader(
521527
<ThreadUnavailableScreen
528+
environmentId={environmentIdRaw}
529+
threadId={threadIdRaw}
522530
actionLabel={
523531
routeEnvironmentRuntime === null ? "Manage environments" : "Reconnect environment"
524532
}

‎apps/mobile/src/features/threads/thread-work-log.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ export function ThreadWorkLog(props: ThreadWorkLogProps) {
534534
{props.activities[0]?.groupedToolDetail ? (
535535
<ThreadWorkGroupList
536536
activities={props.activities}
537+
copiedRowId={props.copiedRowId}
537538
edgeFadeColor={props.edgeFadeColor}
538539
expandedRows={props.expandedRows}
539540
groupId={props.anchorKey}
@@ -599,6 +600,7 @@ function ThreadReasoningGroup(props: {
599600

600601
function ThreadWorkGroupList(props: {
601602
readonly activities: ReadonlyArray<ThreadFeedActivity>;
603+
readonly copiedRowId: string | null;
602604
readonly edgeFadeColor: string;
603605
readonly expandedRows: Readonly<Record<string, boolean>>;
604606
readonly groupId: string;
@@ -748,8 +750,8 @@ function ThreadWorkGroupList(props: {
748750
}
749751
// Nested expand/measure needs stable cells; recycle remounts break append height.
750752
recycleItems={false}
751-
// Expand map only — renderRow identity would invalidate every row on each feed tick.
752-
extraData={props.expandedRows}
753+
// Expand + copy feedback — renderRow identity would invalidate every row on each feed tick.
754+
extraData={{ expandedRows: props.expandedRows, copiedRowId: props.copiedRowId }}
753755
renderItem={renderItem}
754756
sharedValues={sharedValues}
755757
onLayout={finishPendingAppend}

0 commit comments

Comments
 (0)