← Back to PRs

#23311: fix(memory): expose maxOutputChars as configurable qmd limit

by haitao-sjsu open 2026-02-22 06:05 View on GitHub →
size: XS
## 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