Repository navigation
feat(workspace): capability hints in chat — use-case fallback + template/info fix (trinity-enterprise#380) - #2103
Conversation
…ate/info fix (trinity-enterprise#380)
The Workspace empty-chat briefing (ent#138) already renders hint cards
that pre-fill the composer, but its data was half-broken and had no
fallback: the metadata read hit a nonexistent agent `/info` route (the
best-effort catch swallowed the 404, so descriptions were silently
always None), and an agent with no exposed playbooks showed nothing.
- `_agent_briefing` now reads the canonical `/api/template/info` (the
route InfoPanel, A2A cards and avatars already use): description AND
the template-declared `use_cases` ("What You Can Ask") in one call.
- Hint ladder per ent#380: operator-exposed playbooks (connector
allow-list ∩ user_invocable) win outright; an agent exposing none
falls back to its use_cases as pre-fill hints — sanitized and capped
(6 × 200 chars, `_use_case_hints`). ent#178's curated config slots
into the same seam later.
- PortalBriefing card titles wrap to two lines (hints can be full
sentences); click still only pre-fills, never auto-sends.
- Tests: use-case sanitization, ladder precedence, policy-filtered
fallthrough, metadata-failure isolation, and a pin on the
/api/template/info route fix.
Related to Abilityai/trinity-enterprise#380 (closed manually at release
— cross-repo keywords do not auto-close).
Co-Authored-By: Claude Fable 5 <[email protected]>
Review —
|
cfg |
meaning | fallback? |
|---|---|---|
None (no connector config) |
never curated | yes — sensible default |
exposed_playbooks == [] |
operator exposed nothing | no |
non-empty list, resolves to [] |
stale/renamed playbook names | judgement call |
The distinction is cheap — cfg is already in hand a few lines above:
cfg = core_db.get_connector_config(agent_name)
allow = cfg["exposed_playbooks"] if cfg else None
...
if not playbooks and allow is None: # never curated, not "curated to nothing"
playbooks = _use_case_hints(use_cases)Not blocking if it is a conscious product call — but it should be conscious, and the test comment should say so instead of reading as an incidental fallthrough.
[I2] description becomes visible for the first time on upgrade (confidence 7/10)
Correct as a fix, but worth a release note. Because /info 404'd, no workspace client has ever seen an agent description. After this lands they all do, at once, from template.yaml text written while the field was (unknowingly) inert. Anything an author put there assuming an operator-only audience — internal naming, client names — surfaces to external clients on deploy. Cheap mitigation: a line in the release notes telling operators to skim their templates' description.
[I3] Truncation is mid-word and feeds the composer (confidence 8/10)
text = uc.strip()[:_MAX_USE_CASE_CHARS] — a >200-char use case is cut mid-word with no ellipsis, and that same truncated string becomes starter_prompt, so clicking it pre-fills a sentence that stops mid-word. The cap is right; consider trimming at a word boundary and appending … for the title while keeping the full text (or a clean truncation) as the prompt. Cosmetic, non-blocking.
Checked and clean
- XSS — no
v-html;{{ p.title }}/{{ agent.description }}escaped. - Type safety of agent-supplied JSON — non-list, non-string, blank and over-long entries all handled, with tests. Bundled templates all use plain-string
use_cases(9 checked); object-shaped entries would silently drop, which is acceptable given none exist. - Cap discipline — 6 × 200 enforced and tested;
corneliusdeclares 9 and is correctly capped. - No auth/endpoint change — enrichment of the existing roster only.
- Docs —
architecture.mdWorkspace section updated to match the shipped ladder, including the/infofix.
Summary: 1 finding needing a decision (C1), 2 non-blocking notes. No blocking defect.
|
While planning trinity#2101 (bounding the briefing hint grid), both of its independent review passes converged on a suggestion that belongs to this PR's ladder rather than to #2101 — leaving it here for consideration:
Proposal (~5 lines on this PR's seam): thread
Scoped to the briefing only — the MCP connector's own #2101 lands the display bound either way (6 visible + counted expander, plus a ≤24 belt as a single slice at |
With no connector allow-list configured (the default), every user_invocable skill became a "Things you can ask" card — a blanket sheet of humanized slugs growing without bound (design-system contract, principle 28). Re-scoped from the original filing: no tool activity reaches the workspace transcript at all (that reading rides ent#286); the observed symptom was this briefing grid. - PortalBriefing.vue: first 6 cards collapsed, described-cards-first order, one persistent counted "Show all N" toggle (type=button, aria-expanded) expanding IN PLACE — no nested scroll region, the chat pane stays the single scroll axis; expansion state is a local ref (the convKey remount resets it on agent switch, a roster refresh preserves it) - portalUtils.planHintDisplay: pure fold/order helper, vitest-covered at the boundaries (0/5/6/7/expanded, ordering stability) - client_portal/service.py: _bound_briefing_hints belt at _agent_briefing's return — caps hint COUNT (24) and per-hint field sizes (title 200 / description 300 / starter 500; every field is agent-author-controlled, so a count-only belt is defeated by 24 huge descriptions); an inspect.getsource pin guards the call site through the PR #2103 rebase that rewrites the function body - docs: architecture.md workspace section + learnings.md (mis-filed-symptom class); registry entry for the extended pytest file Hint curation stays out of scope (connector allow-list today, ent#178 later). Fixes #2101 Co-authored-by: trinity-ability <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
|
Resolve by running |
# Conflicts: # docs/memory/architecture.md # src/backend/client_portal/service.py # src/frontend/src/components/portal/PortalBriefing.vue # tests/unit/test_ent79_portal_exposure.py
vybe
left a comment
There was a problem hiding this comment.
Validated via /validate-pr: conflicts with #2113 resolved semantically (use-case fallback ladder now routes through the #2101 hint belt at the return — the belt's own guard test confirms the call-site survived). Security battery clean; architecture.md §Workspace updated; 69/69 unit tests pass locally incl. both sides' new coverage. Cross-tracker Fixes ent#380 — status-in-dev to be set manually.
Summary
Workspace chat gave no hint of what an agent can do unless the operator had exposed connector playbooks — and even then, the briefing's metadata read was silently broken. This completes the ent#138 empty-chat briefing into the ent#380 capability-hint surface:
user_invocable— the curated set, same policy the MCP connector advertises); an agent exposing none now falls back to its template-declareduse_cases("What You Can Ask", the same metadata InfoPanel shows operators). Sanitized + capped (6 hints × 200 chars)._agent_briefingcalled{agent}/info, a route that does not exist on the agent server — the best-effort catch swallowed the 404, so briefing descriptions have been silentlyNonesince ent#138. It now reads the canonical/api/template/info(the route InfoPanel, A2A cards, and avatars already use), which also carriesuse_cases— so the fallback costs zero extra HTTP calls.use-playbook→prefillchain, unchanged). Card titles wrap to two lines so full-sentence prompts don't clip.Acceptance criteria (ent#380)
use_casesfallback; ent#178's unified config slots into the same_agent_briefingseam later (docstring marks it)Deliberately not done
ChatEmptyState.vue'sFALLBACK_PROMPTS): a client surface must not advertise capabilities the operator/template never declared.ChatEmptyState.vue: itssendImmediatelyheuristic violates "never auto-sends", and its playbook source ignores the connector allow-list.src/backend/enterprise/backend/client_portal/) — dead code since ent#356; the OSS router wins registration order.Changes
src/backend/client_portal/service.py—/api/template/infofix,_use_case_hints()sanitizer, fallback laddersrc/backend/client_portal/models.py— hint-card docstrings (wire shape unchanged)src/frontend/src/components/portal/PortalBriefing.vue— title wraps (line-clamp-2); commentssrc/frontend/src/stores/clientPortal.js— commenttests/unit/test_ent79_portal_exposure.py— 5 new tests (sanitization, ladder precedence, policy-filtered fallthrough, metadata-failure isolation, route pin)docs/memory/architecture.md— Workspace section: briefing hint ladderTest Plan
pytest tests/unit/test_ent79_portal_exposure.py— 65 passed (5 new + 60 pre-existing)test_ent356_portal_is_oss_core,test_ent357_workspace_owned_roster,test_ent287_portal_rate_limits(49 passed)vitest run— 71 passed; design-token check + raw-color ratchet cleanuse_cases, (c) bare agentFixes abilityai/trinity-enterprise#380
🤖 Generated with Claude Code