Camera summaries are cached without checking whether the answer was cut off
A real-time camera, timelapse and summary system for IP cameras and NVRs, whose caption path already sizes its token budget for models that count hidden reasoning.
Audited with leanprompt 0.1.0-dev.15
Estimates, not measurements. Every figure on this page is an estimate from reading the code, not a measurement of the app in use.
- Repository
- KristopherKubicki/glimpser 35 GitHub stars
- Commit audited
6378d2e- leanprompt version
- 0.1.0-dev.15
- Audit date
- Status
- The maintainers have been told about this audit; no response yet.
- Maintainers
- the issue
- How it ran
- Unattended audit: nobody was asked during the run, so priority, volume and prices were left open; the questions for the owner are listed at the end.
leanprompt read the code at commit 6378d2e and found 0 places where its LLM calls could use fewer tokens, plus 3 other problems, not scored. Static score: 100 of 100 (an estimate from the findings). The code may have changed since.
Findings
No open findings.
Other problems the audit found
Problems read in the code that cost no tokens of their own, such as a cost meter or an error path. Not scored.
-
Default gpt-5-mini is deprecated for 2026-12-11 and the allowlist blocks switching
app/config.py:404·LP-GE-13Default to a model the provider still serves · severity mediumWhat happens. The default model gpt-5-mini (config.py:410) is listed on OpenAI's deprecations page with shutdown Dec 11, 2026 (checked on 2026-11-28). ALLOWED_LLM_MODELS holds only gpt-5-mini, gpt-4.1 and gpt-4, and any other LLM_MODEL_VERSION raises ValueError at import (config.py:426-427), so an operator cannot set the replacement the page names without editing code. The list also offers gpt-4, whose shutdown on the same page was Oct 23, 2026, and gpt-4.1, listed as deprecated for Jan 14, 2027.
The change. Replace the closed list with a check that only rejects an empty value (or make the list a warning), update the default and the list to models the page still serves, and mark retired ids in docs/configuration_guide.md:207.
To check. Set LLM_MODEL_VERSION to a current model id and start the app: it should start and the requests should carry that id.
-
Summaries are cached without reading the finish reason
app/utils/llm.py:312·LP-GE-12Read the finish reason before using an answer · severity highWhat happens. summarize() never reads choices[0].finish_reason. The text is turned into JSON lines (llm.py:312-320) and persisted by llm_cache.store, whether the model finished or stopped at the token limit. With a reasoning model, an empty or partial visible reply is possible when the budget is used up (the repo says so itself at image_processing.py:229), and an empty reply becomes the stored JSON object {}. summarize() runs from scheduled jobs (scheduling.py:1892), so nobody reads the result before it is saved. The caption path already logs finish_reason on an empty caption (image_processing.py:491).
The change. Read finish_reason; on 'length' or empty text, do not store the result, and retry once with a larger budget or fall back to the local model.
To check. Mock a response with finish_reason 'length' and assert nothing is written to llm_cache.
-
The summary and question paths send token caps that the repo's own caption path knows are wrong for gpt-5
What happens. image_processing.py chooses max_completion_tokens for gpt-5 and o-series models, raises the budget to max(1024, tokens*8) because hidden reasoning counts against it, and sets reasoning_effort (lines 215-258). llm.py has its own request helper without that logic: summarize() (line 253, 4096) and ask_question() (line 355, 512) send max_tokens first. The helper expects that to be rejected and resends with the same raw cap and no reasoning_effort (llm.py:151-154), so if the API rejects it, each call is sent twice and ask_question leaves 512 tokens for reasoning and answer together. Not measured.
The change. Reuse _chat_completion_token_payload from image_processing.py (or move it to a shared module) in both llm.py call sites, so the first request is already accepted and the budget leaves room for the answer.
To check. With the default model, one summarize() call should show one request in the provider log instead of two, and ask_question() should return a non-empty answer on a short history.
The maintainers’ response
No response from the maintainers yet.
How this was made
The llm-call-audit skill read the code and wrote findings.json; nothing was run against the project’s providers. The full audit page is what leanprompt report --html writes from the same findings.
Corrections and takedown: email info@podwarden.com or open an issue.