fix(sessions): prevent duplicate goal starts and lost autosave updates

- Block prompt submission while an armed goal is starting.
- Launch multi-runs with mutate so a failed launch is not an
  unhandled rejection.
- Save changed session automation fields in one update so concurrent
  autosaves cannot overwrite each other.
This commit is contained in:
Chris Scott committed 2026-10-03 22:51:03 -04:00
1 parent 96e02e9646
commit 2072fae1b6
6 files changed
+137 -38

No files matched your search

@@ -231,10 +231,10 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
const setStoredAgent = useSessionAgentStore((s) => s.setAgent)
const sendPrompt = useSendPrompt(directory)
const sendShell = useSendShell(directory)
const isPromptSubmitPending = sendPrompt.isPending || sendShell.isPending
const startGoal = useStartSessionGoal()
const isPromptSubmitPending = sendPrompt.isPending || sendShell.isPending || startGoal.isPending
const interruptSession = useInterruptSession()
const { data: sessionGoal } = useSessionGoal(sessionID)
const startGoal = useStartSessionGoal()
const { data: permissionMode } = useSessionPermissionMode(sessionID)
const { filterCommands } = useCommands({ directory })
const isExactCommandPrompt = (value: string) => {
@@ -311,6 +311,7 @@ export const PromptInput = memo(forwardRef<PromptInputHandle, PromptInputProps>(
const handleSubmit = async () => {
if (!prompt.trim() && imageAttachments.length === 0) return
if (startGoal.isPending) return
pendingVoiceAutoSubmitRef.current = false
setIsVoiceAutoSendPending(false)