Skip to content

ltm: pinned loop silently scores one of two loops over the same variables #674

Open

Description

@bpowers

A pinned loop is stored as a set of variables, and the engine picks the cycle to score itself: the first one in alphabetical order.
When one set of variables forms two different directed loops, the pin silently scores whichever comes first, and the user cannot choose the other direction.

Example

In the three-party arms race (test/arms_race_3party/arms_race.stmx), the loop A -> B -> C -> A and the loop A -> C -> B -> A (each through the parties' arms, targets, and change flows) pass through the same nine variables.
Pinning those variables always scores the alphabetically first direction, with no warning that a second loop exists.
In exhaustive mode both directions are also found and scored as ordinary loops, so the problem shows in discovery mode or when the user wanted the other direction.

Why it matters

The arms race is a textbook LTM example, but pins over such a set are rare.
The real problem is that the result is silent: a confidently reported score for a loop the user may not have meant.

Fix

Recommended: honor the order the user gave.
The pin's variable ids are already stored as an ordered list in the file (LoopMetadata.uids, the <simlin:loop-metadata> extension), but sync sorts and deduplicates them.
If that order forms a cycle, score that cycle; otherwise fall back to the current search.

Cheaper alternative: keep the current behavior and emit a warning when the set has more than one directed cycle, naming the direction that was scored.

Pointers

  • src/simlin-engine/src/db/input.rs (PinnedLoopSpec, where the order is dropped)
  • src/simlin-engine/src/db/sync.rs (pinned_loops_from_datamodel)
  • src/simlin-engine/src/ltm/graph.rs (order_variable_cycle)
  • src/simlin-engine/src/db/ltm/pinned.rs (model_pinned_loops)
  • docs/design/ltm--loops-that-matter.md, "Sibling-cycle limitation" paragraph

Activity

  1. added
    ltm
    on Jun 2, 2026
  2. added
    bug
    on Oct 12, 2026
  3. changed the title [-]ltm: pinned loops cannot express both directed cycles over a shared variable set[/-] [+]ltm: pinned loop silently scores one of two loops over the same variables[/+] on Oct 12, 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

    bugltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions