Skip to content

Fix: is_sql=False deterministically implies 0% conversion #44

Closed

Description

@shaypal5

Problem

The simulation engine currently requires leads to pass through the SQL stage (via funnel progression mql → sal → sql → … → negotiation → closed_won) before they can convert. This means is_sql=False deterministically implies 0% conversion — a hard invariant that leaks outcome information into features.

This is documented as a known limitation in docs/v4/design.md:220 and tracked as a deferred engine fix in .agent-plan.md under "post-v1 list".

Root cause

In leadforge/simulation/engine.py, only leads at the negotiation stage are checked by ConversionHazard. Leads that never reach SQL can never reach negotiation, so they never convert.

Proposed fix

Add a rare "direct conversion" path: leads at pre-SQL stages (mql, sal) get a small daily probability of converting directly, bypassing the full funnel. This should be:

  • Latent-score-modulated — higher latent → slightly higher direct conversion chance
  • Much rarer than normal negotiation → closed_won path (e.g., 5% discount factor on the standard conversion hazard rate)
  • Configurable — the discount factor should be a named constant, not a magic number
  • The is_sql field semantics should be unchanged — it still reflects whether the lead reached SQL

Acceptance criteria

  • With enough leads, some non-SQL leads convert
  • Non-SQL conversion rate is much lower than SQL conversion rate
  • Determinism is preserved (same seed → same result)
  • All existing tests pass (with appropriate updates to tests that assumed is_sql=False → no conversion)

Labels

type: bugfix, layer: core, layer: simulation

Activity

  1. added
    type: bugfix
    layer: core
    layer: simulation
    on May 1, 2026
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

    layer: corelayer: simulationtype: bugfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions