Only the newest page is real: how my desktop AI companion stops its model acting on stale browser refs
Ankita is my open-source desktop AI companion — a little companion, a lot more possible — and it can drive a real browser tab alongside chat. That created a bug class I did not expect: the model would act on a page that no longer existed.
Picture a multi-page task. The companion opens a form, reads the controls, clicks through to a confirmation page, then reads that too. Every one of those page snapshots is still sitting in the conversation history, each full of refs like [ref=e12] . The model, quite reasonably, treats them all as live. It clicks a ref from three pages ago. That ref now points at a different control, or at nothing at all. Worse, on a form flow, re-acting on an old snapshot can mean repeating a submission the user already completed.
The fix I landed on is blunt: before every model call, only the newest browser observation is real.…