Skip to content

fix: decompose pipeline KeyError when constraint strings don't exactly match between stages #755

Closed

Description

@planetf1

Problem

docs/examples/m_decompose/python/python_decompose_example.py fails with a KeyError in finalize_result. Found when explicitly running slow tests on a Mac M1 (32 GB).

KeyError: '* The blog post must have a catchy title'

Traceback points to cli/decompose/pipeline.py:431:

"val_strategy": constraint_val_data[cons_str]["val_strategy"],

Root Cause

constraint_val_data is keyed on the raw strings returned by constraint_extractor (e.g. "The blog post must have a catchy title"). Later, subtask_data.constraints is populated by a separate model call which can return the same constraints with slight formatting differences — in this case a * bullet prefix. The dict lookup then fails.

There's no normalisation of constraint strings between the two stages.

Suggested Fix

Strip leading punctuation/whitespace when building or looking up constraint_val_data keys, or normalise constraint strings at extraction time so both stages agree on the format.

Flagging for @AngeloDanducci as the main author of the pipeline.

Activity

  1. added
    bug
    and removed on Mar 27, 2026
  2. AngeloDanducci commented on Mar 27, 2026

    @AngeloDanducci
    Contributor

    I'm the author of the example but not the primary author of the pipeline 😅

    I'll take a look at the changes in the upgraded pipeline last week - I think we solved a similar issue previously in #569

  3. csbobby commented on Apr 1, 2026

    @csbobby
    Contributor

    @AngeloDanducci Thank you for pointing it to me. Yes, the issue was solved in #569.
    The m_decompose/python/* are the tmp files of the previous example which should be cleaned up eventually. They are removed on the #770 and will be merged then. @planetf1 @AngeloDanducci

  4. csbobby commented on Apr 1, 2026

    @csbobby
    Contributor

    Hi @planetf1 I am the the primary owner of the m decompose. Thanks for running the tests! There are currently two pending merge commits (#769 and #770). Please feel free to test by decompose_using_cli.sh with the recommended default model (smaller or weaker llms will have hulluciations). For GPU, we recommend an RTX 5090 or newer, or an Apple M3 chip or above.

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

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions