Skip to content

feat(ladder): reconcile simultaneous buffer purchase + reshape recommendations in one run #30

Open

Description

@cristim

From the LeanerCloud/cloud-commitments-cli#1340 allocation-algorithm design review: in a single run the engine can emit a buffer-layer PURCHASE (gap allocation includes the buffer share) and a RESHAPE recommendation for that same buffer (utilization below threshold) simultaneously. Buying more of an under-utilized layer is economically questionable.

The phase-3 pipeline must reconcile: either suppress/reduce the buffer allocation when a reshape is pending for that layer, or at minimum surface the tension prominently in the approval email so the human sees both actions side by side with the utilization number. Decide and implement in the ladder_run task wiring (issue LeanerCloud/cloud-commitments-cli#1336 scope).

Activity

  1. cristim commented on Oct 17, 2026

    @cristim
    MemberAuthor

    Checked against main: still valid. splitGap (pkg/ladder/allocate.go :680-710) always allocates the buffer gap while detectReshapes (:159) runs independently, so the engine can buy a buffer and reshape the same layer. Fix (about 60 lines plus tests, fails closed and buys less): in buildResult, turn that layer's buffer Allocation into an ActionHold when a reshape exists for it. Open PR #441 edits allocate.go, so this is blocked on #441.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions