Skip to content

P0: Cross-layer retrieval returns UI noise and drives agents into broad fallback #565

Description

@mohanagy

Problem

A real activation test against openstatusHQ/openstatus with @lubab/madar@0.31.3 used this natural codebase question:

Trace how a failed monitor check becomes an incident, triggers notifications, and affects the public status-page status in this repository. Cite the exact files and symbols involved, identify any inconsistent status-computation paths, and clearly state any remaining uncertainty. This is read-only; do not change files.

Automatic activation worked and Madar was used before raw repository context. Retrieval quality did not:

  • Claude called Madar roughly ten times;
  • most packs repeatedly surfaced unrelated status-page UI rendering components;
  • Madar eventually surfaced apps/workflows/src/checker/alerting.ts, but did not assemble the end-to-end backend flow;
  • Claude then used direct reads, grep, and shell discovery to finish the answer;
  • the useful final answer was attributable primarily to raw source inspection, not the graph pack.

The missing flow crosses boundaries that a call graph alone does not naturally connect:

  • Go checker failure handling;
  • a hard-coded HTTP/Cloud Tasks route boundary;
  • TypeScript workflow ingestion;
  • writes and reads through incidentTable, monitor.status, and statusReport;
  • provider notification dispatch;
  • tRPC, JSON-feed, and Connect-RPC status-page read models.

This is a real-world follow-up to #552 and #555. Their machinery is present, but their intended agent outcome is not achieved for this cross-layer query.

Expected behavior

For a multi-obligation runtime-flow question, Madar should internally decompose the request, retrieve evidence for each obligation, expand across structural/data/integration boundaries, merge the cumulative evidence, and return one actionable answerability contract. The agent should not need to invent ten follow-up queries.

Proposed retrieval stages

  1. Detect the question's obligations: failure source, transport, incident persistence, notification dispatch, public read model, and inconsistencies.
  2. Retrieve diverse anchors per obligation rather than taking one global top-k dominated by UI vocabulary.
  3. Expand through callers/callees/imports plus route literals, shared persistence symbols, and writer/reader relationships.
  4. Merge, deduplicate, and rescore cumulative evidence after one or two bounded recovery attempts.
  5. Return exact missing obligations and verification targets, or terminal insufficient with a scoped fallback allowance.

Acceptance criteria

  • Add a reproducible OpenStatus packed-artifact receipt for the exact prompt, without committing the external repository contents.
  • Add a small committed regression fixture that represents a cross-language or cross-service flow through a route boundary and shared persistence state.
  • Retrieval identifies direct evidence for all five answer obligations: failure/transport, incident state, notifications, public status computation, and inconsistencies.
  • The real OpenStatus pack includes relevant evidence from the checker, workflow, schema/service, and status-page layers.
  • At least 70% of selected files in the receipt are human-judged relevant, with no more than two unrelated UI files.
  • One initial retrieval plus at most two bounded internal recovery attempts produces the cumulative result.
  • A normal Claude or Codex session needs no more than two attributable Madar tool calls for the question.
  • verify_targets permits only its listed targets; broad raw search is allowed only for terminal insufficient with broad_search_fallback: allowed.
  • The successful agent run uses no repo-wide grep/glob, shell discovery, or Explore subagent.
  • Retrieval reasons expose which obligations, communities, and fallback stages changed the result.
  • Expected OpenStatus filenames/symbols exist only in evaluation data; none are added to production retrieval rules.
  • Claude and Codex each pass three consecutive documented trials before a release claim is made.
  • Final answers receive human semantic review and are no worse than the direct-search baseline.

Success metrics

  • first useful cumulative pack within 10 seconds on a warm graph;
  • no more than two agent-visible Madar calls;
  • complete obligation coverage;
  • selected-file precision >= 70%;
  • zero unauthorized broad fallback;
  • fewer total repository tool calls than the direct-search baseline.

Relevant code

  • src/runtime/retrieve.ts
  • src/runtime/retrieve/conceptual-fallback.ts
  • src/runtime/retrieve/slicing.ts
  • src/runtime/context-pack.ts
  • src/runtime/mcp-response-evidence.ts
  • src/contracts/retrieval-plan.ts
  • tests/unit/retrieve-conceptual-fallback.test.ts
  • tests/unit/pack-quality-fixtures.test.ts
  • docs/benchmarks/suite/

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions