Skip to content

Agent can't traverse a schema relationship to complete a request: two prompt gaps confirmed live #2911

Closed

Description

@malibio

Summary

Probed a relationship-modeled scenario live (gemma-4-e4b-q4km, scripts/aichat.ts ask, 5 trials per condition) to see whether the agent can use a graph relationship to satisfy a request that names an entity only indirectly — "The incident Rowan was on call for — mark it resolved," where incident_report declares on_call -> person (reverseName incidents_on_call).

Found and fixed two of three chained gaps; the third is a separate, pre-existing issue.

Data model used

schema incident_report:
  fields: resolved: boolean
  relationships: on_call -> person (reverseName: incidents_on_call)

3 person nodes (Rowan, Dana, Sam), 3 incident_report nodes, each linked via on_call.

Traversal at the CLI/data layer works correctly (nodespace relationship get <Rowan-id> --type incidents_on_call returns the right incident). This is not a data-layer bug — it's a prompt/tool-selection problem.

Gap 1 — relationship names never reach the compact schema block (FIXED)

EntityTypeDescriptor::render_line() (packages/core/src/ops/entity_types_block.rs) deliberately excludes relationships from the EXISTING SCHEMAS block — a documented prior scope decision. Relationships DO reach the model via schema_metadata (the search_skills tool response, EntityTypeDescriptor::to_json()), but only if the model calls search_skills for that type. In this scenario it never did — Stage-2 routing pre-selects skill/operation/schema candidates from lightweight metadata, without a search_skills call, so the model saw only the compact block.

Before: 5/5 trials called search_nodes with a hallucinated assigned_to property filter (doesn't exist). Never called get_related_nodes. Never mentioned on_call.

Fix: render relationships into render_line():

if !self.relationships.is_empty() {
    let rendered: Vec<String> = self.relationships.iter().map(|r| match &r.target_type {
        Some(t) => format!("{}->{}", r.name, t),
        None => r.name.clone(),
    }).collect();
    line.push_str(&format!(" ~> {}", rendered.join("; ")));
}

Renders as: - incident_report "Incident Report" -> resolved: boolean ~> on_call->person

After (this patch alone): 5/5 still failed to complete the task, but the model now correctly named on_call in its response — it just tried to express it as a search_nodes filter (on_call.person), which is invalid syntax, instead of calling get_related_nodes.

Gap 2 — no signal that a ~> name is a relationship, not a filterable property (FIXED)

search_nodes's description didn't warn the model off putting a relationship name in filters, and get_related_nodes's description didn't cross-reference the ~> syntax the model had just learned from gap 1's fix.

Fix, packages/agent/src/local_agent/tools.rs:

  • search_nodes description, appended: "A name shown after '>' in an EXISTING SCHEMAS line is a relationship, not a filterable property — 'filters' only accepts a type's own fields (before '>'). To find a node connected via a relationship (e.g. 'the incident Rowan was on call for'), use get_related_nodes with that relationship's name, not a filter here."
  • get_related_nodes description, appended: "Use this — not search_nodes's 'filters' — for any name shown after '~>' in an EXISTING SCHEMAS line; that syntax marks a relationship, and 'filters' only accepts a type's own fields."

After (both patches): 5/5 trials called get_related_nodes with the correct relationship name (on_call) and — once a seeding bug on my end was fixed so the entity tier could resolve "Rowan" to a real id — 5/5 correctly traversed to the right incident (get_related_nodes returned is_error=false, correct node, every trial).

Gap 3 — "mark X resolved" routes to a skill without a write tool (NOT FIXED — separate issue)

Even with gaps 1 and 2 fixed and the traversal succeeding, the agent could not complete the task: Stage-2 routing selects "Conflict Resolution" (score 0.872, beating "Relationship Management" 0.760 and "Node Merge" 0.749) for this message, and the tool list under that skill is read/search/conflict-only — no update_node. The model correctly identifies the incident and the resolved field, then reports it has no tool to make the change.

This is upstream of relationship-modeling entirely — it's the routing layer mapping "mark ... resolved" to conflict-resolution semantics rather than a status-update skill. Filing as context here since it was surfaced by the same probe, but it's a distinct root cause (skill routing / scoring) and should be scoped separately.

Acceptance criteria

  • render_line() includes relationship names (or equivalent visibility) in the compact schema block
  • search_nodes/get_related_nodes descriptions (or equivalent guidance) steer the model to use relationship traversal instead of an invalid property filter
  • Re-run of this scenario (or an equivalent eval fixture case) shows the agent correctly traverses on_call/incidents_on_call to find the target node
  • Gap 3 (routing skips write tools for "mark resolved" phrasing) is filed as its own issue, out of scope here

Evidence

Manual probe outside the eval harness (scripts/aichat.ts ask, gemma-4-e4b-q4km, isolated NODESPACE_HOME), 5 trials per condition:

Condition Tool called Traversal succeeds Task completes
Before (merged main) search_nodes (hallucinated filter) n/a 0/5
+ relationship rendering only search_nodes (invalid on_call.person filter) n/a 0/5
+ tool description cross-refs get_related_nodes, correct args 5/5 0/5 (blocked by gap 3)

🤖 Generated with Claude Code

https://claude.ai/code/session_015tDgtJd9NVx1Jzr6Xi46UH

Activity

  1. malibio commented on Sep 25, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 269 files / 5313 tests passed

  2. self-assigned this
    on Sep 25, 2026
  3. malibio commented on Sep 25, 2026

    @malibio
    CollaboratorAuthor

    Live A/B: re-run of this scenario

    Setup: gemma-4-e4b-q4km, isolated daemon (NODESPACE_HOME, served_db_path checked), scripts/aichat.ts ask "The incident Rowan was on call for — mark it resolved", 5 trials per arm. Both arms used one identical seed: an incident_report with on_call -> person (reverseName incidents_on_call) plus 3 person/incident pairs. NODESPACE_PROMPT_DUMP confirmed the arms differ in their prompts.

    Arm Schema line the model sees Tool calls Traversal
    main - incident_report "incident_report" -> resolved: boolean 5× search_nodes per trial, all errors (invented person.name filter) 0/5
    this branch ... -> resolved: boolean ~> on_call (person) get_related_nodes(id=<Rowan>, relationship_type=on_call) → get_node(<search index corruption>) 5/5, correct incident every trial

    Completion is still 0/5, as expected: the turn routes to Conflict Resolution, which has no update_node. That's gap 3, filed as #2912.

    Notes

    • Format change vs. the issue's sketch: the render is on_call (person), not on_call->person. The render_line grammar reserves -> for introducing the field list and uses it nowhere else, so a second -> would read as another field list. A golden test now pins -> to a single occurrence per line.
    • Seeding pitfall (probably the "seeding bug" mentioned above): nodespace node create --type person --content Rowan produces title: "", because person's title template is {first_name} {last_name}. The MENTIONED ENTITIES tier resolves by title, so "Rowan" never resolves and even the patched arm falls back to a filter (0/5). Set first_name when seeding persons.
    • The tool-description example is neutral ("the contract a given vendor signed"). Quoting the Rowan prompt trips guidance_is_not_contaminated_by_eval_prompts, because matrix scenario 13 uses that exact prompt. That scenario models on_call as a text field, so it doesn't exercise this path.
  4. added a commit that references this issue on Sep 25, 2026
    0336e3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions