{"author":{"id":"MDQ6VXNlcjM4OTY5OTg=","is_bot":false,"login":"yazydzhi","name":"Vladimir Yazydzhi"},"baseRefName":"main","body":"Fixes #2362.\n\n## Problem\n\n\\`listPathsRecursively\\` in \\`apps/host-daemon/src/command-handlers/file-list.ts\\` merges each subdirectory's results with:\n\n\\`\\`\\`ts\nresults.push(...(await listPathsRecursively({ ...args, dir: fullPath })));\n\\`\\`\\`\n\n\\`Array.prototype.push(...arr)\\` spreads every element as a call argument. Once an accumulated subtree crosses V8's argument-count ceiling (~100k, engine-dependent), this throws \\`RangeError: Maximum call stack size exceeded\\` instead of returning. Any caller of file listing/search (a plugin's \\`listTree\\`, project file search, etc.) on a large enough workspace — a big Obsidian vault, a large monorepo — sees this surface as an opaque \\`HTTP 502\\`.\n\n## Fix\n\nReplace the spread-push with a plain loop, which has no argument-count limit:\n\n\\`\\`\\`ts\nconst childResults = await listPathsRecursively({ ...args, dir: fullPath });\nfor (const childResult of childResults) results.push(childResult);\n\\`\\`\\`\n\n## Testing\n\nAdded a regression test that creates a 150k-file subtree and asserts \\`listPathsRecursively\\` returns instead of throwing.\n\n- Confirmed the new test reproduces the exact \\`RangeError: Maximum call stack size exceeded\\` against the pre-fix code (stashed the fix, ran the test, same error/stack as reported).\n- With the fix applied, all 15 tests in \\`file-list.test.ts\\` pass (\\`vitest run --config vitest.config.ts\\` in \\`apps/host-daemon\\`).\n\n## Test plan\n\n- [x] \\`vitest run\\` in \\`apps/host-daemon\\` — 15/15 passing\n- [x] Verified the new test fails with the exact reported error on the pre-fix code","commits":[{"authoredDate":"2026-08-24T23:05:57Z","authors":[{"email":"yazydzhi@gmail.com","id":"MDQ6VXNlcjM4OTY5OTg=","login":"yazydzhi","name":"azg"},{"email":"noreply@anthropic.com","id":"MDQ6VXNlcjgxODQ3","login":"claude","name":"Claude Sonnet 5"}],"committedDate":"2026-08-24T23:05:57Z","messageBody":"listPathsRecursively merged each subdirectory's results with\nresults.push(...childResults). Array.push spreads its arguments onto\nthe call stack, so a subtree with enough entries (~100k+ depending on\nthe engine) throws \"RangeError: Maximum call stack size exceeded\"\ninstead of returning. This broke file listing/search entirely for\nlarge workspaces (e.g. a big Obsidian vault with tens of thousands of\nfiles), surfacing as an opaque HTTP 502 from any plugin or route that\ncalls files.listPaths/listTree.\n\nReplace the spread-push with a plain loop, which has no argument-count\nlimit. Added a regression test that recreates a 150k-file subtree and\nasserts listPathsRecursively returns instead of throwing.\n\nCo-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>","messageHeadline":"fix(host-daemon): avoid stack overflow listing large directory trees","oid":"308c68184371db4e8da1034671ab4cd82e46fc10"}],"files":[{"path":"apps/host-daemon/src/command-handlers/file-list.test.ts","additions":29,"deletions":0,"changeType":"MODIFIED"},{"path":"apps/host-daemon/src/command-handlers/file-list.ts","additions":5,"deletions":6,"changeType":"MODIFIED"}],"headRefName":"fix/file-list-recursive-push-stack-overflow","headRefOid":"308c68184371db4e8da1034671ab4cd82e46fc10","mergeStateStatus":"UNKNOWN","mergeable":"UNKNOWN","number":2363,"statusCheckRollup":[],"title":"fix(host-daemon): avoid stack overflow listing large directory trees","url":"https://github.com/get-bb/bb/pull/2363"}
