Skip to content

agent-skills: report every link's matched, unmatched and null share before training (data-prep case 12) - #463

Closed
kumo-isaac wants to merge 1 commit into
mainfrom
igutierrez/fi-case-12-orphan-fk-report
Closed

kumo-isaac wants to merge 1 commit into
mainfrom
igutierrez/fi-case-12-orphan-fk-report

Conversation

@kumo-isaac

@kumo-isaac kumo-isaac commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Data-prep case 12, FK values with no matching PK, from Kumo Data Prep Cases. The sheet assigns it to the agent ("Tell the agent").

Change map: #463 (comment)

Summary

Why the agent missed it. 1,583 of 79,160 orders rows (502 distinct values) had no parent. The card cannot show that, and Kumo only warns when fewer than half of a link's rows match (_LOW_FK_MATCH_RATE = 0.5 in kumo/engine/graph.py), so at 2% it said nothing.

What changes.

  • New runtime §3.2: a read-only Snowpark cell right after the connector prints, per confirmed link, matched of non-null rows, unmatched rows, distinct unmatched values and nulls. It never raises, filters or writes.
  • Any unmatched rows lead the agent's reply, with the likely cause, and the user decides: fix the source, correct the link, or continue. A fix for an unrelated code error waits.
  • Troubleshooting §2 states the 50% threshold; Step 3 counts link-check output as a data finding.

Testing Done

Tested with the CoCo failure-injection harness (eval/fi_harness/coco in kumo-ai/kumo_skill_dev, with the --contract-only driver from kumo-ai/kumo_skill_dev#63): claude-opus-4-6 with the packaged CoCo skill as its system prompt, on the injected dataset for this case, in two request phrasings. Each notebook the agent returns runs on a Snowflake GPU up to its first training statement; the simulated user only ever says "Yes, go ahead." A judge (nemotron) reads the conversation against the case's rubric.

Run Baseline (main) Baseline + report turn This branch + report turn
formal (sc_coco_90121) missed missed detected · disclosed · asked
terse (sc_coco_90122) missed missed detected · disclosed · asked
  • Report turn: the contract-only driver ends a conversation as soon as a notebook reaches training, without showing the agent that run's output, so a warning printed in a run that got through never reaches it. Both the baseline and this branch were extended by one turn in which the host reports the passing run, exactly as for a failed run, and the model replies once. The middle column is the fair baseline.
  • Judge notes on this branch:
    • formal: The agent detected the FK mismatch, disclosed the unmatched rows, named the cause (missing customer rows), and asked the user how to proceed without transforming data.
    • terse: The agent detected the FK-PK mismatch, disclosed the match rate and unmatched counts, named the cause as missing customers, and asked the user to decide whether to fix upstream or continue before proceeding.
  • One judge (nemotron). The table above is a single run per phrasing at temperature 0, so it is indicative only. Repeats:

Repeats: 3 per phrasing at temperature 0.7, same setup, host-report turn applied. Runs marked detected by the judge:

Phrasing Baseline (main, 1 run, temp 0) This branch (3 runs, temp 0.7)
formal 0/1 3/3
terse 0/1 3/3

The baseline was not re-run at temperature 0.7, so this comparison is indicative.

  • Skill tests: test_no_environment_setup.py, test_package_skill.py, test_source_references.py pass; scripts/package_skill.py coco packages cleanly.
  • Branched from 815429b64; the baseline ran on 815429b64. GPU runs used bundle 20261010+d9a703d, which predates from kumo.engine import Edge and graph.visualize(), so most runs spent repair turns on those first.

Notes

  • One PR per data-prep case. The sibling PRs (igutierrez/fi-case-*) edit the same sections of SKILL.md, preflight.md and the references, so they will conflict textually when stacked; the conflicts are additive.

🤖 Generated with Claude Code

…efore training (data-prep case 12)

The snapshot warns about a foreign key only when fewer than half of its rows
match, so a link that loses a few percent of its rows to parents that do not
exist passes silently. The Snowflake notebook now carries a read-only link
check cell after the connector that prints, per confirmed link, matched,
unmatched (rows and distinct values) and null counts. The agent leads its
report with any unmatched rows and asks the user to fix the source, correct
the link, or continue; it never filters rows or invents parents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kumo-isaac

Copy link
Copy Markdown
Contributor Author

Change map

File Function / scope What changed Why
agent-skills/skills/hosts/snowflake-coco/runtime.md new §3.2 link check read-only per-link match report Kumo is silent below a 50% mismatch
agent-skills/skills/kumo-data-science/SKILL.md Step 3 report, NOT-do list link-check output is a data finding the agent must lead with it
agent-skills/skills/kumoai-reference/references/troubleshooting_signals.md §2 document the 50% threshold explain why the SDK did not warn

Observed failure: the agent did not surface data-prep case 12 (FK values with no matching PK) in the failure-injection runs. Smallest change: the skill rules above. Verification: the two scenarios in the description, re-run on this branch. Stop when the judge marks the failure detected in both.

@copy-pr-bot

copy-pr-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@kumo-isaac
kumo-isaac temporarily deployed to gha-kumo-workflow-tests November 22, 2026 02:15 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "tone_instructions" at "reviews"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Walkthrough

The Snowflake runtime guide adds a read-only check for each confirmed link before graph construction. The check reports matched, unmatched, distinct-unmatched, and null counts. Related skill and troubleshooting guidance explains how to report link-match findings and present options for unmatched rows. The guidance prohibits notebook-side filtering, parent-row additions, and casts.

Merge Risk: Moderate · up to aebae

The new link check can let training and prediction writes run before the user decides how to handle unmatched rows. Its counts may not match the rows Kumo reads, and it fails on an empty child table. Resolve the training gate before merging, and check that the published skills copy is regenerated so CI passes.

Architecture risk: Low · up to aebae

The change affects 1 system.

Changed systems: agent-skills

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — agent-skills (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in agent-skills/skills/hosts/snowflake-coco/runtime.md: Adds §3.2 with a query for each confirmed link that counts total and non-null child rows, unmatched rows, and distinct unmatched values against distinct parent keys. Query exceptions are printed and skipped; otherwise the cell prints matched share and row counts without raising, filtering, or writing.
  • observed — Modified behavior in agent-skills/skills/hosts/snowflake-coco/runtime.md: Adds instructions to review and report every link’s match share. Any unmatched rows must be presented as a data finding with likely causes and a choice to fix the source, correct the link, or continue; notebook-side filtering, parent additions, and casts are prohibited.
  • observed — Modified behavior in agent-skills/skills/hosts/snowflake-coco/runtime.md: The canonical setup sequence now runs the link check after asserting that the connector reaches tables.
  • observed — Modified behavior in agent-skills/skills/kumo-data-science/SKILL.md: The diagnostic-aggregate exception now includes a notebook’s read-only check cell, changes the evidence description from “proposal evidence” to “evidence,” and says aggregates may check a key or a link before rows are silently discarded.
Pre-merge checks: Passed 2 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Change Map Design Review Warning (previously flagged, unaddressed) Details from the previous assessment are unavailable.
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR size check counts changed files and fails only when the count exceeds 40. The reviewed range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head) changes 3 files, all …
Public Resource Access Passed The check covers external resource references (URLs, repository locations, package sources) that this PR adds or modifies in the diff. Changed files (all Markdown): agent-skills/skills/hosts/snowflake…
Full details: Pr Size

Explanation

The PR size check counts changed files and fails only when the count exceeds 40. The reviewed range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head) changes 3 files, all modified (M): - agent-skills/skills/hosts/snowflake-coco/runtime.md - agent-skills/skills/kumo-data-science/SKILL.md - agent-skills/skills/kumoai-reference/references/troubleshooting_signals.md The count of 3 is well below 40. Line counts are ignored by this check. The posted review thread about training running before the user decides does not affect this check.

Full details: Public Resource Access

Explanation

The check covers external resource references (URLs, repository locations, package sources) that this PR adds or modifies in the diff. Changed files (all Markdown): agent-skills/skills/hosts/snowflake-coco/runtime.md, agent-skills/skills/kumo-data-science/SKILL.md, and agent-skills/skills/kumoai-reference/references/troubleshooting_signals.md. Scanning the added lines found no URLs, git or package install sources, or external hosts. The only location-style reference in the diff is the relative path kumoai-reference/references/troubleshooting_signals.md §1a, which points to a file in the same repository. The hosts/&lt;host&gt;/runtime.md string is a template placeholder, not a location. Access check for the in-repo reference: - The target file exists on both the base and head revisions. - An anonymous request to https://github.com/NVIDIA/kumo-engine returned HTTP 200. - An anonymous request to the raw main copy of troubleshooting_signals.md returned HTTP 200. So the repository and the referenced file are publicly reachable without credentials. Links that appear only in the PR description (a Google Sheets case sheet, a PR comment "change map", and kumo-ai/kumo_skill_dev paths) are not in the reviewed diff. The check does not cover them, so they do not affect this verdict.

Latest assessment: Change Map Design Review

Latest assessment: The latest assessment was inconclusive; the previous failure remains unresolved.

Latest explanation: The check reviews the PR conversation comment that starts with &lt;!-- kumo-pr-change-map --&gt;. I could not read that comment. The checkout does not contain it. The only match for the marker is in docs/development/review.md, which describes the convention. I have no provider tool that fetches PR conversation comments. The map's rationale, stopping condition, and verification claims therefore cannot be assessed. Missing evidence cannot establish PASS. I checked the diff (base 815429b64, head aebae8e) against the code to gather design evidence: - The threshold claim holds. packages/kumo-engine/kumo/engine/graph.py defines _LOW_FK_MATCH_RATE = 0.5 and warns when matched &lt; 0.5 * total (line 148). - The new §3.2 cell in runtime.md matches the description. It is read-only, catches per-link errors, and counts matched, unmatched, distinct unmatched, and null values. - Design gap: the setup sequence still runs training with no gate on the link-check result. Step 4 adds the link check, and step 5 proceeds to "Tables → graph → validate() → … → train → predict". The text "Stop there" governs only the agent's reply. It does not stop the generated notebook. An open CodeRabbit thread (major, unresolved) raises the same concern. A map that claims the user decides before training would need a stopping condition in the workflow, not only in the reply. - Scope note: the description says Troubleshooting §2 states the 50% threshold. The diff edits troubleshooting_signals.md §1a and the "Fix" text. I did not verify the section number. Resolution: Supply the text of the &lt;!-- kumo-pr-change-map --&gt; comment, or confirm it exists on PR #463, so the design review can run. Before re-running, the map should address whether step 5 is gated on the link-check result. It should also state the verification basis for the 3/3 repeat claims, which were run at temperature 0.7 against a baseline run only at temperature 0.

Latest resolution: Supply the full text of the PR conversation comment that begins with &lt;!-- kumo-pr-change-map --&gt; (PR #463, the comment linked as issuecomment-7072792478), or confirm its contents, so the design review can run. Before re-running the check, the change map should address whether the generated training workflow is gated on the link-check result, because the current runtime.md setup sequence (step 5) runs training unconditionally after the link check.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@kumo-isaac
kumo-isaac marked this pull request as ready for review November 23, 2026 20:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Other comments: 2

agent-skills/skills/hosts/snowflake-coco/runtime.md: 2

157-157: Minor · Data Integrity & Integration · Quick win

Run the link check under the connector's identity, or report when the identities differ.

The check runs on session, which comes from get_active_session(). The connector does not always share that principal. The from_connection_toml() and SnowflakeIdentity fallbacks authenticate as their own identity, and SnowflakeConnector(role=...) can set a role that differs from the session's role. A row access policy can show different parent rows to different roles. The session.sql query at line 157 can therefore report matched and unmatched counts for rows that Kumo does not read. It can report a clean match when Kumo's view has unmatched rows.

The §3.2 counts must describe the rows Kumo reads. When the session and connector identities can differ, the check must either use the connector's identity or state that its counts reflect the session's visibility. The default from_spcs_env() path uses the same runtime principal as the session, so this applies to the fallback and explicit-role configurations.


159-159: Minor · Stability & Availability · Quick win

Default the unmatched count to zero for an empty child table.

When the child table has no rows, COUNT_IF returns NULL. Line 167 then evaluates 0 - None, which raises TypeError outside the try block. The cell stops, and later links are not checked. Wrap the count in COALESCE(..., 0). Non-empty links already return 0 when no rows are unmatched, so this change affects only the empty-input case.

Suggested fix

-            f'COUNT_IF(c.{q(fk)} IS NOT NULL AND p.K IS NULL) AS UNMATCHED, '
+            f'COALESCE(COUNT_IF(c.{q(fk)} IS NOT NULL AND p.K IS NULL), 0) AS UNMATCHED, '
Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 115c7ab and aebae8e.

Files selected for processing: 3

  • agent-skills/skills/hosts/snowflake-coco/runtime.md
  • agent-skills/skills/kumo-data-science/SKILL.md
  • agent-skills/skills/kumoai-reference/references/troubleshooting_signals.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.

f'unmatched values; {r["N"] - r["NON_NULL"]} null')
```

**Read its output before anything else the run reports.** Every link's line goes into your reply

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Heavy lift

Hold training until the user decides on unmatched link rows.

The link check reports unmatched rows, but the setup sequence in runtime.md runs training as the next step with no condition on that result. The skill generates one notebook that trains and predicts in one process, and it instructs the agent to run the notebook. A full run can therefore fit the model and write predictions with OVERWRITE before the user chooses to fix the source, correct the link, or continue. Troubleshooting §2 requires that decision before training.

Require the generated workflow to stop before training when any confirmed link has unmatched rows. Training must resume only after the user chooses how to proceed. The "Stop there" instruction in runtime.md governs only the agent's reply, so it does not enforce this pause.

@kumo-isaac

Copy link
Copy Markdown
Contributor Author

More runs: 3 repeats per phrasing

Same harness and GPU setup as the description, but the model ran at temperature 0.7 (the original runs used 0, so repeats of one scenario were near-identical). Each cell is runs the judge marked the failure detected, with the host-report turn applied to both.

Phrasing Baseline (main, temp 0) This branch (temp 0.7)
formal 0/1 3/3
terse 0/1 3/3
  • Total on this branch: 6/6 detected.
  • The baseline is still one run per phrasing at temperature 0; it was not re-run at 0.7, so the comparison is indicative.
  • Still one judge (nemotron).

🤖 Generated with Claude Code

@kumo-isaac

Copy link
Copy Markdown
Contributor Author

Superseded by #522, which combines this fix with the other cases that detected the failure in at least 5 of 6 repeat runs.

@kumo-isaac kumo-isaac closed this Nov 24, 2026

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — aebae8ec Deployed Nov 22, 2026 by kumo-isaac via import #2931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant