Skip to content

fix(workspace): make the / typeahead able to find every skill the agent offers (#2213) - #2254

Merged
vybe merged 5 commits into
devfrom
fix/2213-typeahead-skill-coverage
Aug 17, 2026
Merged

vybe merged 5 commits into
devfrom
fix/2213-typeahead-skill-coverage

Conversation

@dolho

@dolho dolho commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Diagnosis first (AC#1), measured on a live instance

I planted 30 probe skills in a real agent container so all four tiers could be compared against one agent:

observation result
agent-server GET /api/skills (in container) 33 skills, all user_invocable
roster payload playbooks[] 24 — exactly _MAX_BRIEFING_HINTS
popup, query "probe 27" 0 matches, nothing on screen saying why

So of the four candidates: the container scan found everything (tier 3), the exposure filter dropped nothing (tier 2 — no allow-list, everything invocable), and the popup's own limit of 8 was already honest, rendering "N more — keep typing to filter" (tier 4).

Tier 1, the payload bound, is the defect. 24 is right for the hint-card grid it was written for (#2101 — a card surface has a layout limit, and cards carry descriptions) and wrong as the search corpus, because search cannot reach what never shipped and the popup has no way to know its list is truncated.

The fix: two surfaces, two bounds, one honest count

  • playbooks — unchanged. 24, rich, feeds the cards.
  • searchable_playbooks — the same client-visible set at 200, title + starter only. Dropping descriptions is what makes 200 entries cheap: ~40 chars each instead of ~540.
  • playbooks_total — the count before either bound.

The popup now keeps the two omissions distinct instead of blurring them:

  • overflow — rows it chose not to draw; typing reaches them
  • hiddenCount — skills that never reached the browser; typing cannot — so it says "N more not listed here — ask for it by name", and the screen-reader status says the same

A bounded list is fine. A bounded list that looks complete is the bug.

Two things worth a reviewer's attention

Widening the briefing's return broke five test files, two of which FAKE _agent_briefing with a 2-tuple — the #2242 stale-double class, and it would have surfaced as a 500 in the roster build rather than a failed assertion. So the return is a named AgentBriefing NamedTuple (still a tuple, so the existing isinstance guards hold) and one _apply_briefing helper copies it onto the card positionally-tolerantly, absorbing any stub still returning the old shape. That took the fallout from 26 failures to 5, and those 5 were asserting the old shape directly — updated to read fields by name, so a future field cannot silently shift what they assert.

My own test caught a real defect mid-change. The availability early-return still yielded a 2-tuple, which would have raised ValueError on unpack for every stopped or unavailable agent — breaking the roster on exactly the agents that early return exists to serve cheaply.

Plugin skills (tier 3): out of scope, documented

Taking the AC's second option, with the reasoning recorded at scan_skills_directory. Enumerating plugin-provided skills means reading the plugin cache layout in agent_server/routers/skills.py, which ships in the base image — so an instance only gets it after a rebuild and old images silently keep the old surface, the release-note trap ent#123 already paid for once. The Workspace consequence is now bounded and honest rather than invisible, which is what makes deferring it defensible.

Verification

check result
backend: every briefing / roster / connector suite 180 passed
frontend unit 851 passed (10 new)
the new specs exercise a set larger than both bounds — the case the AC names, and the case the old tests never had
design-token check · prod build clean

Not verified live post-fix, deliberately: the running instance bind-mounts a different worktree (#2157's), and I am not editing a colleague's checkout or repointing their stack to prove my own branch. The pre-fix measurement above is real; the post-fix confirmation belongs to the deploy.

Fixes #2213
🤖 Generated with Claude Code

…gent offers (#2213)

DIAGNOSIS FIRST — measured, on a live instance, with 30 probe skills planted in a
real agent container so the tiers could be compared against one agent:

    agent-server GET /api/skills   33 skills, all user_invocable
    roster payload playbooks[]     24            <- _MAX_BRIEFING_HINTS
    popup, query "probe 27"        0 matches, and nothing on screen saying why

So of the four candidate narrowing steps: the container scan found everything
(tier 3), the exposure filter dropped nothing (tier 2 — no allow-list, all
invocable), and the popup's own limit of 8 was already honest, rendering "N more —
keep typing to filter" (tier 4). The defect is tier 1: the payload bound.

24 is right for the hint-card GRID it was written for (#2101 — a card surface has a
layout limit and cards carry descriptions) and wrong as the SEARCH corpus, because
search cannot reach what never shipped, and the popup has no way to know it is
holding a truncated list. So the two surfaces get two bounds and the true count is
published:

  * `playbooks`            — unchanged: 24, rich, for the cards
  * `searchable_playbooks` — the same client-visible set at 200, title + starter
    only (dropping descriptions is what makes 200 entries cheap: ~40 chars each
    rather than ~540), feeding `/`
  * `playbooks_total`      — the count before either bound

The popup now distinguishes the two omissions instead of blurring them: `overflow`
is rows it chose not to draw and typing will reach; `hiddenCount` is skills that
never reached the browser, which typing cannot reach — so it says "N more not
listed here — ask for it by name", and the screen-reader status says the same. A
bounded list is fine; a bounded list that looks complete is the bug.

Widening the briefing's return broke five test files, including two that FAKE
`_agent_briefing` with a 2-tuple — the #2242 stale-double class, arriving as a 500
in the roster build rather than a failed assertion. So the return is a named
`AgentBriefing` NamedTuple (still a tuple, so the `isinstance` guards hold) and one
`_apply_briefing` helper copies it onto the card positionally-tolerantly, absorbing
any stub that still returns the old shape. That took the fallout from 26 failures to
5, and those 5 were tests asserting the old shape directly — updated to read fields
by name, so a future field cannot silently shift what they assert.

My own test caught a real defect mid-change: the availability early-return still
yielded a 2-tuple, which would have raised ValueError on unpack for every stopped
or unavailable agent — breaking the roster on exactly the agents that return exists
to serve cheaply.

PLUGIN SKILLS (tier 3) are declared OUT OF SCOPE and documented at the scan, per
the AC's second option. Enumerating them means reading the plugin cache layout in
`agent_server/routers/skills.py`, which ships in the base image — so an instance
only gets it after a rebuild, and old images silently keep the old surface, the
release-note trap ent#123 already paid for once. The Workspace consequence is now
bounded and honest rather than invisible.

Verified: 180 backend tests across every briefing/roster/connector suite, 851
frontend unit tests (10 new, over a set larger than BOTH bounds — the case the AC
names and the case the old tests never exercised), design-token check and prod
build clean. NOT verified live post-fix: the running instance bind-mounts a
different worktree, and I am not editing a colleague's checkout or repointing their
stack to prove my own branch — that check belongs to the deploy.

Related to #2213

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@dolho dolho added type-bug Bug fix ui PR touches the frontend UI — triggers Playwright e2e tests theme-ui-ux Theme: UI/UX labels Aug 17, 2026
…ed defaults (#2213)

Seven review findings, five of them real defects introduced by round one.

* FIELD CAPS BYPASSED. `searchable_playbooks` was built from `playbooks` BEFORE
  `_bound_briefing_hints` applied its title/starter caps, so up to 200 uncapped
  strings shipped per card per roster load — and skill `name` comes from
  agent-author-controlled YAML frontmatter, which also feeds what a pick inserts
  into the composer. The copies now clamp with the same constants.
* EVERY `/` ROW LOST ITS SUBTITLE. Searchable entries deliberately carry no
  description (that is what makes 200 entries cheap), and the popup renders
  `secondary: c.description || ''` — so pointing search at them blanked the subtitle
  for ALL agents, including those under the card bound whose descriptions did ship.
  `playbookSearchSource` now merges descriptions back by title: restored wherever one
  exists, blank only for the tail that genuinely has none, and the payload is not
  mutated.
* `playbooks_total` UNDER-REPORTED on the use-case fallback tier, because
  `_use_case_hints` truncates to 6 before the count was taken — so an agent declaring
  10 use-cases reported 0 hidden while 4 were dropped. The same "looks complete" bug
  this issue exists to fix, one tier over. Counted before the cap now.
* SHARED MUTABLE DEFAULTS. `AgentBriefing`'s `playbooks: list = []` is a CLASS-level
  default, so every stopped/failed agent's card aliased one list — in a module whose
  `_bound_briefing_hints` mutates hint objects in place. Defaults are immutable `()`
  now, which pydantic coerces on the card.
* THE HIDDEN COUNT RENDERED MID-QUERY, where "N more not listed here" reads as "N
  more results matching what you typed" — false, since typing can never reach them.
  It now shows only on a bare `/`, where it is a property of the list.
* The #2101 comment block documenting `_MAX_BRIEFING_HINTS` had been orphaned 14
  lines from its constant by the new class; moved back.
* My own test tautology: `_briefing(n) if n else (...)` short-circuited the `n == 0`
  case, so the empty-skills path — where the fallback tier takes over — was never
  exercised.

Two shape assertions moved from `== (None, [], [], 0)` to per-field checks, because
what the contract owes a caller is "nothing", not a particular container type.

New regression tests: field caps hold for both surfaces under 4000-char names, the
use-case tier's hidden count is visible, the defaults are immutable, and the subtitle
merge is correct (restored / blank tail / no mutation / no-op when nothing has one).

Verified: 11 tests in this file plus the ent#79 / #2196 / ent#357 briefing suites.

Related to #2213

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@dolho

dolho commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Review round applied (7 findings)

Pushed 538f309f. Five were real defects introduced by the first round:

  • Field caps bypassed. searchable_playbooks was built from playbooks before _bound_briefing_hints applied its title/starter caps, so up to 200 uncapped strings shipped per card per roster load — and skill name comes from agent-author-controlled YAML, which also feeds what a pick inserts into the composer. Now clamped with the same constants.
  • Every / row lost its subtitle. Searchable entries carry no description by design, and the popup renders secondary: c.description || '' — so pointing search at them blanked the subtitle for all agents, including those under the card bound whose descriptions did ship. playbookSearchSource merges them back by title: restored where one exists, blank only for the tail that genuinely has none, payload not mutated.
  • playbooks_total under-reported on the use-case tier, because _use_case_hints truncates to 6 before the count was taken: an agent declaring 10 use-cases reported 0 hidden while 4 were dropped — the same "looks complete" bug this issue exists to fix, one tier over.
  • Shared mutable defaults. AgentBriefing's playbooks: list = [] is class-level, so every stopped/failed card aliased one list — in a module whose _bound_briefing_hints mutates hints in place. Immutable () now.
  • The hidden count rendered mid-query, where "N more not listed here" reads as "N more results matching what you typed" — false, since typing can never reach them. Bare / only.

Plus the orphaned #2101 comment moved back to its constant, and my own test tautology: _briefing(n) if n else (...) short-circuited n == 0, so the empty-skills path where the fallback tier takes over was never exercised.

New regression tests: caps hold under 4000-char names, the use-case tier's hidden count is visible, defaults are immutable, and the subtitle merge is correct in all four directions. 127 tests across this file plus the ent#79 / #2196 / ent#357 briefing suites.

…ll-coverage

# Conflicts:
#	src/frontend/src/components/portal/PortalConversation.vue
#	src/frontend/src/components/portal/portalUtils.js
#	tests/registry.json
…ll-coverage

# Conflicts:
#	tests/registry.json
…ll-coverage

# Conflicts:
#	tests/registry.json

@vybe vybe 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.

Validated via /validate-pr.

The defect is correctly located at the payload bound, not the popup: _MAX_BRIEFING_HINTS (24) is right for the hint-card GRID it was written for (#2101 — a card surface has a layout limit and cards carry descriptions) and wrong as the search corpus, because search cannot reach what never shipped. Splitting into playbooks (cards) / searchable_playbooks (200, title+starter only, which is what keeps it cheap) / playbooks_total (so remaining truncation is sayable rather than silent) is the right shape, and the exposure policy still bounds both surfaces.

Two details worth calling out as good:

  • AgentBriefing uses immutable tuple defaults — a NamedTuple's defaults are class-level, so [] would be one shared list aliased by every stopped agent's card, in a module that mutates hint lists in place.

  • _apply_briefing is positional-tolerant on purpose, absorbing test doubles still returning the pre-#2213 2-tuple. That is the #2242 class, and without it a stale double becomes a 500 in the roster build rather than a failed assertion — it took the fallout from 26 failures to 5.

  • Security scan: clean

  • ui label present, so build and e2e both ran

  • Merged origin/dev and resolved three conflicts by hand: portalUtils.js and PortalConversation.vue against #2256 (both append-only; kept both functions and both imports) and tests/registry.json against #2251/#2252/#2255 (rebuilt from git stages, never spliced — verified no entry modified or deleted on either side). Post-resolve: full frontend suite 875/875, portal backend tests 128/128.

  • Verified the resolved branch diffs against dev in exactly its own 11 files — no leakage from the PRs it merged over.

  • Closing keyword patched in so #2213 auto-promotes

@vybe
vybe merged commit 1a4585e into dev Aug 17, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme-ui-ux Theme: UI/UX type-bug Bug fix ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants