Vision Proxy: Fix failure cases when dealing with high-entropy tokens - #232
Vision Proxy: Fix failure cases when dealing with high-entropy tokens#232Barrixar wants to merge 3 commits into
Conversation
|
Quick note on expectations, from testing the prompt against screenshots of dense config panels (hosts, ports, and a base64 hostkey fingerprint) - vision models aren't OCR engines, and that's worth knowing when reading the diffs. Prose, code, and structure extraction improved a lot with these changes. But a short, high-entropy token - like ssh-rsa 2048 Kp9xYw2RqVb7TzQc4LmJn6sFd3GkH0uIaEh8PtXe5Oy - still wobbles between runs: characters get dropped, merged, or swapped, and the same token comes back slightly different every time (42/43 correct on one pass, 40/43 on the next). That's not the prompt and also not neccesarily the user's input image resolution/level of detail, it's how VLMs read images. The extension's default vision proxy model is oswe-vscode-prime (Also known as "Raptor Mini") which was the model used in these tests, but the limitation could apply to whichever Copilot vision model you configure in 2026 - because like all current VLMs, it doesn't trace glyphs the way a real OCR engine does. It downsamples the image to a fixed internal grid, then decodes text from attention over word shapes. Dense runs of lookalike characters (I/l/1, 0/O, 5/S) are the worst case, and the errors are stochastic - I even saw it fail identically on a zoomed-in crop, with both the initial image and the zoomed-in crop being high resolution images (i.e. 2030 x 588, a clear image taken from a sharp-font webpage grid using PrintScreen) so more pixels or more fidelity don't fix it, as the upstream model provider processes it in a way that can cause this whole chain of events. What this PR does get you: no more word-repair on tokens, uncertainty markers where the model is unsure, and key/value rows that stay paired. But per-character fidelity for arbitrary secrets and tokens is a hard limit of today's vision models - so treat any hash, key, password, or anything else critical that comes out of a screenshot as untrusted and verify it by hand. This is a practice that has to be followed with AI Agentic development at all times, anyways. So, as far we are bound (or plugin users are set to, by default) to Vision Model providers that don't do better than they do today, this is the best we can do with the prompt itself, as in, we have bottomed it out for now. |
This is a follow-up to merged PR #206 (My original rewrite of the Vision Proxy prompt).
What
Fixes transcription failures where the vision model "repairs" high-entropy tokens instead of transcribing them - substitutions, case flips, and dropped characters in hashes/fingerprints/keys/URLs/passwords - and flattens key/value settings panels into run-together text that loses which value belongs to which key.
How
New character-fidelity rules: literal tokens are transcribed character-by-character with per-character [?] on any doubt; case, punctuation, and spacing preserved exactly; wrapped tokens joined with (wrapped) outside code blocks only.
Settings/key-value lists now emit key: value per row (statuses appended, multi-line values kept indented) with a lossless fallback from tables.
Small fixes: | escaped inside Markdown table cells; redundant duplicate rules removed to keep the prompt lean.
No changes to the output format, region/marker conventions, escaping protocol, or multi-image handling - this is a focused fidelity patch on top of the merged template.
Here's the more easily visualized (and compared) refined system prompt: