diff options
| author | t <t@tjp.lol> | 2026-12-03 16:43:51 -0700 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-12-04 13:53:47 -0700 |
| commit | 8c167c49f18c76f1f867778341ac821591d9d990 (patch) | |
| tree | c86df0cf3af948fcff8979ec7c543b8e137cbfdc /check.lua | |
| parent | f1f1c5bc66ea1d6019f84050aa21e4476330a719 (diff) | |
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.
Diffstat (limited to 'check.lua')
| -rw-r--r-- | check.lua | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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')) |
