Skip to content

Prevent ai-chat nodes from being referenced (mentions, wikilinks, source_chat_node) #3155

Closed

Description

@malibio

Overview

ADR-061 §8 originally specified that a dangling source_chat_node reference (a node an agent created, pointing back at the private conversation that produced it) should render as a "known-but-inaccessible" marker rather than a broken link or error, once ai-chat nodes became access-restricted (#1740).

Investigating #1740 found that source_chat_node does not exist anywhere in the codebase — no schema field, no write path, no read path. It is prose in ADR-061, not a shipped mechanism. The same is true of general-purpose references to ai-chat nodes: @mention/[[wikilink]] references to other node types are a live, tested mechanism (extract_mentions, node-ref-inline.svelte), but nothing currently creates one pointing at an ai-chat node either.

Given that, the simpler and more robust fix is prevention, not graceful degradation: if nothing can ever reference an ai-chat node as a target — neither a user-authored @mention/[[wikilink]], nor a future source_chat_node provenance link — then the dangling/inaccessible-reference case ADR-061 §8 was written to handle can never occur. This issue supersedes ADR-061 §8: with references blocked at creation, there is nothing for a "known-but-inaccessible" marker to render.

Problem Statement

Once ai-chat nodes are private by default (#1740), any reference that can point at one becomes a potential leak surface or a broken-UX surface once the referenced chat is inaccessible to the reader:

  • A [[wikilink]] or @mention typed into some other node's content, targeting an ai-chat node, would resolve to a private conversation's title/content preview for readers who can't otherwise see it — a partial content leak — or dangle for those who can't resolve it.
  • A future source_chat_node property (provenance: "this task was created from this conversation") is a reference in the other direction with the same problem.

Neither of these mechanisms currently blocks referencing an ai-chat node as a target.

Proposed Solution

Block ai-chat nodes from being reference targets at the point references are created/validated, covering both directions:

  • User-authored references (@mention, [[wikilink]]): reject or strip a reference whose target resolves to an ai-chat node, at write time (wherever extract_mentions/mention persistence currently runs) — following whatever precedent exists for type-based reference restrictions, if any, or establishing one.
  • Agent provenance (source_chat_node, not yet built): when that mechanism is eventually implemented, it must not be buildable in a way that stores a reference to an ai-chat node. This issue should land before or alongside whatever issue introduces source_chat_node, so the constraint exists from that mechanism's first line of code rather than being bolted on after.

The exact validation point(s) and whether this is a hard rejection vs. silent exclusion should be determined against the current mention/reference pipeline.

Acceptance Criteria

  • A @mention/[[wikilink]] targeting an ai-chat node is rejected or excluded at write time
  • Regression test: attempting to reference an ai-chat node via mention/wikilink does not create a resolvable reference
  • architecture/ai-chat-node.md and ADR-061 are updated to reflect that referencing an ai-chat node is prevented rather than gracefully degraded — ADR-061 §8's known-but-inaccessible marker is superseded by this issue and should be marked as such
  • Any future work introducing source_chat_node (or any other reference-to-ai-chat mechanism) is documented as needing to honor this constraint

Architecture Impact

  • ADR-061 §8 is superseded by this issue's prevention-based approach.
  • ADR-061 §5 (chats sync as regular nodes) is unaffected — this only blocks reference targeting, not the chat node's own sync/existence.

Dependencies

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions