Skip to content

context_ops semantic schema retrieval missing is_core filter (ADR-063 premise gap) #1900

Closed

Description

@malibio

Observation

workspace_context's semantic schema retrieval (packages/core/src/ops/context_ops.rs:296-299) has no is_core filter:

Ok(results) => {
    let schemas: Vec<SchemaNode> = results
        .into_iter()
        .filter_map(|(node, _score)| SchemaNode::from_node(node).ok())
        .collect();          // ← no is_core filter

Retrieval is scoped only by node_type == "schema", and text/task/date are stored schema nodes with embeddable content. The sibling branch writing into the same relevant_schemas vector (packages/daemon/src/services/local_agent_service.rs:1878, the recently-created-schema debounce-bypass injection) does guard:

if schema.is_core {
    continue; // skip built-in types
}

One branch guards, the branch it augments doesn't.

Why it matters

#1897 (create_node guidance) tells the model to use a bare property key when the node's type appears in the RELEVANT ENTITY TYPES block (treating presence there as proof the type is user-defined), and a custom:-prefixed key on built-in types. If a core type reaches that block via unfiltered retrieval, the model reads it as user-defined and writes a bare key onto a core type — the exact ADR-063 violation #1897 was fixed to prevent (update_schema rejects this; create_node does not currently validate it).

Currently latent, not live

Seeding uses raw store.create_node, which does not queue_root_for_embedding, and backfill_schema_description_subtrees skips schemas without a legacy description field (core schemas have none) — so core schema nodes are likely un-embedded and unretrievable on a fresh DB today. Nothing in the code prevents it, though: any future backfill, re-index, or touch that embeds core schema nodes silently activates this path, with no test failing to catch it.

packages/core/src/ops/skill_ops.rs was also checked as a suggested defense-in-depth site — its unscoped-schema-metadata fallback (around line 207) already guards with !s.is_core, so no change needed there.

Fix

Acceptance criteria

  • context_ops.rs's semantic schema retrieval filters out is_core schemas
  • Test pins that a core schema, even if embedded/retrievable, never appears in the rendered RELEVANT ENTITY TYPES block from this path

Found during code review of #1897, folded into #1899's investigation and split out per that issue's closing discussion.

Activity

  1. malibio commented on Aug 1, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline (worktree issue-1900-schema-iscore-filter): all suites passed except the known pre-existing flake core-plugins.test.ts > should resolve viewer components for plugins with viewers (5000ms default timeout in fresh worktrees, passes with headroom given --testTimeout=60000; unrelated to this change).

  2. self-assigned this
    on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions