Skip to content

[Bug]: Terminal spawn to / pollutes recent_folders list #228

@forketyfork

Description

@forketyfork

Description

When a terminal is opened for the first time, the shell briefly starts in / before cd-ing to the target working directory. The per-frame CWD tracking loop (runtime.zig:1397–1407) picks up this transient / and calls persistence.appendRecentFolder("/"), permanently inserting it into the recent_folders list. Because this happens on every new terminal spawn, / accumulates a high visit count and floats to the top of the Cmd+O overlay. Users who never intentionally navigate to / find it dominating the list. Additionally, existing persistence.toml files already contain this spurious entry, so a one-time migration that removes / from saved recent_folders data is needed.

Steps to Reproduce

Starting state: Fresh install or cleared ~/.config/architect/persistence.toml; recent_folders is empty.

  1. Open Architect.
  2. Open a new terminal (the shell spawns, briefly cwd is /, then cd's to the target dir).
  3. Open the Cmd+O recent-folders overlay.

Reproducibility: Always

Expected Behavior

/ does not appear in recent_folders unless the user explicitly navigates to it (e.g., cd /).

Actual Behavior

/ appears at or near the top of the recent-folders list after opening any terminal.

Suspected Area

  • src/app/runtime.zig — per-frame CWD update loop (updateCwd + appendRecentFolder call, lines 1397–1407): the initial transient / cwd must be suppressed.
  • src/config.zigappendRecentFolder (lines 471–498) and migration logic (lines 311–394): a V4 migration pass should strip / from existing recent_folders data.

Acceptance Criteria

  • Opening a new terminal no longer adds / to recent_folders (unless the user subsequently navigates there manually).
  • A persistence migration (V4) removes any existing / entry from recent_folders on the first load after upgrading.
  • Manually running cd / in a terminal does still add/bump / in recent_folders.
  • The fix does not break existing tests; regression test added if feasible.
  • docs/configuration.md migration notes updated to reflect the new V4 format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions