GeezerVison is showing github.com — fix(server): bound fs.find limit — PositiveInt with no ceiling materializes the whole file index on one request · Issue #2484 · developing-today-forks/opencode
fix(server): bound fs.find limit — PositiveInt with no ceiling materializes the whole file index on one request #2484Labels app/serverPackage: server (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DescriptionEvidence
GET /api/fs/find takes a client-controlled limit with no server-side ceiling:
packages/protocol/src/groups/fs.ts:28 — FindQuery.limit is Schema.NumberFromString.pipe(Schema.decodeTo(PositiveInt), Schema.optional); no max, mirroring the unbounded shape that fix(server): bound session.list limit — PositiveInt with no ceiling loads entire table on one request #2483 filed for session.list.
packages/server/src/handlers/fs.ts:41-47 — the fs.find handler passes ctx.query straight into FileSystem.Service.find with no clamp.
packages/core/src/filesystem/search.ts:39 (ripgrep backend, served via filesystem.ts:157 find: search.find) — fuzzysort.go(input.query, items, { limit: input.limit ?? 50 }). The scored index holds up to the ripgrep scan cap at :72 (100_000 entries, or Number.MAX_SAFE_INTEGER for VCS locations), so limit=2147483647 retains, maps, and JSON-serializes up to the entire location index in one response instead of the default 50-entry page.
packages/core/src/filesystem/search.ts:142 (fff backend) — same raw value feeds the native index as pageSize: input.limit ?? 50, so both find paths are affected.
Why it matters
Any HTTP client (or a misbehaving TUI/plugin caller) can turn a 50-entry fuzzy-find page into a full-index dump with one query param. Sibling surfaces already cap this class: session message list is capped 1..200, branch lists go through branchListLimit (max 100), and #2483 tracks the same defect for session.list. fs.find is the remaining uncapped list-style endpoint.
Acceptance criteria / suggested fix
- Cap the find limit server-side (e.g. a shared page-size helper mirroring
branchListLimit's [1, max] shape); keep the default page at 50.
- Apply the cap at one choke point so both backends (ripgrep/fuzzysort
limit and fff pageSize) are covered.
- Regression test: requesting an oversized
limit returns the capped page, not the whole index; default (absent limit) behavior unchanged.
Related: #2483 (session.list, same defect class, different endpoint/layer). Activityadded kind/bugSomething isn't working (prefixed form of the classic bug label) task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests app/serverPackage: server (pkgs/ or apps/ in this repo) effort/sSmall: expected under 2 hours of work on Nov 16, 2026dezren39 commented on Nov 17, 2026 🤖 Agent note · triaged
- Agent: queue worker (repo-worker-code), lane any-h
- Session / ID: task 17907
- Found via: queue claim
- Triage verdict: existing triage confirmed (task/small-fix, kind/bug, priority/normal, effort/s, app/server — all already on the issue, no status/needs-triage present). The fix already exists in an open PR — no new fix PR should be started for this issue.
- Fresh evidence (2026-11-17): issue fix(server): bound fs.find limit — PositiveInt with no ceiling materializes the whole file index on one request #2484 still OPEN. On current origin/main the fs.find handler (packages/server/src/handlers/fs.ts) still passes ctx.query straight into FileSystem.Service.find with no clamp, so the defect is still live on main. PR fix(server): bound session.list and fs.find page limits #2488 (branch bound-list-limits, OPEN, no hold labels) caps both session.list (fix(server): bound session.list limit — PositiveInt with no ceiling loads entire table on one request #2483) and fs.find at 200 at the shared choke points, states "Closes fix(server): bound session.list limit — PositiveInt with no ceiling loads entire table on one request #2483 / Closes fix(server): bound fs.find limit — PositiveInt with no ceiling materializes the whole file index on one request #2484", and carries regression tests for both backends (search.test.ts: 250-entry index, oversized limit returns 200, limit=5 returns 5, omitted returns 50) plus before/after benchmarks (5,000-file find: 5,000 entries / 215,001 B before, 200 entries / 8,601 B after).
- First concrete step: shepherd PR fix(server): bound session.list and fs.find page limits #2488 to merge; its merge closes this issue. One flag for the shepherd: the CodeRabbit summary on fix(server): bound session.list and fs.find page limits #2488 mentions unrelated surfaces (an audio transcription endpoint, quota-gate config) — verify the PR diff is scoped to the two limit fixes before merging.
- Acceptance check: after fix(server): bound session.list and fs.find page limits #2488 merges, requesting an oversized limit on fs.find returns the capped 200-entry page on both backends and the default 50-entry page is unchanged.
dezren39 commented on Nov 17, 2026 Duplicate triage packet (task 19748, lane any-d): the triage of record for #2484 is task 17907's verdict (2026-11-17T02:44Z, comment above) — the fix already exists in PR #2488 (branch bound-list-limits), which caps fs.find (and session.list) at 200 at the shared choke points, states "Closes #2484", and carries regression tests plus before/after benchmarks; PR #2488 re-verified OPEN this shift. No new fix PR and no new follow-on from this packet: shepherding PR #2488 to merge is the recorded next step (with the triage's flag to verify the diff is scoped to the two limit fixes before merging).
dezren39 commented on Nov 23, 2026
Claim — Lane UE (archer) taking opencode#2484 now.
Plan: verify the premise on current fork main (fs.find limit still unbounded after sibling #2483 was capped by PR #2589), then land the fs.find cap mirroring the #2589 pattern (ceiling 200 at the protocol + core layers, regression tests). PR #2488 (the earlier combined vehicle) is conflicted and its session.list half is superseded by #2589; I will disposition it on the record once the fresh fs.find PR is up. dezren39 commented on Nov 23, 2026 Done — Lane UE (archer), 2026-11-23. #2484 CLOSED as completed via PR #2743 (merge 5b3af0c324ad, head SHA-guarded at 34f22974e3); fix verified present on origin/main.
Premise: TRUE on fork main 87b97f0e2a — FindQuery.limit decoded to PositiveInt with no ceiling, and both core backends (fuzzysort limit on the ripgrep path, picker pageSize on the fff path) passed the raw value through.
Fix (mirrors the #2589 session-list pattern):
Verification (laptop route): core search suite 11 pass / 0 fail incl. 2 new tests (250-entry index on both backends: oversized → 200, limit=5 → 5, omitted → 50; fff test pins the clamped pageSize); mutation check — removing the ceiling fails exactly the 2 new tests; protocol suite 14/14 and check:generated clean; typecheck clean (core 2,280 files, protocol 163). Dispatch attempted first (run 45174440230) and failed in the "Execute target command" step on the container's missing bun toolchain (code#13159/anomalyco#13189 family) — an environment failure, not a test result; the laptop run is the verifying route.
MetadataMetadataapp/serverPackage: server (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DevelopmentNo branches or pull requestsIssue actions
|