Skip to content

init wizard: b at _step_mcp silently re-runs _step_provider_dirs_auto instead of reaching a real prompt #421

@pandas-studio

Description

@pandas-studio

Symptom

In the mm init default interactive path (and --preset X), typing b at the MCP step (_step_mcp) should conceptually take the user back to the memory-directory step. Instead it lands on _step_provider_dirs_auto, which is a silent step (prints a "No provider memory folders detected." banner, or the "Auto-added N folder(s)" banner, but does not prompt), so it runs its click.echo calls and falls straight through to the next iteration — dropping the user back at _step_mcp with just a re-printed banner in between.

Net effect: "b" at _step_mcp appears to do almost nothing. The user has to hit "b" twice in a row to reach a prompt that can actually accept input, which no wizard documents.

Same shape as #371 but one step further along the flow.

Repro (assuming #418 lands)

$ mm init
  Choose setup style: [2]
  Directory [~/memories]: /tmp/m
  'tmp/m' doesn't exist. Create it? [Y/n] y
  No provider memory folders detected (checked: ...)
  Run 'mm init --advanced' later to add custom paths.

1. MCP Configuration     # (or whatever step_header shows for mcp)
  (b: back, q: quit)
  Select [2]: b          # user hits b expecting to go back to memory-dir

  No provider memory folders detected (checked: ...)   # banner re-prints
  Run 'mm init --advanced' later to add custom paths.

1. MCP Configuration    # same prompt reappears, no actual back-nav
  (b: back, q: quit)
  Select [2]:

Root cause

packages/memtomem/src/memtomem/cli/wizard.py:run_steps:

while i < len(steps):
    try:
        steps[i](state)
        i += 1
    except StepBack:
        if i > 0:
            i -= 1
            ...

run_steps decrements i and re-runs steps[i], but it doesn't distinguish "user hit b, went back one" from "normal forward step". If steps[i] is silent (no prompt, just echo), it runs its side effect and i += 1 advances right back to where we came from — user never sees a prompt they can act on.

Suggested directions

  1. Mark silent steps explicitly. Give a step function a marker (attribute, decorator, or separate list) saying "on back-nav pass-through, not present". run_steps on StepBack keeps decrementing until it hits a non-silent step.
  2. Teach silent steps to skip their side effects when visited during back-nav. Pass a direction hint from run_steps (_from_back=True) and steps can short-circuit. More plumbing.
  3. Fold silent steps into adjacent interactive ones. _step_provider_dirs_auto's side effect could run inside _step_memory_dir's tail, or inside a wrapper around _step_mcp's head. Removes the silent step entirely.

Direction 1 is the narrowest fix and keeps step composability. Direction 3 would be cleaner but may complicate the advanced-flow case where provider_dirs is also a step.

Acceptance criteria

  • b at _step_mcp lands the user back at the previous prompt (memory-dir), not on a silent step.
  • Silent step side effects (banners) don't re-fire on a back-pass-through.
  • New test that sequences CliRunner().invoke(init, input="<preset>\n<dir>\ny\nb\n...") and asserts the memory-dir prompt re-appears in the output.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions