Skip to content

Decide: turn CGIS_AUTO_REFRESH on by default #540

Open

Description

@zaebee

Split out of #175.

#538 added an opt-in refresh: with CGIS_AUTO_REFRESH=1, every graph-reading MCP tool runs an incremental ingest first when the graph is STALE. It shipped off by default, because it makes read tools write the database and can add a full rebuild's latency to a query.

What to decide after a release of real use

  • Flip the default to on (and keep CGIS_AUTO_REFRESH=0 as the way out), or keep it opt-in.
  • Whether a refreshed answer should carry a one-line note in the tool output. Today the refresh is logged only to stderr, and the output shape doesn't change.

Evidence to gather first

  • How often a refresh turns into a full rebuild, and its latency on large repos (owner-api; the FastAPI backend at 10k nodes / 38k edges). The rebuild cost is what the per-file cache issue opened alongside this one would cut.
  • Any "database is locked" or failed-refresh lines in MCP logs.

Activity

  1. zaebee commented on Oct 2, 2026

    @zaebee
    OwnerAuthor

    An input for the decision: colbymchenry/codegraph (MIT) defaults to always-on auto-sync, but it also has a cheaper per-answer safety net we could adopt whatever this issue decides.

    • Pending banner: while the watcher's debounce is pending, any tool response that references a pending file gets a ⚠️ banner naming it and telling the agent to Read it directly. Pending files the answer doesn't touch go in a small footer instead.
    • Stale-answer refusal (src/mcp/answer-freshness.ts): when auto-sync is degraded, it re-hashes (sha256) every file that fed the answer, with a budget of 200 files / 8 MB / 250 ms. If any file changed, or couldn't be checked within budget, it refuses with "cannot answer from this index" rather than answering confidently and wrongly.
    • Connect-time catch-up: a (size, mtime) stat, with a content-hash fallback, before the first query, so edits made between sessions (git pull, another editor) are absorbed.

    Our freshness() is repo-wide. A per-answer check that hashes only the answer's files against files_state is cheap. It would make "off by default" much safer, or it could be the default while full refresh stays opt-in.

    Notes: research/competitor-codegraph.md (idea 6).


    Generated by Claude Code

  2. added
    questionFurther information is requested
    could-haveNice for AI agents and UX
    on Oct 13, 2026
  3. added this to the Agent UX (MCP) milestone on Oct 13, 2026
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

    could-haveNice for AI agents and UXenhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions