From f1f1c5bc66ea1d6019f84050aa21e4476330a719 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 3 Dec 2026 08:44:58 -0700 Subject: Preserve ACP sessions across Esc and resume unconditionally Killing agy on Esc and defaulting save_session off forced cold ACP restarts that re-billed the flattened conversation transcript as uncached input. Storing session checkpoints in Panto's global state.toml also leaked unbounded per-session keys into UI preferences. Send ACP session/cancel on Esc with a non-extendable 3s SIGKILL fallback and reconcile post-cancel prefix hashes so follow-up prompts and /proceed keep the warm session. Remove save_session and panto.ext.state usage, tracking each ACP session's valid resume tip atomically under the isolated Google profile instead. Breaking: [providers.].save_session is rejected; native session resume is now always enabled. --- tests/fake-agy.lua | 11 ++++++++++- tests/tui.exp | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/fake-agy.lua b/tests/fake-agy.lua index 4f76d8d..b1537ad 100644 --- a/tests/fake-agy.lua +++ b/tests/fake-agy.lua @@ -141,11 +141,20 @@ elseif resumed then local resumed_prompt=prompt('resume'); check_relay(); finish if current~='boundary workflow notice' then assert(text:find('[Assistant]: primary-tool-ok',1,true)) end if current=='branch-probe' then finish(q,'branch-seed-ok'); finish(prompt('warm-probe'),'warm-after-seed-ok') + local esc=prompt('esc-probe') + send({method='session/update',params={sessionId='test-session',update={ + sessionUpdate='agent_message_chunk',content={type='text',text='esc-window-open'}, + }}}) + local cancel=request('session/cancel'); assert(cancel.id==nil and cancel.params.sessionId=='test-session') + reply(esc,{stopReason='cancelled'}) + finish(prompt('after-esc-probe'),'after-esc-ok') reply(prompt('cancel-probe'),{stopReason='cancelled'}) elseif current=='boundary workflow notice' then assert(text:find('[User]: boundary steer',1,true) and text:find('[Tool result',1,true)); finish(q,'proceed-recovered-ok') else - assert(current=='cold-probe' and text:find('[Assistant]: warm-after-seed-ok',1,true)); finish(q,'cold-resume-ok') + assert(current=='cold-probe' and text:find('[Assistant]: warm-after-seed-ok',1,true) + and text:find('[User]: esc-probe',1,true) and not text:find('esc-window-open',1,true) + and text:find('[Assistant]: after-esc-ok',1,true)); finish(q,'cold-resume-ok') end else q = prompt('hello') diff --git a/tests/tui.exp b/tests/tui.exp index 77d3537..fdbad27 100644 --- a/tests/tui.exp +++ b/tests/tui.exp @@ -36,6 +36,9 @@ send -- "primary-tool-ok"; after 150; send -- "\r"; see {branched from} foreach {query answer} {branch-probe branch-seed-ok warm-probe warm-after-seed-ok} { send -- $query; see $query; send -- "\r"; see $answer } +send -- "esc-probe"; see {esc-probe}; send -- "\r"; see {esc-window-open} +send -- "\033"; see {\[interrupted\]} +send -- "after-esc-probe"; see {after-esc-probe}; send -- "\r"; see {after-esc-ok} # The installed module's longer path can wrap the error across terminal rows. send -- "cancel-probe"; see {cancel-probe}; send -- "\r"; see {stopped:}; see {cancelled} send -- "\003"; expect eof; wait -- cgit v1.3