Skip to content

agent-store lists every catalog row as a local agent, including remotely-served models - #1845

Merged
malibio merged 1 commit into
mainfrom
worktree-issue-1808-agent-store-filter
Jul 31, 2026
Merged

malibio merged 1 commit into
mainfrom
worktree-issue-1808-agent-store-filter

Conversation

@malibio

@malibio malibio commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Closes #1808

closes #1808)

agent-store mapped every model-catalog row to a local agent regardless of
backend, so remotely-served (openai-compat) rows appeared in the agent
picker labelled as local. model-store already filters to backend ===
'gguf' for the same catalog; apply the same filter here.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DkqjrfV1G6kugsEjvyU9wU
@malibio

malibio commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review Summary

Net positive, small and surgical fix that closes issue #1808 exactly as scoped. The diff filters agent-store.svelte.ts's catalog consumption to backend === 'gguf', mirroring model-store.svelte.ts's existing rule, and adds a focused regression test using the same mockTauriEnvironment pattern already established in model-store.test.ts. All 19 tests in the file pass (including the new one), and ESLint is clean on both changed files. No architectural, security, or performance concerns — this is a one-line logic fix plus documentation plus test.

Findings

Critical Issues

None.

Suggested Improvements

None blocking. Two low-stakes observations for awareness, not action:

  • agent-store.svelte.ts:78 (modelToAgent docstring) says "keep both in sync if the catalog gains another backend" — accurate advice, but note ChatModelEntry.backend (tauri-commands.ts:82) is a closed union ('gguf' | 'openai-compat'), so TypeScript won't force a touchpoint here if a third backend is added later; the comment is the only thing tying the two filters together. Fine as-is given the codebase's stated preference for direct/explicit code over shared abstractions for a two-call-site rule, but if a third backend shows up, grep for backend === 'gguf' before assuming this comment was updated.
  • The mock fallback path (MOCK_LOCAL_AGENT, non-Tauri or error fallback) is correctly untouched by this filter, since it's hardcoded mock data, not catalog data — confirmed no other call site invokes modelToAgent with an unfiltered array (only call site is agent-store.svelte.ts:155, always pre-filtered).

Nitpicks

  • Nit: agent-store.svelte.ts:153-154 and model-store.svelte.ts:178-179 now each carry their own prose explaining the same rule rather than referencing a single shared constant/helper (e.g., isLocalBackend(entry)). Given there are exactly two call sites and the rule is a single equality check, duplicated comments are reasonable per YAGNI — introducing a shared predicate for one boolean check would be over-abstraction. Not asking for a change, just noting the "keep in sync" burden is manual today.

Requirements Check (issue #1808)

  • agent-store surfaces only local GGUF models as local agents — agent-store.svelte.ts:155 filters on backend === 'gguf' before mapping.
  • Remotely-served models do not appear in the agent picker as local — confirmed by new test (agent-store.test.ts), which mocks a mixed gguf/openai-compat catalog and asserts only the gguf row appears in agents.filter(a => a.binary === 'local').
  • The filtering rule is shared or consistently commented — both modelToAgent's docstring and the inline comment at the filter call site now explicitly cross-reference model-store's refreshModels, and vice versa (model-store.svelte.ts:34-38).

Testing Assessment

The new test (describe('refreshAgents (Tauri, catalog filtering)')) is well-targeted: it mocks a two-row catalog (one gguf, one openai-compat), drives refreshAgents() through the real Tauri code path (via mockTauriEnvironment(true) + fake timers), and asserts both a positive (gemma row present) and negative (gpt-4o row absent) condition on binary === 'local' agents. It reuses the mockTauriEnvironment helper pattern from model-store.test.ts faithfully, including the dual-marker clear for vitest's shared-window forks pool — good consistency with existing test infrastructure rather than inventing a new pattern. This meaningfully locks in the fix: if the filter regresses, this test fails.

Verdict

Approve. Fix matches the issue's suggested approach exactly, is minimal and atomic, has no unrelated changes bundled in, and includes a test that would have caught the original bug.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: fix matches issue #1808's suggested approach exactly, minimal/atomic, test meaningfully locks in the fix. Recommendation: APPROVE (GitHub blocks self-approval on this account, so recording as a comment review instead). Full report posted above.

@malibio

malibio commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

/address-review

Evaluated the one nitpick from the pragmatic code review (no Critical/Important findings were raised):

🟢 Nit — shared filter predicate: reviewer noted agent-store.svelte.ts and model-store.svelte.ts each duplicate entry.backend === 'gguf' as a prose-commented filter rather than a shared exported predicate.

Decision: Skipped. This is a single boolean equality check duplicated at exactly two call sites, each already carrying a comment cross-referencing the other. Per CLAUDE.md's anti-abstraction guidance ("three similar lines is better than a premature abstraction"), introducing a named helper (e.g. isGgufModel(entry)) for this would add an import and an indirection layer without meaningfully reducing the drift risk the reviewer flagged — that risk is inherent to having two independent consumers of the catalog, and only a real threshold of ~3 call sites would justify extracting it. Revisit if a third catalog consumer needs the same filter.

No code changes made. No re-review needed.

@malibio
malibio merged commit 0347e05 into main Jul 31, 2026
2 checks passed
@malibio
malibio deleted the worktree-issue-1808-agent-store-filter branch July 31, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent-store lists every catalog row as a local agent, including remotely-served models

1 participant