The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a required challenge ask never joins or inherits an optional run
kshitijk4poord1f587331e0a
diff --git a/apps/desktop/electron/challenge-window.test.ts b/apps/desktop/electron/challenge-window.test.tsindex 68858f61cd0..d6b358f08c7 100644--- a/apps/desktop/electron/challenge-window.test.ts+++ b/apps/desktop/electron/challenge-window.test.ts@@ -356,3 +356,30 @@ test('a fresh foreground attempt can reopen a closed window while status replayphase(windows[1], 'done')assert.equal(await retry, 'done')})++test('a required ask neither joins nor inherits an optional run of the same ticket', async () => {+ const { challenges, windows, phase } = makeHarness()+ const optional = challenges.run({ url: URL_OK, required: false })+ const required = challenges.run({ url: URL_OK, required: true })++ assert.equal(windows.length, 2)+ phase(windows[1], 'interactive')+ assert.equal(windows[1].shown, true)+ phase(windows[0], 'done')+ phase(windows[1], 'done')+ assert.equal(await optional, 'done')+ assert.equal(await required, 'done')+})++test('an optional run that failed does not answer a later required ask for the same ticket', async () => {+ const { challenges, windows, phase } = makeHarness()+ const optional = challenges.run({ url: URL_OK, required: false })++ phase(windows[0], 'interactive')+ assert.equal(await optional, 'failed')+ const required = challenges.run({ url: URL_OK, required: true })++ assert.equal(windows.length, 2)+ phase(windows[1], 'done')+ assert.equal(await required, 'done')+})diff --git a/apps/desktop/electron/challenge-window.ts b/apps/desktop/electron/challenge-window.tsindex 13116d8c806..f7cb0ab3cf4 100644--- a/apps/desktop/electron/challenge-window.ts+++ b/apps/desktop/electron/challenge-window.ts@@ -305,13 +305,16 @@ export function createChallengeWindows({return Promise.resolve('refused')}- const existing = running.get(request.url)+ // A required ask for a ticket that ran (or is running) as optional, never revealed, must not+ // join that run or inherit its verdict: both keys carry whether the window may be shown.+ const runningKey = `${request.url}:${request.required}`+ const existing = running.get(runningKey)if (existing) {return existing}- const attemptKey = `${request.url}:${request.attempt ?? 0}`+ const attemptKey = `${runningKey}:${request.attempt ?? 0}`const before = settledAt.get(attemptKey)if (before && clock() - before.at < SETTLED_MEMORY_MS && !RETRYABLE_OUTCOMES.includes(before.outcome)) {@@ -330,9 +333,9 @@ export function createChallengeWindows({return result})- .finally(() => running.delete(request.url))+ .finally(() => running.delete(runningKey))- running.set(request.url, outcome)+ running.set(runningKey, outcome)return outcome}