Skip to content

Keep node links from summarised turns grounded, so a long chat's correct link is not replaced with a request to confirm #3508

Closed

Description

@malibio

Problem

In a chat long enough to be summarised, a correct link to a node that an earlier turn looked up or created is replaced with "I'd like to help with that. Could you confirm what you'd like me to do?".

The fabricated-id check in packages/agent/src/local_agent/agent_loop.rs accepts a nodespace:// id in a reply only if a tool produced it in this session: this turn's tool results, tool messages in history, or the system's own records of earlier turns' lookups and writes (grounded_node_uris_from_history). When maybe_summarize_history drains old turns into one [Conversation summary] system message, those tool messages and records go with them. The summary is the model's text, so it is deliberately not read for grounding (CONVERSATION_SUMMARY_PREFIX). Every id that only those drained turns produced is then treated as invented.

The check errs in the safe direction, a real link refused rather than a dead one let through, and the cost is recorded in the comment on grounded_node_uris_from_history and in architecture/prompt-skill-system.md. It is still a wrong answer to the user, in exactly the long chats where earlier records are most likely to be referred back to.

Fix

When maybe_summarize_history drains messages, collect the nodespace:// ids grounded by the drained Tool messages and system-written System messages (the same rule grounded_node_uris_from_history applies, so the summary itself contributes nothing). Keep them in a separate, system-written message beside the summary, for example "Nodes referenced earlier in this conversation: …", which the grounding rule reads like any other system record. Ids the user typed or the model wrote stay ungrounded.

A bounded list (the most recent N) keeps a very long chat's prompt in check.

Acceptance criteria

  • After summarisation, an id that a drained tool result or system record produced is still grounded.
  • An id that appeared only in drained user or assistant text, or only in the summary, is still not grounded.
  • The carried-forward list is written by the system, bounded, and survives a second summarisation.
  • Unit tests cover both directions, and each fails without the change.
  • The comment on grounded_node_uris_from_history and the paragraph in architecture/prompt-skill-system.md no longer describe this as an accepted cost.

Activity

  1. malibio commented on Oct 3, 2026

    @malibio
    CollaboratorAuthor

    Baseline — Frontend: 309 test files passed, 5606 tests passed

  2. self-assigned this
    on Oct 3, 2026
  3. added a commit that references this issue on Oct 3, 2026
    a2765fd
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