Repository navigation
JVNAUTOSCI-2614: simplify capability discovery and relation coverage - #333
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the registered-tool semantic retrieval/reranking machinery and replaces capability discovery with a complete, unranked “purpose index” so the adaptive model can select tools/workflows by name and hydrate full schemas on demand. It also reworks predicate-incidence and relation preview hydration to be page-first to reduce measured latency, and updates prompts/metadata to clarify relation coverage and reified-role reasoning.
Changes:
- Replace ranked capability retrieval with an alphabetical, compact purpose index plus exact-name schema hydration.
- Make predicate incidence aggregate/sort over a cheap skeleton first, then hydrate only the selected page (previews/type counts/role expansion).
- Add scoped AgentTest “trusted capability grants” (only when canonical server scope matches) and extend Jira update metadata to be ordinary-turn effect-gated.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/backend/test_von_generate_workflow_instances.py | Adds coverage for resolving AgentTest trusted capabilities from canonical scope. |
| tests/backend/test_tool_metadata_service.py | Updates expectations for revised tool descriptions/planner hints and new default payloads. |
| tests/backend/test_registered_tool_capability_retrieval_service.py | Removes tests for the deleted registered-tool semantic retrieval index. |
| tests/backend/test_predicate_incidence_page_first.py | New tests asserting page-first predicate-incidence hydration and preview defaults. |
| tests/backend/test_internal_mcp_jira_tools.py | Verifies jira_update_issue ordinary-turn exclusion/effect defaults. |
| tests/backend/test_internal_mcp_catalogue_builds.py | Asserts updated predicate-incidence description in the default catalogue. |
| tests/backend/test_entity_information_retrieval_workflow_vontology_service.py | Updates workflow purpose/discovery exemplars away from person/role-specific phrasing. |
| tests/backend/test_concept_relation_service_uncertainty.py | Adjusts incidence calls for include_concept_preview default change. |
| tests/backend/test_concept_relation_service_extent_index.py | Adds batching/paging tests for relation preview hydration. |
| tests/backend/test_agent_test_replay_mode_service.py | New unit tests for trusted capability grant scope/name validation. |
| tests/backend/test_adaptive_turn_service.py | Updates adaptive-turn messaging and validates the new complete purpose index behaviour. |
| src/backend/workflows/repo_seed_bundles/entity_information_retrieval_workflow_seed_bundle.json | Bumps seed_version and revises workflow description/content/exemplars. |
| src/backend/services/tool_metadata_service.py | Revises schema-discovery vs incidence guidance; updates defaults (previews/type counts). |
| src/backend/services/registered_tool_capability_retrieval_service.py | Deletes the registered-tool semantic retrieval/index implementation. |
| src/backend/services/concept_relation_service.py | Implements page-first incidence hydration; adjusts relation preview batching and materialisation paths. |
| src/backend/services/agent_test_replay_mode_service.py | Adds trusted capability grant env parsing with exact scope matching and name validation. |
| src/backend/services/adaptive_turn_service.py | Introduces compact purpose index output; removes registered-tool semantic retrieval ranking. |
| src/backend/server/utils_flask.py | Removes prewarm of the deleted registered-tool semantic index. |
| src/backend/server/routes/von_routes.py | Wires AgentTest trusted capability resolution into /von/generate adaptive turns. |
| src/backend/mcp_server/vontology_mcp.json | Updates tool descriptions/input docs to reflect new coverage/incidence guidance and defaults. |
| src/backend/mcp_server/mcp_stdio_server.py | Aligns include_concept_preview default to False for predicate incidence. |
| src/backend/integrations/internal_mcp/catalogue.py | Aligns catalogue definitions/schemas and Jira update ordinary-turn effect metadata. |
| docs/engineering/von_workflow_language_manual.md | Updates documentation to describe purpose-index discovery (no semantic reranker). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/backend/services/concept_relation_service.py:1609
- Setting
_materialise_all_hits=Trueforcesfind_relations_with_argumentonto the unboundedquery_relationship_extent_indexpath even when there is no predicate filter. If the extent index is unavailable or times out, the current incoming-relations logic can fall back to a broad canonical aggregation, which is the high-cardinality scan this tool generally tries to avoid for deadline safety. This makes predicate-incidence/coverage discovery much more sensitive to transient extent-index outages.
Recommendation: when _materialise_all_hits=True and there is no exact predicate filter, treat an extent-index failure as a bounded/partial result (complete=False) rather than attempting the broad canonical aggregation fallback.
payload = find_relations_with_argument(
concept_id=concept_id,
argument_index=query_argument_index,
predicate_filter=predicate_filter,
relation_kind=query_relation_kind,
include_text_snippets=include_text_snippets,
# Incidence aggregation only exposes bounded sample groundings, so
# resolve previews there instead of for every raw relation hit.
include_concept_preview=False,
include_uncertain=include_uncertain,
uncertainty_mode=uncertainty_mode,
uncertainty_statuses=uncertainty_statuses,
_materialise_all_hits=True,
)
src/backend/services/tool_metadata_service.py:707
default_payloadhere impliesinclude_concept_previewdefaults toFalse, but the actual MCP entrypoints forfind_relations_with_argumentstill defaultinclude_concept_previewtoTruewhen the argument is omitted (e.g. internal MCP catalogue and stdio handler). This means the system is not actually “default expensive previews off” for relation reads unless the caller explicitly passes the flag, and it makesdefault_payloadmisleading as a representation of runtime defaults.
To match the PR goal and the guidance in the planner hint, the runtime defaults should also be flipped to False (or default_payload should avoid claiming a default it doesn’t control).
"default_payload": {"include_concept_preview": False, "limit": 20},
"planner_hint": (
"Use for content-bearing relationships after resolving the anchor. "
"Start predicate-filtered around limit 20 with previews off; hydrate "
"selected concepts only when needed. A hit proves existence, not list "
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/backend/services/adaptive_turn_service.py:647
- _bounded_capability_catalogue_output() always emits capability_page_projection. The updated tests indicate that projection should be omitted for non-exact discovery pages (where results are already compacted via purpose_index + per-capability discovery references), and only kept for exact-name pages where schema omission needs explaining. Keeping it unconditionally increases output size and contradicts the intended bounded output shape.
**base,
"next_offset": next_offset,
"capabilities": [dict(item) for item in entries],
"capability_page_projection": projection,
}
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/backend/services/concept_relation_service.py:1636
- _collect_all_argument_hits_for_incidence currently copies every hit via dict(hit) even though find_relations_with_argument is being called with _materialise_all_hits=True. For large relation sets (e.g. the 12k+ row cases covered in tests), this doubles peak memory by keeping both payload['hits'] and all_hits copies alive at once. Since these hit dicts are created locally by find_relations_with_argument and are only used for incidence aggregation, you can append dicts directly and only copy non-dict Mapping instances defensively.
batch_hits = payload.get("hits")
if isinstance(batch_hits, list):
all_hits.extend(
dict(hit) for hit in batch_hits if isinstance(hit, Mapping)
)
User outcome
Let the model choose the smallest dependable authorised plan for ordinary work, with direct tools, small compositions, and represented workflows compared as peers. Do this without adding a universal selector, task-specific route, authority gate, readiness gate, or finality mechanism.
Root cause
The existing live prompt and capability descriptions already told the model to prefer the smallest adequate path. The failure was in the interface actually shown to the model:
That made “equal footing” false in the model-visible context. Another prompt or selection gate would have compensated for, rather than corrected, that defect.
What changed
No supervision-specific prompt, noun route, person route, selector stage, workflow, retry policy, authority override, or finality patch was added. A contemplated read-only-workflow finality exception was deliberately removed because it did not cause the demonstrated choice failure and would have been compensating machinery.
Across
src/anddocs/, the final diff is a net 98 lines smaller than currentmain; the larger additions are regression tests.Validation
Deterministic
F,E9andgit diff --checkpassed.Exact gpt-5.6-luna real paths
The accepted read campaign used commit
656c70ad; final head differs only by the two test-only callable simplifications in7e7dd30d.gpt-5.6-luna, profile#V#openai_gpt_5_6_luna_responses_profile, cache off, andstore=false.hasNoteassertion, read back exactly one match, retracted it, and read back absence.canonical_publication=false.Scope and remaining observation
The change fixes the evidenced discovery/context inequality and the measured incidence-query cost. It does not bundle context projection, deadline/finality repair, workflow-worker readiness machinery, or a generic answer fallback. Relation retrieval is now correct on the accepted exact-Luna corpus, but its ~89k median prompt-token cost is still a material economy target for future measured simplification.
Jira: JVNAUTOSCI-2614