From 463c2aa9a5cbd4825e4d707a2bad99a3632fcae0 Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Wed, 7 Oct 2026 09:39:07 -0700 Subject: [PATCH] fix(sessions): keep the submitted arguments on screen after Run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pressing Run settles the call, so the draft the form reads stops answering before the job exists: the form emptied for as long as the start took, and stayed empty when the server refused it — leaving the reader the run to make again with nothing to make it from. It falls back to what it submitted. The note on the PowerShell split also claimed the unoffered keys travel to the job. `SchemaForm` holds the arguments to the keys the schema declares, so they do not. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/src/lib/components/RunForm.svelte | 7 ++++--- frontend/src/lib/components/details/FlowDetail.svelte | 7 ++++++- frontend/src/lib/components/details/ScriptDetail.svelte | 7 ++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/RunForm.svelte b/frontend/src/lib/components/RunForm.svelte index 3ab7bb69e2..9296f2c22d 100644 --- a/frontend/src/lib/components/RunForm.svelte +++ b/frontend/src/lib/components/RunForm.svelte @@ -66,9 +66,10 @@ } export async function setArgs(nargs: Record) { - // Only when this form is the one offering them. Unoffered, they stay in the arguments - // and travel with them: `enforceDisabledDefaults` copies every key, so the job still - // receives them, and taking them out here would drop them from whoever owns `args`. + // Only when this form is the one offering them: taking them aside is what lets the + // section edit them, and a form without that section has nowhere to put them back + // from. It does not keep them — `SchemaForm` holds `args` to the keys the schema + // declares — so a form that hides the section neither offers these nor carries them. const { scriptArgs, commonParams } = showPsCommonParams ? extractPsCommonParams(nargs) : { scriptArgs: nargs, commonParams: {} } diff --git a/frontend/src/lib/components/details/FlowDetail.svelte b/frontend/src/lib/components/details/FlowDetail.svelte index e070cd8a7d..f7839159ca 100644 --- a/frontend/src/lib/components/details/FlowDetail.svelte +++ b/frontend/src/lib/components/details/FlowDetail.svelte @@ -347,7 +347,10 @@ // card edits — rather than a copy of it. There is then nothing to keep in step and nothing // to carry back: whatever is typed on either surface is what the call runs with. let ownArgs: Record | undefined = $state(undefined) - const args = $derived(pendingRun ? pendingRun.draftArgs : ownArgs) + // Falls back once the draft is gone: pressing Run settles the call, and the form must go + // on showing what it submitted while the job starts — and still show it if the start is + // refused, which leaves the reader on the page with the run to make again. + const args = $derived(pendingRun?.draftArgs ?? ownArgs) function setArgs(next: Record | undefined) { if (pendingRun) pendingRun.setDraftArgs(next ?? {}) else ownArgs = next @@ -390,6 +393,8 @@ const call = pendingRun if (!call) return runFlow return (_scheduledForStr: string | undefined, a: Record) => { + // Kept for the moment the draft stops answering, just below. + ownArgs = a if (!call.submit(a)) { sendUserToast('That request is no longer waiting on this form', true) } diff --git a/frontend/src/lib/components/details/ScriptDetail.svelte b/frontend/src/lib/components/details/ScriptDetail.svelte index eb2837e925..18458ac031 100644 --- a/frontend/src/lib/components/details/ScriptDetail.svelte +++ b/frontend/src/lib/components/details/ScriptDetail.svelte @@ -422,7 +422,10 @@ // card edits — rather than a copy of it. There is then nothing to keep in step and nothing // to carry back: whatever is typed on either surface is what the call runs with. let ownArgs: Record | undefined = $state(undefined) - const args = $derived(pendingRun ? pendingRun.draftArgs : ownArgs) + // Falls back once the draft is gone: pressing Run settles the call, and the form must go + // on showing what it submitted while the job starts — and still show it if the start is + // refused, which leaves the reader on the page with the run to make again. + const args = $derived(pendingRun?.draftArgs ?? ownArgs) function setArgs(next: Record | undefined) { if (pendingRun) pendingRun.setDraftArgs(next ?? {}) else ownArgs = next @@ -439,6 +442,8 @@ const call = pendingRun if (!call) return runScript return (_scheduledForStr: string | undefined, a: Record) => { + // Kept for the moment the draft stops answering, just below. + ownArgs = a if (!call.submit(a)) { sendUserToast('That request is no longer waiting on this form', true) }