Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): make workspace list cap configurable #5107

ClosedFuzzyma(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/5107/headopened View on GitHub

Problem

The workspace Files listing always asks FFF for 25,002 results and materializes up to 25,000 paths. Large workspace roots therefore retain substantial server memory even when users do not need that many entries in the Files panel, and there was no way to trade listing depth for memory use.

Using the included probe against a workspace root with roughly 222,000 entries, each limit ran in a fresh Node process and sampled RSS after forced GC:

list limitlisted RSSRSS added by list()peak RSS added
1,000196.2 MiB24.1 MiB3.5 MiB
5,000219.5 MiB44.7 MiB24.4 MiB
25,000290.1 MiB117.5 MiB99.8 MiB

Reproduce with:

node apps/server/scripts/workspace-index-memory-probe.ts /path/to/large/workspace 1000 5000 25000

How this helps

  • Add T3CODE_WORKSPACE_LIST_MAX_ENTRIES with an allowed range of 1 through 25,000.
  • Preserve the existing 25,000 default, so this is an opt-in memory mitigation rather than a behavior change for existing installs.
  • Apply the limit before FFF result materialization and to the returned Files listing. Path and content search continue to use the full index.
  • Fall back to 25,000 with a warning for invalid values.
  • Document the setting and add focused tests for valid, zero, over-limit, and non-numeric configuration.

Verification

  • vp lint apps/server/scripts/workspace-index-memory-probe.ts apps/server/src/workspace/WorkspaceSearchIndex.ts apps/server/src/workspace/WorkspaceSearchIndex.test.ts
  • vp test run apps/server/src/workspace/WorkspaceSearchIndex.test.ts (10 tests passed)
  • vp run -F t3 typecheck
  • Production-path memory probe shown above
  • Reviewed by Claude Fable 5 directly and Claude Opus 5 through Paseo

Implemented with Codex (GPT-5.6 Sol) in T3 Code; reviewed by Claude Fable 5 and Claude Opus 5.


Note

Low Risk Opt-in configuration with the same 25,000 default; changes only workspace listing depth and memory, not auth or search over the full index.

Overview Adds T3CODE_WORKSPACE_LIST_MAX_ENTRIES (1–25,000, default 25,000) so the Files panel listing can cap how many paths are fetched and returned from the workspace index, trading shorter lists for lower server memory on huge roots. Invalid values keep the default and log a warning; path and content search still use the full index.

WorkspaceSearchIndex.make and the layer path honor the limit for list() page size and truncation. A new workspace-index-memory-probe script measures RSS across limits in isolated child processes. Install docs describe the setting and desktop/WSL launch caveats. Tests cover configured caps and invalid env fallback.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ee7e692aa75549a0d0f6032f469bf2a3f1ef39bb. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Make workspace list entry cap configurable via T3CODE_WORKSPACE_LIST_MAX_ENTRIES

  • Replaces the fixed 25,000-entry cap in WorkspaceSearchIndex with a value read from the T3CODE_WORKSPACE_LIST_MAX_ENTRIES env var (range 1–25,000, default 25,000).
  • Invalid config values log a warning and fall back to the default; the cap is applied to both the search page size and the final slice in list().
  • Adds a workspace-index-memory-probe script to measure RSS before/after listing at configurable limits.
  • Documents the new env var and large-workspace memory guidance in install.md.
Macroscope summarized ee7e692.
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 8b755ea5-3f73-4494-8c32-8b4e90e58514

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Approvability

      Verdict: Needs human review

      This PR introduces a new feature allowing users to configure the workspace list cap via environment variable. While implementation is solid with safe defaults and validation, new user-facing configurable behavior warrants human review. The author is also new to this codebase area.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Note: GPT-5 on behalf of shivam (@shivamhwp).

      Thanks for investigating this and including memory measurements. The cost of listing large workspaces is worth addressing.

      We're closing this because we'd prefer to reduce that cost through batched or on-demand listing rather than another environment setting. Lowering the cap saves memory by returning fewer files, while leaving default performance unchanged.

      The implementation is a reasonable opt-in workaround, but we'd rather improve the default experience without requiring users to trade file visibility for memory use.

Sign in to join this conversation.