Configurable plugin limits#106
Merged
simongdavies merged 3 commits intohyperlight-dev:mainfrom May 7, 2026
Merged
Conversation
fs-read: - maxReadChunkKb: per-call read limit (default 1024 KB, max 10240 KB) - maxListResults: listDir result cap (default 1000, max 50000) fs-write: - maxWriteChunkKb: per-call write limit (default 2048 KB, max 10240 KB) fetch: - maxRedirects: HTTP redirect hops (default 5, max 20) - maxJsonResponseBytes: fetchJSON size cap (default 1 MB, max 10 MB) - maxTextResponseBytes: fetchText size cap (default 2 MB, max 10 MB) All new fields follow the existing config schema pattern with sensible defaults matching previous hardcoded values, so behaviour is unchanged unless explicitly overridden. Hard ceilings remain as safety guards. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
All schema 'maximum' fields removed from plugin configs. Users can now set any value they want — the OS/hardware is the only limit, not arbitrary numbers we picked. Defaults remain sensible and safe. - fs-read: no ceiling on maxFileSizeKb, maxReadChunkKb, maxListResults - fs-write: no ceiling on maxWriteSizeKb, maxWriteChunkKb, maxEntries - fetch: no ceiling on any numeric config field (response sizes, rate limits, timeouts, cache sizes, session budgets — all uncapped) Removed unused MAX_SIZE_LIMIT_KB, MAX_READ_CHUNK_KB, MAX_LIST_RESULTS, MAX_WRITE_CHUNK_KB, MAX_ENTRIES_LIMIT, MAX_REDIRECTS constants. Updated plugin.json hints and PLUGINS.md docs to reflect configurable (not fixed) per-call limits. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the built-in plugins (fs-read, fs-write, fetch) to make multiple operational limits configurable (and removes prior hard maximums) so operators can tune behavior based on hardware and sandbox buffer sizing.
Changes:
- Removes schema
maximumconstraints from many numeric plugin config fields and refactors runtime checks to avoid “artificial ceilings”. - Adds new config options: fs-read (
maxReadChunkKb,maxListResults), fs-write (maxWriteChunkKb), fetch (maxRedirects,maxJsonResponseBytes,maxTextResponseBytes). - Updates manifests/docs/error messages to reflect configurability and buffer-size coupling.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/fs-write/plugin.json | Updates hints to reflect configurable per-call write chunk size. |
| plugins/fs-write/index.ts | Adds maxWriteChunkKb and refactors write/append size enforcement to use config. |
| plugins/fs-read/plugin.json | Updates hints to reflect configurable per-call read chunk size. |
| plugins/fs-read/index.ts | Adds maxReadChunkKb/maxListResults and refactors read/list enforcement to use config. |
| plugins/fetch/index.ts | Removes ceilings for many limits; adds configurable redirect and JSON/text convenience limits. |
| docs/PLUGINS.md | Updates plugin authoring docs example to remove a hard maximum. |
Bug fixes: - fs-read/fs-write: pass Number.MAX_SAFE_INTEGER as ceiling to safeNumericConfig — the shared helper defaults to 10240 KB which silently clamped maxWriteSizeKb (default 20480) and other values back to 10 MB, defeating the 'no artificial ceilings' change - fetch: use Buffer.byteLength(body, 'utf8') instead of body.length for maxJsonResponseBytes and maxTextResponseBytes guards — body.length counts UTF-16 code units which undercounts for non-ASCII content New tests (14 tests added): - fs-read: maxReadChunkKb enforcement, maxListResults truncation, maxFileSizeKb above old 10 MB ceiling - fs-write: maxWriteChunkKb enforcement for text and binary writes, maxWriteSizeKb above old 50 MB ceiling - fetch: config acceptance for maxRedirects, maxJsonResponseBytes, maxTextResponseBytes, maxDataReceivedKb, and uncapped rate limits Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request removes artificial upper limits ("ceilings") from several plugin configuration options, allowing operators to set higher values as needed for their use case and hardware. It also introduces new, user-configurable limits for file read chunk size, directory listing results, HTTP redirects, and JSON/text response sizes. Documentation and error messages are updated to reflect these changes.
Major changes by theme:
Removal of Artificial Ceilings (No More Hard Maximums)
maximumconstraints from most numeric configuration options inplugins/fetch/index.ts,plugins/fs-read/index.ts, and their schemas, allowing users to configure higher values as needed. Internal logic now usesNumber.MAX_SAFE_INTEGERas the ceiling.New User-Configurable Limits
plugins/fs-read/index.tsformaxReadChunkKb(per-call file read chunk size, default 1MB) andmaxListResults(maximum directory listing results, default 1000). These replace previous hardcoded constants and are reflected in the schema and documentation.plugins/fetch/index.tsformaxRedirects,maxJsonResponseBytes, andmaxTextResponseBytes, making these limits user-configurable instead of hardcoded.Refactoring and Cleanup
MAX_SIZE_LIMIT_KB,MAX_READ_CHUNK_KB,MAX_LIST_RESULTS,MAX_REDIRECTS) fromplugins/fs-read/index.tsandplugins/fetch/index.ts.Documentation and Error Message Updates