Skip to content

Configurable plugin limits#106

Merged
simongdavies merged 3 commits intohyperlight-dev:mainfrom
simongdavies:configurable-plugin-limits
May 7, 2026
Merged

Configurable plugin limits#106
simongdavies merged 3 commits intohyperlight-dev:mainfrom
simongdavies:configurable-plugin-limits

Conversation

@simongdavies
Copy link
Copy Markdown
Member

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)

  • Removed maximum constraints from most numeric configuration options in plugins/fetch/index.ts, plugins/fs-read/index.ts, and their schemas, allowing users to configure higher values as needed. Internal logic now uses Number.MAX_SAFE_INTEGER as the ceiling.

New User-Configurable Limits

  • Added new configuration options to plugins/fs-read/index.ts for maxReadChunkKb (per-call file read chunk size, default 1MB) and maxListResults (maximum directory listing results, default 1000). These replace previous hardcoded constants and are reflected in the schema and documentation.
  • Added new configuration options to plugins/fetch/index.ts for maxRedirects, maxJsonResponseBytes, and maxTextResponseBytes, making these limits user-configurable instead of hardcoded.

Refactoring and Cleanup

  • Removed unused or now-configurable constants (MAX_SIZE_LIMIT_KB, MAX_READ_CHUNK_KB, MAX_LIST_RESULTS, MAX_REDIRECTS) from plugins/fs-read/index.ts and plugins/fetch/index.ts.
  • Updated all relevant code paths to use the new configuration options instead of hardcoded values, including error messages and runtime checks.

Documentation and Error Message Updates

  • Updated plugin documentation and inline comments to clarify that limits are now configurable and to warn users about potential VM faults if buffer-related limits are set too high.

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>
Copilot AI review requested due to automatic review settings May 6, 2026 22:03
@simongdavies simongdavies added the enhancement New feature or request label May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 maximum constraints 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.

Comment thread plugins/fs-write/index.ts Outdated
Comment thread plugins/fs-read/index.ts
Comment thread plugins/fetch/index.ts
Comment thread plugins/fetch/index.ts
Comment thread plugins/fs-write/index.ts
Comment thread plugins/fs-read/index.ts
Comment thread plugins/fetch/index.ts
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>
@simongdavies simongdavies merged commit b9d22f8 into hyperlight-dev:main May 7, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants