Skip to content

fix(cli): accept --glob as alias for --mask in collection add#664

Open
bzqzheng wants to merge 1 commit into
tobi:mainfrom
bzqzheng:fix/collection-add-glob-alias
Open

fix(cli): accept --glob as alias for --mask in collection add#664
bzqzheng wants to merge 1 commit into
tobi:mainfrom
bzqzheng:fix/collection-add-glob-alias

Conversation

@bzqzheng
Copy link
Copy Markdown

Problem

qmd collection add --glob <pattern> silently ignores the flag and falls back to **/*.md. Tools such as OpenClaw pass --glob when registering per-agent memory collections on the same workspace path, causing the duplicate-path guard to fire and leaving collections uncreated — with a timeout on every subsequent memory_search call.

Root cause

The option parser only registered --mask for the glob pattern. --glob was unknown, so parseArgs silently discarded it (the parser runs with strict: false). Both collections ended up with path + **/*.md, matching the (path, pattern) uniqueness check and exiting 1.

Fix

  • Register glob alongside mask in the option table
  • Coalesce (mask ?? glob) at the collection add use site
  • Update collection help to surface --glob in the usage line

Test Plan

  • bun test --preload ./src/test-preload.ts test/cli.test.ts -t "CLI Add Command"
  • CI=true bun test --timeout 60000 --preload ./src/test-preload.ts test/ — 820 pass
  • CI=true npx vitest run --reporter=verbose --testTimeout 60000 test/ — 820 pass
  • npm run test:types
  • git diff --check

Fixes #536.

Tools such as OpenClaw pass --glob <pattern> to qmd collection add.
The flag was not registered, so it was silently ignored and the pattern
fell back to DEFAULT_GLOB (**/*.md). Both collections in the OpenClaw
boot sequence then got the same path + pattern, tripping the duplicate
guard and leaving memory-alt-{agentId} uncreated.

Register --glob alongside --mask and coalesce (mask ?? glob) at the
use site so both flags produce identical behaviour.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[QMD] memory-root-{agentId} blocks memory-alt-{agentId} on same workspace path — causes timeout on every memory_search

1 participant