#23311: fix(memory): expose maxOutputChars as configurable qmd limit
size: XS
Cluster:
QMD Memory Management Fixes
## Summary
- **Fixes #23137** — The hardcoded `MAX_QMD_OUTPUT_CHARS = 200_000` in `qmd-manager.ts` rejected successful long-running `qmd update`/`qmd embed` operations whose verbose progress logging exceeded the 200k char limit, even though the command itself exited with code 0 and the output is discarded anyway.
- Exposes the limit as a user-configurable `memory.qmd.limits.maxOutputChars` setting (default: **2,000,000** chars / ~2MB), wired through the existing config resolution pipeline.
- The 2MB default is still a reasonable OOM safeguard (prevents unbounded memory growth from a runaway process) while accommodating large repos whose `qmd update`/`qmd embed` runs produce verbose progress logs.
### Division of work
- **Issue investigation and analysis:** @haitao-sjsu — identified that the hardcoded 200k limit rejects successful qmd operations, analyzed all `runQmd()` call sites to confirm the limit is OOM protection (not a qmd internal requirement), and determined that `update`/`embed` discard their stdout anyway.
- **Implementation:** Claude — code changes and tests.
### Changes
| File | Change |
|------|--------|
| `src/config/types.memory.ts` | Add `maxOutputChars?: number` to `MemoryQmdLimitsConfig` |
| `src/config/zod-schema.ts` | Add `maxOutputChars` to Zod schema |
| `src/memory/backend-config.ts` | Add to resolved type, default (2MB), and resolution logic |
| `src/memory/qmd-manager.ts` | Remove hardcoded 200k constant, read from resolved config |
| `src/config/schema.help.ts` | Add help text |
| `src/config/schema.labels.ts` | Add UI label |
| `src/memory/qmd-manager.test.ts` | Update existing safety-cap test (240k → 2.1M), add config-override test |
## Test plan
- [x] Existing safety-cap test updated to exceed new 2MB default (2,100,000 chars)
- [x] New test verifies a custom `maxOutputChars: 500` config correctly rejects 600 chars of output
- [x] All 42 qmd-manager tests pass
- [x] Lint passes (0 warnings, 0 errors)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Most Similar PRs
#9381: Fix: Allow QMD CLI memory search when scope is restrictive
by vishaltandale00 · 2026-02-05
70.0%
#15307: fix(memory): handle mixed/no-results QMD query output
by MohammadErfan-Jabbari · 2026-02-13
69.1%
#9624: fix(memory): resolve QMD search returning empty results [AI-assisted]
by kowshik24 · 2026-02-05
69.0%
#20194: feat(memory): support path-based weights for QMD search (Fixes #20139)
by FradSer · 2026-02-18
68.6%
#11364: fix(memory/qmd): prevent cascading failure when query fails or retu...
by blazerui · 2026-02-07
67.8%
#21217: fix: memory prune command to prevent unbounded MEMORY.md growth
by theognis1002 · 2026-02-19
67.8%
#17657: fix: clear QMD manager cache on in-process restart (SIGUSR1)
by IrriVisionTechnologies · 2026-02-16
67.3%
#16968: fix(qmd): per-collection search to prevent large collections drowni...
by ProgramCaiCai · 2026-02-15
67.2%
#12939: fix(memory): strip null bytes from workspace paths causing ENOTDIR
by omair445 · 2026-02-09
67.2%
#19022: memory: support per-agent QMD collection paths
by Whoaa512 · 2026-02-17
66.6%