Skip to content

Run-metric fanout across detail joins #263

Open

Description

@cafzal

Status: Open — reproduced on main; no fanout guard in the ReAct answer path.

Impact: Detail joins can multiply an owner-level metric even when the SQL runs faithfully, which affects totals and business comparisons.

Evidence

Neither run_sql nor submit inspects join cardinality.

Reproduced on main with the default model. Asked "For each supplier, what is the total sourcing share percentage and the total quantity shipped?", the agent LEFT JOINed sourcing and asn on supplier and summed both. For the largest supplier it reported 107,994,000 and 573,044,580 instead of 6,000 and 9,550,743: each measure was multiplied by the other table's row count (17,999 ASNs and 60 sourcing rows).

Actions

Detect owner-to-detail fanout in submit from the join keys and the catalog's uniqueness: declared keys, sampled uniqueness, and #272. Return it to the model as a tool error so it projects at the owner grain, uses a unique-owner subquery, or pre-aggregates the detail.

Acceptance

Test owner metrics joined to 1, 2, and 19 detail rows. Require invariant owner values across direct projection and valid pre-aggregation, and reject SUM-after-fanout variants. Cover grouped and ungrouped SQL, cardinality uncertainty, and independent keyed-row oracles.

Review (a630ebd9): Reproduced on a SQLite supply-chain dataset; the oracle is each table aggregated separately.

Activity

  1. changed the title [-][P0] Run-metric fanout and stale-lineage filtering (OWNER-GSF-RUN-METRIC-FANOUT-006)[/-] [+][P0] Run-metric fanout across detail joins (OWNER-GSF-RUN-METRIC-FANOUT-006)[/+] on Sep 14, 2026
  2. changed the title [-][P0] Run-metric fanout across detail joins (OWNER-GSF-RUN-METRIC-FANOUT-006)[/-] [+][P0] Run-metric fanout across detail joins[/+] on Sep 14, 2026
  3. changed the title [-][P0] Run-metric fanout across detail joins[/-] [+]Run-metric fanout across detail joins[/+] on Oct 4, 2026
  4. added
    correctnessAnswers, queries, and predictions that are right and explainable
    bugSomething isn't working
    on Nov 16, 2026
  5. cafzal commented on Nov 18, 2026

    @cafzal
    CollaboratorAuthor

    @tomer-levin-nv @liavnave, flagging this as unowned. It's reproduced on main (details in the issue): "For each supplier, what is the total sourcing share percentage and the total quantity shipped?" returned 107,994,000 and 573,044,580 instead of 6,000 and 9,550,743. Nothing in flight covers it; I checked the open ReAct PRs and branches. The smallest fix I can see is a deterministic check in submit that flags an aggregate over a measure joined through a non-unique key, and returns it to the model. It sits in code you're actively changing, so who should own it? Happy to supply the fixture as a regression test.

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

    bugSomething isn't workingcorrectnessAnswers, queries, and predictions that are right and explainable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions