Fix training behavior for thin labels and missing provenance - #75
Conversation
…n provenance (fix-5cr) A one-row intent trains unmeasured instead of raising TrainingDataError, matching the persona holdout. Hand-written utterances without generate_diverse_utterances are judged on context row counts, not treated as MISSING. Co-authored-by: Cursor <cursoragent@cursor.com>
fix(train): thin labels and missing generation provenance must not abort a run (fix-5cr)
Reviewer's GuideThe PR makes training resilient to single-utterance labels by training them without held-out evaluation, reports those labels with decoded rich-safe warnings, and distinguishes absent generation provenance from commands proven to have trained through context provenance; the package version is bumped to 3.2.1. Flow diagram for resilient thin-label training splitflowchart TD
A[Training dataset] --> B[Count rows per label]
B --> C{Label below minimum rows?}
C -- Yes --> D[Warn with decoded label names]
D --> E[Keep rows in training set]
C -- No --> F[Stratified train/evaluation split]
E --> G[Train model]
F --> G
B --> H{All labels below floor?}
H -- Yes --> I[Raise TrainingDataError]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="fastworkflow/train/training_report.py" line_range="698-701" />
<code_context>
if trains_as_label is False:
return RowStatus.EXCLUDED
- return RowStatus.MISSING
+ if not has_included_context:
+ # No generation record AND no sign the trainer ever reached this command:
+ # the run died part-way or provenance was lost. That is what MISSING means.
+ return RowStatus.MISSING
+ # An `UtteranceProvenance` record describes *generation*, and only
+ # `generate_diverse_utterances` writes one. A command whose `generate_utterances`
</code_context>
<issue_to_address>
**issue (broader_impact):** A generated command with missing `UtteranceProvenance` is treated as non-missing whenever any context record has `INCLUDED` status, so the report can return `OK` or `BELOW_FLOOR` and allow publication despite lost generation provenance. `has_included_context` does not distinguish hand-written utterances, which never owed a generation record, from generated utterances whose provenance was lost.
**Triggers:** When generation provenance is absent but the trainer successfully records an included context for the command.
**Suggested fix:** Record whether a command used the generator, or preserve the prior missing-provenance check for generated commands and exempt only commands explicitly known to supply hand-written utterances.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if this is wrong, thin-label data or commands without generation provenance could be included in a model and published without the intended evaluation or blocking signal. Reverting stops the behavior for future runs, but already-produced models or reports would need to be regenerated.
Blocking findings: fastworkflow/train/training_report.py:701
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
the observation is valid; treating INCLUDED as “training happened” is intentional; lost generation metadata is an observability issue, not a publication gate; track a follow-up to record handwritten vs generated explicitly rather than blocking 3.2.1 |
There was a problem hiding this comment.
Post-merge CVE scan (after #75)
Re-ran Trivy, Grype, Syft, osv-scanner, Dockle, and Dive against 734cb1f (v3.2.1). Snyk and Docker Scout were skipped (no auth in this environment).
Python / poetry.lock
- Only finding:
diskcache==5.6.3— CVE-2025-69872 / GHSA-w8v5-vhqr-4h9v / PYSEC-2026-2447 (MEDIUM). - Easy pyproject.toml bumps: none. osv-scanner: "0 vulnerabilities can be fixed"; PyPI latest still 5.6.3.
- With OpenVEX v7, Trivy/Grype report a clean lockfile.
Human-review recommendations
| Finding | Rec | Rationale |
|---|---|---|
| diskcache pickle RCE | IGNORE | Not remotely reachable; OpenVEX not_affected |
Proxy-image OS High/Critical (python:3.13-slim-bookworm) |
IGNORE | No first-party Dockerfile; not shipped |
| Dockle CIS (root/HEALTHCHECK) | IGNORE | Proxy image only |
| DSPy cache dir hardening note | FIX (optional docs) | Low-cost operator guidance if cache is shared |
Follow-up PR
Report refresh landed in #77 (security/reports/*.html + OpenVEX v7).
Sent by Cursor Automation: Untitled


Training was failing for commands with a single utterance. Also missing provenance
Summary by Sourcery
Make training resilient to thin intent labels and distinguish absent generation provenance from commands that trained successfully without using a generator.
Bug Fixes:
Enhancements:
Build:
Tests: