Skip to content

query prints the TRUNCATED banner when 0 nodes were cut #2601

Closed

Description

@austxio

Problem

The truncation banner prints even when nothing was truncated. Two real outputs from a production repo (graphify 0.9.25, 8,437-node graph):

[!] TRUNCATED: showing 91 of 91 nodes (~6000-token budget). The answer may be
among the 0 cut nodes

and, reproduced today at the tail of a query --context call --budget 6000 result:

... (truncated — 0 more nodes cut by ~6000-token budget. Narrow with context_filter=['call'] or use get_node for a specific symbol)

The message construction in graphify/serve.py at current HEAD interpolates cut_count into the banner without a zero guard, so the wording survives to today's source.

Why it matters more than cosmetics

The banner's audience is usually an agent, and agents act on it:

  • "The answer may be among the 0 cut nodes" teaches the reader to distrust a complete answer.
  • An agent following the banner's own advice issues follow-up narrowing calls (context_filter, get_node) to recover nodes that were never cut — pure wasted round-trips.

Suggested fix

Suppress the banner when cut_count == 0 (and when shown == total for the [!] TRUNCATED: showing N of N variant). If the budget was reached but no whole node was dropped, that is a complete answer and should render as one.

Activity

  1. yeti107 commented on Aug 11, 2026

    @yeti107

    Hi, id like to work on this if possible can i have it assigned to me?

  2. safishamsi commented on Aug 12, 2026

    @safishamsi
    Member

    Fixed in v0.9.41 (graphifyy==0.9.41 on PyPI). query only prints the truncation banner when nodes were actually cut; when only trailing edges overflowed the budget the banner is suppressed (and a genuine node truncation still warns). Thanks @ousamabenyounes (PR #2662).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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