Skip to content

pm init writes a malformed .gitignore entry that merges two paths into one line #514

Closed

Description

@unbraind

Summary

When pm initializes a repository-local tracker (.agents/pm) it appends runtime/cache ignore rules to .gitignore, but one generated line is malformed — it concatenates two separate ignore paths into a single line, so neither is actually ignored.

Observed .gitignore content (block written by pm init)

# PM CLI runtime and cache files
.agents/pm/runtime/
.agents/pm/search/

plus these individual lines:

.agents/pm/search/.agents/pm/runtime/metadata-cache-bodies.json   <-- MALFORMED
.agents/pm/runtime/metadata-cache-collections.json
.agents/pm/runtime/history-drift-cache.json

The first individual line is two entries merged:

  • .agents/pm/search/ (should ignore the whole search cache dir)
  • .agents/pm/runtime/metadata-cache-bodies.json (should ignore that one file)

Because they are concatenated as .agents/pm/search/.agents/pm/runtime/metadata-cache-bodies.json, the path does not exist and matches nothing.

Impact

  • metadata-cache-bodies.json is never ignored.
  • The primary runtime cache metadata-cache.json is not covered by any effective rule (it is also missing from the explicit list), so in repositories that version .agents/pm every pm command mutates tracked files, producing spurious git churn.
  • The blanket .agents/pm/runtime/ rule only protects untracked future files; already-tracked cache files stay tracked, so the merge/garble above is the actual root cause of the noise.

Expected behavior

pm should emit two clean, separate entries:

.agents/pm/search/
.agents/pm/runtime/metadata-cache-bodies.json

and should also explicitly list .agents/pm/runtime/metadata-cache.json (or rely solely on the .agents/pm/runtime/ blanket rule applied before the files are first tracked).

Steps to reproduce

  1. pm init --workspace . (or pm init in a git repo) with an existing/empty .gitignore.
  2. Inspect the pm-authored block in .gitignore.
  3. Observe the concatenated path on the metadata-cache-bodies.json line.

Environment

  • pm CLI: latest (10.x line)
  • OS: Linux
  • Reproduced in the simworld monorepo where .agents/pm/runtime/metadata-cache*.json show up as tracked modifications after normal pm commands.

Activity

  1. coderabbitai commented on Jul 11, 2026

    @coderabbitai
    🔗 Related PRs

    #200 - Add validation self-repair and agent ergonomics primitives [closed]
    #425 - Strengthen SDK linked-test imports and mandatory quality gates [merged]
    #428 - Harden SDK extension runtime packaging [merged]
    #475 - Improve package install and annotation agent UX [merged]
    #491 - Harden init target safety and package install verification [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added a commit that references this issue on Jul 11, 2026
  3. unbraind commented on Jul 11, 2026

    @unbraind
    OwnerAuthor

    pm tracker item:

  4. unbraind commented on Jul 12, 2026

    @unbraind
    OwnerAuthor

    Resolved in merged PR #520: pm init now reconciles a canonical fenced workspace .gitignore block for runtime/search caches, repairs malformed content, remains idempotent, and handles nested invocation correctly.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions