Skip to content

The agent picker reads AiSettings.AgentQueries — plugin agents surface everywhere - #930

Merged
rbuergi merged 3 commits into
mainfrom
fix/901-agent-picker-agentqueries
Aug 8, 2026
Merged

rbuergi merged 3 commits into
mainfrom
fix/901-agent-picker-agentqueries

Conversation

@rbuergi

@rbuergi rbuergi commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #901.

The defect

#858 wired the write side (install hook registers {partition}/Agent into every user's AiSettings.AgentQueries) and the skills read side — but nothing ever read AgentQueries. Every picker surface issued the fixed namespace:{user}/Agent|{space}/Agent|Agent union, so plugin-shipped agents stayed invisible (empty picker, "the agent catalog is empty" on selection) unless the chat ran inside the plugin's own partition.

The fix — mirror the skills read side, one pipeline

  • ResolveAgentQueries: canonical base union always first (the only row guaranteed to resolve — the skills platform-row rule), settings rows follow token-substituted and deduped. The fused default template dedupes into the base when its tokens resolve and drops harmlessly on a null context — package rows can never displace platform/user agents.
  • ObserveAgentQueries (live) + ResolveAgentQueriesOnce (click-time one-shot against the first live settings snapshot, 2 s bound → degrades to the base, never hangs the picker).
  • AgentPickerProjection.ObserveAgents is now settings-aware (ObserveAgentQueries + Switch) — one change fixes every consumer: combobox/@-detection, ObserveDefaultComposer, and AgentChatClient's execution-side resolution, so the picker offers exactly what execution resolves. The synced-query id carries a SHA-256 fingerprint of the resolved set (the shared upstream is cached by id — a settings change must mint a new id).
  • OpenPicker's /agent branch resolves through ResolveAgentQueriesOnce in its existing timing-safe chain.

Verification

  • AgentPickerQueriesTest 40/40 — 4 new ResolveAgentQueries cases: defaults ≡ canonical base bit-for-bit (pre-fix behavior preserved for users with no packages), package row appends after base, null context keeps platform+user via the base, reserved context nulled.
  • AgentPickerProjectionTest 6/6 — new end-to-end: a package agent seeded under PickerPkg/Agent + the exact settings write the install hook performs surfaces through ObserveAgents while chatting in a different space.
  • Release -warnaserror builds clean (MeshWeaver.AI, MeshWeaver.Blazor.Portal, both test projects).

What's New entry included (user-facing).

🤖 Generated with Claude Code

rbuergi and others added 3 commits August 8, 2026 08:04
…e everywhere

Fixes #901. PR #858 wired the WRITE side (AiSourcesInstallHook registers each
installed package's {partition}/Agent source into every user's
AiSettings.AgentQueries) and the SKILLS read side — but nothing ever READ
AgentQueries: every picker surface issued the fixed
namespace:{user}/Agent|{space}/Agent|Agent union, so plugin-shipped agents
stayed invisible unless the chat happened to run inside the plugin's own
partition (empty picker; "the agent catalog is empty" on selection).

The read side now mirrors the skills read side:

- AiSettingsNodeType.ResolveAgentQueries — the canonical base union
  (BuildAgentQuery: platform + user + space) stays ALWAYS FIRST (the only row
  guaranteed to resolve — same rule as the skills platform row), settings rows
  follow token-substituted, deduped case-insensitively. The fused default
  template dedupes into the base when its tokens resolve and drops harmlessly
  on a null context — the base already covers those layers, so package rows can
  never displace platform/user agents.
- ObserveAgentQueries (live, mirrors ObserveSkillQueries) and
  ResolveAgentQueriesOnce (click-time one-shot against the FIRST live settings
  snapshot — not Observe's immediate defaults emission, which would miss
  package rows — degrading to the base after a 2s bound so the picker never
  hangs).
- AgentPickerProjection.ObserveAgents is now settings-aware via
  ObserveAgentQueries + Switch — one change, every consumer fixed: the
  combobox/@-detection (ThreadChatView), ObserveDefaultComposer, and
  AgentChatClient's execution-side resolution all ride this pipe, so the
  picker offers exactly what execution resolves. The synced-query id carries a
  SHA-256 fingerprint of the resolved set: hub.GetQuery caches the shared
  upstream by id, so a settings change must mint a new id or the old
  subscription serves stale queries forever.
- ThreadChatView.OpenPicker's /agent branch resolves through
  ResolveAgentQueriesOnce composed into its existing timing-safe chain.

Verified: AgentPickerQueriesTest 40/40 (4 new ResolveAgentQueries cases:
defaults ≡ canonical base bit-for-bit, package row appends after base, null
context keeps platform+user via the base, reserved context nulled) and
AgentPickerProjectionTest 6/6 including the new end-to-end
ObserveAgents_PackageSourceInSettings_SurfacesPackageAgent (package agent in a
foreign-space chat context). Release -warnaserror builds clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 8, 2026 06:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR wires the agent picker and related chat surfaces to read AiSettings.AgentQueries (the per-user registry sources written at package install time), so package/plugin-shipped agents become visible and selectable regardless of the current chat space.

Changes:

  • Added ResolveAgentQueries plus live/one-shot settings readers (ObserveAgentQueries, ResolveAgentQueriesOnce) in AiSettingsNodeType.
  • Updated AgentPickerProjection.ObserveAgents to become settings-aware and cache-safe by incorporating a fingerprinted query-id.
  • Updated the /agent picker path in ThreadChatView to resolve agent queries via the new one-shot settings read, and added/extended tests + a What’s New entry.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/MeshWeaver.AI/AiSettingsNodeType.cs Adds the agent-query resolution + live/one-shot settings-based query sources to mirror the existing skills path.
src/MeshWeaver.AI/AgentPickerProjection.cs Makes the agent observation pipeline settings-aware and ensures query-cache invalidation via a resolved-query fingerprint in the query id.
src/MeshWeaver.Blazor.Portal/Chat/ThreadChatView.razor.cs Updates the /agent picker branch to use the settings-aware, bounded one-shot agent-query resolver.
test/MeshWeaver.AI.Test/AgentPickerQueriesTest.cs Adds targeted unit tests for the new ResolveAgentQueries behavior and edge cases.
test/MeshWeaver.Hosting.Monolith.Test/AgentPickerProjectionTest.cs Adds an end-to-end monolith test ensuring package agents surface via the settings-aware pipeline outside the package partition.
src/MeshWeaver.Documentation/Data/WhatsNew/2026-08-08-plugin-agents-in-picker.md Adds a user-facing What’s New entry describing the fixed agent picker behavior for package-installed agents.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 5)

1 676 tests   1 485 ✅  5m 42s ⏱️
   11 suites    191 💤
   11 files        0 ❌

Results for commit 648ed61.

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Test Results (shard 4)

1 211 tests   1 206 ✅  5m 27s ⏱️
   11 suites      5 💤
   11 files        0 ❌

Results for commit 648ed61.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 3)

   11 files     11 suites   5m 49s ⏱️
1 764 tests 1 656 ✅ 108 💤 0 ❌
1 860 runs  1 752 ✅ 108 💤 0 ❌

Results for commit 648ed61.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 0)

673 tests   673 ✅  5m 16s ⏱️
 10 suites    0 💤
 10 files      0 ❌

Results for commit 648ed61.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 2)

1 789 tests   1 787 ✅  6m 16s ⏱️
   11 suites      2 💤
   11 files        0 ❌

Results for commit 648ed61.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (shard 1)

1 186 tests   1 186 ✅  8m 9s ⏱️
   11 suites      0 💤
   11 files        0 ❌

Results for commit 648ed61.

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   65 files     65 suites   36m 42s ⏱️
8 299 tests 7 993 ✅ 306 💤 0 ❌
8 395 runs  8 089 ✅ 306 💤 0 ❌

Results for commit 648ed61.

♻️ This comment has been updated with latest results.

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 picker ignores AiSettings.AgentQueries — plugin-registered agent sources never surface (agent half of #858 unwired)

2 participants