Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(installer): don't flag SD/embedding models as 'Context unverified' during init#1558

Merged
kovtcharov-amd merged 4 commits into
mainfrom
autofix/issue-318
Jun 11, 2026
Merged

fix(installer): don't flag SD/embedding models as 'Context unverified' during init#1558
kovtcharov-amd merged 4 commits into
mainfrom
autofix/issue-318

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Running gaia init --profile sd printed a misleading ⚠️ Context unverified! next to SDXL-Turbo even though it verified fine — SD and embedding models never run context verification, but the summary inherited a stale _ctx_verified=None left over from __init__ and showed the warning on the first model in the profile. After this change, context state is reset per-model and the warning appears only when an LLM with a context requirement was actually checked and the server reported no context size back; SD/embedding models now show a clean OK.

Closes #318.

Test plan

  • python -m pytest tests/unit/installer/test_init_verify_ctx_display.py -v — 3 tests (SD-first stays clean, LLM-without-ctx still warns, ctx state doesn't leak between models)
  • gaia init --profile sd --yes and confirm SDXL-Turbo shows OK with no "Context unverified" warning, while LLMs still show (ctx: …)

SD and embedding models skip context verification entirely, but the
verification summary inherited a stale _ctx_verified=None from __init__
and printed a misleading '⚠️ Context unverified!' next to them. Reset the
context state per-model so the warning shows only when verification was
actually attempted (LLM models with a min context size).

Closes #318
@github-actions github-actions Bot added the tests Test changes label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Code Review — fix(installer): don't flag SD/embedding models as 'Context unverified'

Summary

Solid, well-scoped bug fix — the root cause is correctly identified and the fix is minimal and clean. The misleading ⚠️ Context unverified! on the first model of an SD profile came from __init__ seeding self._ctx_verified = None, which made the first loop iteration's hasattr(self, "_ctx_verified") check pass even for SD/embedding models that never run verification. Moving the reset to the top of each model iteration (and dropping the seed from __init__) makes the warning fire only when an LLM with a min_context_size was actually checked and the server reported no context back. I ran the 3 new tests locally — all pass.

The one thing worth knowing: I confirmed every read of _ctx_verified is hasattr-guarded (init_command.py:1759, :1760, :1768) and _ctx_warning is still initialized in __init__, so removing the __init__ seed introduces no AttributeError risk on any other code path.

Issues Found

🟢 Minor — tests mock _test_model_inference rather than exercising the real SD path (test_init_verify_ctx_display.py:94)

The tests drive the display logic by stubbing _test_model_inference and setting cmd._ctx_verified directly, which is the right way to test the display bug. But it means the suite won't catch a future regression where the real SD/embedding branch (init_command.py:1585) accidentally sets _ctx_verified. The test comments honestly call out this assumption ("SD path in _test_model_inference never touches _ctx_verified"), so this is a note, not a blocker — consider one integration-style test that lets the real _test_model_inference run against a mocked client for an SD model, if you want to lock that invariant down too.

Strengths

  • Root cause, not symptom. The fix removes the stale-state source (__init__ seed) and centralizes the per-model reset at the loop top, rather than patching the display site. The now-redundant post-display delattr is correctly removed.
  • Comments follow the house style — they explain the why (the stale-flag inheritance invariant) in one place each, exactly where a future reader needs it, without narrating the mechanics.
  • Good test coverage of the actual scenarios: SD-first stays clean, LLM-without-reported-ctx still warns, and ctx state doesn't leak across models (with forced ordering). The third test asserting on the specific SDXL-Turbo line rather than global text is a nice touch.

Verdict

Approve. No blocking issues; the lone minor note is optional follow-up. Bug fix is correct, scope-clean, and tested — verified passing locally. Docs need no update (console-output fix, no CLI/API surface change).

kovtcharov-amd and others added 3 commits June 10, 2026 13:55
The per-model context-verification flag is set dynamically and its
absence is meaningful (verification not attempted). Add a class-level
annotation without assignment so hasattr semantics are preserved while
resolving the Pylint attribute-defined-outside-init (W0201) failure.
@kovtcharov-amd kovtcharov-amd enabled auto-merge June 11, 2026 00:31
@kovtcharov-amd kovtcharov-amd added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit 6d03b4b Jun 11, 2026
34 checks passed
@kovtcharov-amd kovtcharov-amd deleted the autofix/issue-318 branch June 11, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GAIA SD model verification confusion

2 participants