From 8c167c49f18c76f1f867778341ac821591d9d990 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 3 Dec 2026 16:43:51 -0700 Subject: Carry oversized history reseeds in the system prompt append agy keeps only the first ~191 KB of a user message, so a large cold reseed dropped the newest history and the current request. When transcript plus request exceed 160 KB, move the older part of the transcript into the new session's system prompt append, framed as a verbatim record, and keep the newest part with the request in one user message. Refuse a single request too large to fit. Record the probes in docs/findings.md and the separate ~9.9 KB MCP tool result cap in BUGS.md. --- check.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'check.lua') diff --git a/check.lua b/check.lua index 36b8e2f..8a2d200 100644 --- a/check.lua +++ b/check.lua @@ -21,7 +21,16 @@ local function run(bin, args, opts, timeout) end local home = assert(uv.fs_mkdtemp('/private/tmp/panto-agy-XXXXXX')) local function check() - local usage=dofile(root..'/acp.lua').usage + local acp_mod=dofile(root..'/acp.lua'); local usage=acp_mod.usage + local function cut(text,room) + local head,tail=acp_mod.history_split(text,room) + assert(head..tail==text and #tail<=math.max(room,0) and utf8.len(head) and utf8.len(tail),'bad history split'); return head,tail + end + local entries={}; for i=1,40 do entries[i]=('[User]: line %02d '):format(i)..('\u{E9}'):rep(i % 7) end + local head,tail=cut(table.concat(entries,'\n\n'),200) + assert(head:sub(-2)=='\n\n' and tail:sub(1,7)=='[User]:' and #tail>100,'expected an entry-aligned cut') + assert(#select(2,cut(('\u{754C}'):rep(100),10))==9) -- three-byte characters stay whole + assert(cut('abc',10)=='' and cut('',10)=='' and cut('abc',0)=='abc' and select(2,cut('[a]\n\n[b]',3))=='[b]') local u={inputTokens=155,outputTokens=41,thoughtTokens=8,cachedReadTokens=55,cachedWriteTokens=10,totalTokens=196} local v=usage(u); assert(v.input==90 and v.output==41 and v.cache_read==55 and v.cache_write==10 and v.reasoning==8) u.totalTokens=261; assert(usage(u).input==155); u.totalTokens=99; assert(not usage(u) and not usage({}) and not usage(nil)) @@ -47,6 +56,8 @@ protocol="antigravity-acp" ]]) write(cfg .. '/models.toml', '[antigravity.fast]\nmodel="gemini-test"\ninput=10.0\noutput=10.0\ncache_read=1.0\ncache_write=10.0\n') write(cfg .. '/SYSTEM.md', 'Short answers.') + local filler={}; for i=1,1900 do filler[i]=('filler line %04d abcdefghij'):format(i) end + write(cfg .. '/history-filler.txt', table.concat(filler,'\n')) local exe = home .. '/agy' assert(uv.fs_symlink(panto, home .. '/panto')) -- short, space-free shebang path write(exe, '#!' .. home .. '/panto lua\n' .. read(root .. '/tests/fake-agy.lua')) -- cgit v1.3