From 863dbb61e3353e8beb495cd66e22df1cc3bcd2df Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Wed, 7 Oct 2026 08:54:27 -0700 Subject: [PATCH] fix(sessions): hand back the PowerShell common parameters too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `RunForm` keeps `_wm_ps_*` out of `args` and puts them back only as it submits, so handing `args` to the card dropped whatever the reader had chosen on the page — ErrorAction among them, which falls back to Stop. The form now answers with what a run would send. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/src/lib/components/RunForm.svelte | 7 +++++++ frontend/src/lib/components/details/FlowDetail.svelte | 2 +- frontend/src/lib/components/details/ScriptDetail.svelte | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/RunForm.svelte b/frontend/src/lib/components/RunForm.svelte index c9ced988c6..aa0190689e 100644 --- a/frontend/src/lib/components/RunForm.svelte +++ b/frontend/src/lib/components/RunForm.svelte @@ -65,6 +65,13 @@ return { scriptArgs, commonParams } } + /** Everything the form is holding, as a run would send it: the schema's arguments and the + * PowerShell common parameters, which are kept apart from them in here and only put back + * on the way out. For a caller handing the form's contents somewhere else. */ + export function heldArgs(): Record { + return { ...args, ...psCommonParams } + } + export async function setArgs(nargs: Record) { const { scriptArgs, commonParams } = extractPsCommonParams(nargs) args = scriptArgs diff --git a/frontend/src/lib/components/details/FlowDetail.svelte b/frontend/src/lib/components/details/FlowDetail.svelte index 30f010f1ba..106c6825d4 100644 --- a/frontend/src/lib/components/details/FlowDetail.svelte +++ b/frontend/src/lib/components/details/FlowDetail.svelte @@ -400,7 +400,7 @@ // tab closed while the item is still being fetched would otherwise hand the card an empty // object and wipe the proposal it is still parked on. onDestroy(() => { - if (args !== undefined) pendingRun?.handBack(args) + if (args !== undefined) pendingRun?.handBack(runForm?.heldArgs() ?? args) }) // The dev workspace's editor is not one the session panel can host, so from a preview tab diff --git a/frontend/src/lib/components/details/ScriptDetail.svelte b/frontend/src/lib/components/details/ScriptDetail.svelte index b7b4b6fa68..d73d081581 100644 --- a/frontend/src/lib/components/details/ScriptDetail.svelte +++ b/frontend/src/lib/components/details/ScriptDetail.svelte @@ -449,7 +449,7 @@ // tab closed while the item is still being fetched would otherwise hand the card an empty // object and wipe the proposal it is still parked on. onDestroy(() => { - if (args !== undefined) pendingRun?.handBack(args) + if (args !== undefined) pendingRun?.handBack(runForm?.heldArgs() ?? args) }) // Read once on purpose: these args seed the form, so tracking the fragment would