@@ -150,7 +150,6 @@ export function NewTaskDraftScreen(props: { |
150 | 150 | readonly worktreePath?: string | null; |
151 | 151 | readonly cloning?: boolean; |
152 | 152 | }; |
153 | | - readonly pendingTaskId?: string; |
154 | 153 | readonly draftId?: string; |
155 | 154 | readonly incomingShareId?: string; |
156 | 155 | }) { |
@@ -386,11 +385,11 @@ export function NewTaskDraftScreen(props: { |
386 | 385 | }; |
387 | 386 | }, []); |
388 | 387 |
|
389 | | - const { beginEditingPendingTask, cancelEditingPendingTask, editingPendingTask, openDraft } = flow; |
| 388 | + const { openDraft } = flow; |
390 | 389 | // Cold launches load drafts and projects separately; wait for hydration and retry while shells load. |
391 | 390 | const attemptedDraftIdRef = useRef<string | null>(null); |
392 | 391 | useEffect(() => { |
393 | | - if (!props.draftId || props.pendingTaskId) { |
| 392 | + if (!props.draftId) { |
394 | 393 | return; |
395 | 394 | } |
396 | 395 | const draftId = props.draftId; |
@@ -415,34 +414,12 @@ export function NewTaskDraftScreen(props: { |
415 | 414 | return () => { |
416 | 415 | cancelled = true; |
417 | 416 | }; |
418 | | - }, [navigation, openDraft, projects, props.draftId, props.pendingTaskId]); |
419 | | - |
420 | | - const attemptedPendingTaskIdRef = useRef<string | null>(null); |
421 | | - useEffect(() => { |
422 | | - if (!props.pendingTaskId || editingPendingTask?.messageId === props.pendingTaskId) { |
423 | | - return; |
424 | | - } |
425 | | - if (attemptedPendingTaskIdRef.current === props.pendingTaskId) { |
426 | | - return; |
427 | | - } |
428 | | - attemptedPendingTaskIdRef.current = props.pendingTaskId; |
429 | | - if (!beginEditingPendingTask(props.pendingTaskId)) { |
430 | | - navigation.dispatch(CommonActions.navigate("NewTaskProject")); |
431 | | - } |
432 | | - }, [beginEditingPendingTask, editingPendingTask?.messageId, navigation, props.pendingTaskId]); |
433 | | - |
434 | | - useEffect(() => { |
435 | | - if (!props.pendingTaskId) return; |
436 | | - return () => { |
437 | | - attemptedPendingTaskIdRef.current = null; |
438 | | - cancelEditingPendingTask(); |
439 | | - }; |
440 | | - }, [props.pendingTaskId, cancelEditingPendingTask]); |
| 417 | + }, [navigation, openDraft, projects, props.draftId]); |
441 | 418 |
|
442 | 419 | const lastInitialProjectRefRef = useRef(props.initialProjectRef); |
443 | 420 |
|
444 | 421 | useEffect(() => { |
445 | | - if (props.pendingTaskId || props.draftId) { |
| 422 | + if (props.draftId) { |
446 | 423 | return; |
447 | 424 | } |
448 | 425 | if (lastInitialProjectRefRef.current !== props.initialProjectRef) { |
@@ -516,9 +493,8 @@ export function NewTaskDraftScreen(props: { |
516 | 493 | projects, |
517 | 494 | flow.draftKey, |
518 | 495 | props.initialProjectRef, |
519 | | - // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening a draft from a share, pending task, or draft id re-resolves its project. |
| 496 | + // oxlint-disable-next-line react/exhaustive-effect-dependencies -- Opening a draft from a share or draft id re-resolves its project. |
520 | 497 | props.incomingShareId, |
521 | | - props.pendingTaskId, |
522 | 498 | props.draftId, |
523 | 499 | navigation, |
524 | 500 | selectedProject, |
@@ -901,17 +877,7 @@ export function NewTaskDraftScreen(props: { |
901 | 877 | return null; |
902 | 878 | } |
903 | 879 |
|
904 | | - const editingPendingTask = flow.editingPendingTask; |
905 | | - |
906 | | - const metadata = editingPendingTask |
907 | | - ? { |
908 | | - threadId: editingPendingTask.threadId, |
909 | | - commandId: editingPendingTask.commandId, |
910 | | - messageId: editingPendingTask.messageId, |
911 | | - createdAt: editingPendingTask.createdAt, |
912 | | - } |
913 | | - : creationMetadata; |
914 | | - const message = flow.buildPendingTaskMessage(metadata, { |
| 880 | + const message = flow.buildPendingTaskMessage(creationMetadata, { |
915 | 881 | currentCheckoutBranch: queuesInsteadOfStarting ? null : flow.currentCheckoutBranchName, |
916 | 882 | }); |
917 | 883 | if (!message) { |
@@ -939,17 +905,13 @@ export function NewTaskDraftScreen(props: { |
939 | 905 | // would otherwise resurrect this draft. |
940 | 906 | abortComposerDraftOperations(draftKey); |
941 | 907 | const draftSnapshot = getComposerDraftSnapshot(draftKey); |
942 | | - if (editingPendingTask) { |
943 | | - flow.finishEditingPendingTask(); |
944 | | - } else { |
945 | | - // The queued message owns the attachments now, so the sweep is deferred |
946 | | - // until the write confirms it. |
947 | | - clearComposerDraftContent(draftKey, { |
948 | | - clearModelSelection: true, |
949 | | - clearWorkspaceSelection: true, |
950 | | - deferAttachmentCleanup: true, |
951 | | - }); |
952 | | - } |
| 908 | + // The queued message owns the attachments now, so the sweep is deferred |
| 909 | + // until the write confirms it. |
| 910 | + clearComposerDraftContent(draftKey, { |
| 911 | + clearModelSelection: true, |
| 912 | + clearWorkspaceSelection: true, |
| 913 | + deferAttachmentCleanup: true, |
| 914 | + }); |
953 | 915 | scheduleUnusedComposerAttachmentCleanup(draftSnapshot.attachments); |
954 | 916 | return message.messageId; |
955 | 917 | } |
@@ -1146,7 +1108,7 @@ export function NewTaskDraftScreen(props: { |
1146 | 1108 | const thread = draftThreadShell({ |
1147 | 1109 | environmentId: selectedProject.environmentId, |
1148 | 1110 | projectId: selectedProject.id, |
1149 | | - threadId: ThreadId.make(flow.editingPendingTask?.threadId ?? creationMetadata.threadId), |
| 1111 | + threadId: ThreadId.make(creationMetadata.threadId), |
1150 | 1112 | modelSelection: flow.selectedModel, |
1151 | 1113 | runtimeMode: flow.runtimeMode, |
1152 | 1114 | interactionMode: flow.interactionMode, |
|