fix(browser): bound ARIA snapshots by character budget - #25
Conversation
|
Thanks @Bartok9. The line cap alone cannot see how wide a line is, so a char budget is the right second axis. Worth noting for anyone reading #21 later: the crude version of that problem is already fixed on main, and what your patch covers is the remaining case, short dense lines that pass the line cap. This is queued for merge review. Sorry for the slow first response, we are going through the whole browser batch this week. Two things I noticed while reading it.
The new test passes Also, minor: the comment above Merge order: #24 re-exports two symbols from here without introducing them, so this one goes first. |
|
Thanks @sosidudku1, all three addressed in 9d2aa43:
31/31 green. Agreed on merge order behind #24. |
|
The character-budget approach is a solid fix for the context-exhaustion problem in #21 — order-preserving pack after noise-drop, before the line cap, with a clear truncation footer. Two cleanup items before merge:
Logic itself looks correct and |
Line-only caps still let dense short-line SPA trees flood small local-model contexts. Add an order-preserving maxChars pack (default 24k) before the line cap, with a size-truncation footer so the agent knows to scroll or navigate. Addresses AtomicBot-ai#21 Agent-Owner: sera Signed-off-by: Bartok9 <danielrpike9@gmail.com>
- Math.max(1, trunc(maxChars)) so 0<maxChars<1 no longer wipes the snapshot - add test exercising char budget + noise dropping together (real call site) - add fractional-maxChars regression test - correct packLinesToCharBudget comment (positional pack, no ref scoring) Signed-off-by: Bartok9 <danielrpike9@gmail.com>
…st.ts Split the summariseAriaSnapshot suite out of browser-tools.test.ts (617->487 lines, under the 300+ file-size concern) into aria-compressor.test.ts. Also drops the stray pnpm-lock.yaml that got committed from a local pnpm install; repo uses npm/package-lock.json.
9d2aa43 to
9979273
Compare
|
Thanks @Ooooze — both addressed:
36/36 green, |
…ests - processLooksLikeChromium is now tri-state (chromium/other/unknown). A failed probe (no /proc, ps timeout, unexpected platform) returns 'unknown', which clearStaleChromeLocks treats as keep-locks instead of the previous false -> clear path that could pull locks from a live browser. - clearStaleChromeLocks accepts isAlive/probe injection so the dead-pid test asserts deterministically; added live-chromium (keep), live-other (clear), and fail-open unknown (keep) cases. - index.ts: drop DEFAULT_ARIA_MAX_CHARS/packLinesToCharBudget re-exports that belong to AtomicBot-ai#25 so this branch builds on its own (tsc clean).
|
Confirmed — pnpm-lock.yaml is gone and the ARIA-budget suite now lives in its own file. 36/36 green, tsc clean. Merging, thanks for the quick turnaround! |
Summary
summariseAriaSnapshotonly capped lines. Dense short-line SPA trees still push tens of kB into small local-model contexts (8k–16k), which is the failure mode described in #21.Fix
maxCharspack (default 24_000) applied after noise drop, before the line capmaxChars: 0/ non-finite disables the budgetTest plan
vitest run src/tools/browser/browser-tools.test.tsbrowser.read_ariaon a heavy SPA and confirm footer + smaller prompt payloadAddresses #21
Agent-Owner: sera