fix(title): runtime validator stops stale background titling from reloading unloaded models (salvage #19137) - #66078
Merged
Merged
Conversation
tonydwb
reviewed
Jul 17, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment
Scope: +135/-1, title runtime validator salvage
Notes
- Fix: runtime validator stops stale background titling from reloading unloaded models.
- Salvage of #19137.
- No security concerns.
- Clean fix, LGTM.
Reviewed by Hermes Agent
teknium1
force-pushed
the
salvage/62983-title-runtime
branch
2 times, most recently
from
July 17, 2026 05:44
e7f8f11 to
ee65fc6
Compare
…unloaded Ollama models Add a runtime_validator callback to generate_title() / auto_title_session() / maybe_auto_title(). Callers snapshot the session's model+provider when spawning the background titler; the validator runs right before the LLM request and skips it silently when the live runtime no longer matches — so a stale title request can't reload a model that strict_single_load already evicted after a user model switch. Fail-open: a raising validator never disables titling. Wired at all four call sites (cli, gateway, tui_gateway, acp_adapter). Surgical reapply of PR #19137 (base was 8k+ commits stale; the original patch predates the pinned-language prompts, the atomic-write helper, and the moved TUI/ACP call sites). Original work by @Thatgfsj. Closes #19027.
teknium1
force-pushed
the
salvage/19137-runtime-validator
branch
from
July 17, 2026 05:57
1416517 to
0c6df26
Compare
Closed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Background title generation can no longer reload a model the runtime already unloaded: a
runtime_validatorcallback now runs right before the titler's LLM request and silently skips it when the session's model/provider changed after the thread was spawned. Fixes #19027 (Ollamastrict_single_loadusers: a model switch evicted the old model, then the stale background title request pulled it straight back into GPU memory).Surgical reapply of #19137 by @Thatgfsj — the original branch was 8k+ commits stale (predates pinned-language prompts, the atomic-write helper, and the moved TUI/ACP call sites), so the semantic diff was reapplied onto current main with
--authorpreserving contributor authorship. Stacked on #66062 (salvage #62983) since both touch the same call sites.Changes
agent/title_generator.py:runtime_validator: Callable[[], bool]threaded throughmaybe_auto_title→auto_title_session→generate_title; checked immediately beforecall_llm. Fail-open: a raising validator logs and proceeds (@Thatgfsj)cli.py,gateway/run.py,tui_gateway/server.py,acp_adapter/server.py: each call site snapshotsmodel/providerat spawn and passes a comparison lambda (@Thatgfsj, re-wired to current call sites)Validation
call_llmnever invoked)Closes #19027. Original PR #19137 will be closed with credit.
Infographic