Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Expose MCP freshness and provenance evidence for client trust decisions #786

Open

Description

@vvenegasv

What problem does this solve?

MCP clients currently receive code intelligence results without enough machine-readable evidence to decide whether those results are fresh, stale, partial, directly resolved, or inferred. This makes it hard for clients to know when to trust a response, when to prompt for re-indexing, or when to verify an answer directly against source code.

This is especially important for responses such as index_status, trace_path, and trace_call_path, where clients need compatibility-safe metadata about index freshness, repository state, coverage, and relationship provenance without breaking existing consumers.

Proposed solution

Add backward-compatible, additive response fields that expose freshness and provenance evidence:

  • Extend index_status with an evidence object containing index snapshot metadata, current Git HEAD comparison, tracked working-tree state, freshness status, coverage counters, and known limitations.
  • Extend trace_path and trace_call_path with optional edge_evidence for traversed relationships, including resolution strategy, confidence, candidate count, and evidence status where available.
  • Preserve existing response fields so current clients can ignore the new metadata safely.
  • Document the added fields clearly for client compatibility.
  • Add focused tests covering freshness/provenance behavior and safe handling of repository paths used in shell-backed Git checks.

Alternatives considered

No response

Confirmations

  • I searched existing issues and this is not a duplicate.

Activity

  1. added
    enhancement
    on Jul 2, 2026
  2. added
    editor/integration
    priority/normal
    on Jul 3, 2026
  3. DeusData commented on Jul 3, 2026

    @DeusData
    Owner

    Thanks for the proposal. Triage: this fits the MCP/editor-client trust track (#395) and overlaps with the existing provenance/freshness direction in #559.

    The useful constraint is backward-compatible evidence: clients should be able to tell fresh/stale/partial/resolved/inferred without existing consumers losing their current response fields. We should review this as additive metadata, with tests that strict MCP clients continue to accept the schemas.

  4. rudi193-cmd commented on Jul 5, 2026

    @rudi193-cmd
    Contributor

    Downstream trust metadata pattern — Willow cbm_* facade

    We needed clients to know when graph output is untrustworthy for measurement without abandoning CBM for discovery. Shipped in willow-2.0 sap/cbm_facade.py:

    • Every cbm_* response can carry a limitations map (F-001..F-008) — e.g. "fan-in may be collapsed", "verify aliased imports with grep"
    • cbm_verify_callers returns graph count vs grep count side-by-side with graph_only / grep_only deltas
    • cbm_status surfaces project slug, index freshness, and guardrail list at boot

    This is additive client-side provenance, not server freshness — but it matches your "backward-compatible evidence" constraint: consumers that ignore the extra fields still work; agents that read them can down-rank stale or ambiguous graph claims.

    Audit write-up: docs/audits/CODEBASE_MEMORY_MCP_TOOL_EVAL_ADDENDUM_2026-07-05.md

  5. added this to the 0.9.2-rc milestone on Jul 8, 2026
  6. psanchez-mwb commented on Jul 21, 2026

    @psanchez-mwb

    Adding a related use case that would benefit from this evidence.

    Client-side use case: agents (Claude Code, Codex CLI, etc.) currently query the graph without any built-in check on whether the returned data reflects the current HEAD. In practice this means an agent can answer "who calls X" or "where does Y live" from a graph that is days old and never surface the caveat, because there is no default policy that says "if stale, warn or refuse".

    Proposal (complementary to what #786 already covers): on top of the additive evidence fields already proposed here, add an opt-in server-side policy so read tools (search_graph, query_graph, trace_path, get_code_snippet, get_architecture) can:

    1. Refuse to answer when freshness.status == "stale" with a well-defined error the client MCP layer can catch, OR
    2. Prefix the payload with a machine-readable warning.stale = true block that agent frameworks can promote to a user-visible caveat.

    Config surface idea:

    stale_policy = "off" | "warn" | "refuse"   # default: "warn"
    stale_threshold_files = 5                  # or:
    stale_threshold_paths = ["src/critical/**"] # any change under these triggers stale
    

    Why this on top of #786: the evidence fields in #786 give the client the data to make a trust call. But every client would need to independently implement the same "if stale then X" logic, and in practice most agent contexts will not do that consistently -- I have seen this exact failure mode in a real session where the graph was anchored to a commit from three days back and the agent answered structural questions without disclaimer.

    Having the server enforce a default policy (with an opt-out flag) turns this from "hopefully the client does the right thing" into "the tool tells you it can't answer honestly", which is the safer default for automation.

    Happy to iterate on the config shape or send a PR if the direction fits the roadmap. Not a blocker for #786; this is a follow-up feature that leverages the evidence fields.

  7. KamHiggs commented on Oct 1, 2026

    @KamHiggs

    Hey guys, my name is Kamden, I created Higgs AI. I have a small controlled example that may help with the additive evidence discussed here and in #1734.

    AI disclosure: Codex is posting this on my behalf with my authorization. Claude executed the experiment; Codex inspected the saved records and pinned source. This comment was prepared with both assistants. It is not an independent execution replication.

    At commit 0f52d30c2964a5a538149f8b39846ba52517a020, built with scripts/build.sh on macOS arm64, a synthetic Python/C fixture produced these saved results through one-shot CLI calls:

    Fixture state Ordinary inbound trace_path, depth 1 Qualification available separately
    A00: target with no caller anywhere in the fixture 0 callers, eq Project contains an excluded directory
    A02: target called only from that excluded directory 0 callers, eq Exactly the same exclusion notice
    A04a: caller appended to an indexed file after indexing 0 callers before explicit reindex; 1 afterward Path coverage reports metadata_changed before reindex
    A04b: caller added in a new file after indexing 0 callers before explicit reindex; 1 afterward Path coverage reports not_tracked before reindex

    The useful distinction is narrow: the caller response does not carry the available scope qualification. eq is correct: it describes an untruncated graph traversal, not completeness of source extraction. The exclusion notice cannot distinguish A00 from A02 or establish that the excluded subtree contains a caller.

    Small supporting excerpts from the existing fixture and saved output

    Exact .cbmignore contents:

    excluded/
    

    Excerpt from shop/targets.py:

    def a00_unused_target():
        return "a00"
    
    
    def a01_direct_target():
        return "a01"
    
    
    def a02_excluded_target():
        return "a02"

    Complete excluded/legacy_caller.py:

    from shop.targets import a02_excluded_target
    
    
    def a02_legacy_caller():
        return a02_excluded_target()

    Executed CLI arguments, supplied to the pinned binary by the recorded environment launcher:

    cli trace_path --project h1eval --function-name a00_unused_target --direction inbound --depth 1
    cli trace_path --project h1eval --function-name a02_excluded_target --direction inbound --depth 1
    

    Saved response text (records 008 and 018; trailing blank lines omitted):

    function: a00_unused_target
    direction: inbound
    callers_total: 0
    callers_total_relation: eq
    callers: 0  (cols: qn hop)
    
    function: a02_excluded_target
    direction: inbound
    callers_total: 0
    callers_total_relation: eq
    callers: 0  (cols: qn hop)
    

    The full run also retained a direct-call positive control, which returned the correct caller. These are selected excerpts from the original fixture, not a separately executed reduced reproduction. The original fixture, commands and saved outputs are available if useful.

    An existing workaround is index_status for recorded exclusions/parse gaps, then check_index_coverage for relevant paths. detect_changes can suggest paths from a Git diff, but it does not certify freshness. A freshness check of the target's file alone would not establish freshness of its callers elsewhere.

    Would a short additive scope qualification on trace_path, identifying the indexed graph and pointing to recorded project coverage limitations, fit the direction here? It should not imply every project gap affects this symbol or that an absence of recorded gaps proves completeness. Alternatively, would you prefer a documentation change pointing users to the existing tools?

    Limits: the commands used temporary shared-daemon sessions; persistent watcher behaviour was not established. Dynamic calls can remain invisible without a recorded gap. No agent-accuracy benefit was measured, and this does not reproduce the TypeScript defect in #1682. No wrapper or CBM patch was implemented.

  8. DeusData commented on Oct 19, 2026

    @DeusData
    Owner

    Thank you for the newer controlled examples and for separating complete traversal from complete source coverage. The distinction between additive evidence and a server refusal policy is clear. Choosing the response contract versus a documentation-only step still needs a maintainer decision; no new API is being approved in this follow-up.

  9. DeusData commented on Oct 25, 2026

    @DeusData
    Owner

    Thank you for your patience. Sorry for the delay. The response-evidence contract versus documentation-only approach is still awaiting a maintainer decision. I’ll follow up soon.

  10. DeusData commented on Dec 3, 2026

    @DeusData
    Owner

    Thank you for your patience. Sorry for the delay. The response-evidence contract versus documentation-only approach is still awaiting a maintainer decision. I’ll follow up soon.

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

    editor/integrationenhancementpriority/normal

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions