Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(mcp-host): size the GFS download cache from the workspace volume
Alfredo Lopez08906e08fabc
diff --git a/deploy/overlays/minikube/configmaps/mcp-host-config.yaml b/deploy/overlays/minikube/configmaps/mcp-host-config.yamlindex 969179c18..3e24bc29c 100644--- a/deploy/overlays/minikube/configmaps/mcp-host-config.yaml+++ b/deploy/overlays/minikube/configmaps/mcp-host-config.yaml@@ -23,9 +23,7 @@ data:CLERUM_SHELL_TIMEOUT: '1500000'CLERUM_TOOL_TIMEOUT: '1500000'MCP_HOST_GFS_MAX_FILE_BYTES: '16777216'- MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES: '1073741824'- MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES: '268435456'- MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES: '8'+ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '85'MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY: '1'MCP_HOST_GFS_DOWNLOAD_TTL_HOURS: '168'CLERUM_MCP_TOOL_TIMEOUT_MS: '1500000'diff --git a/docs/operations/gfs-large-file-host-downloads.md b/docs/operations/gfs-large-file-host-downloads.mdindex b269062d2..9f3933b7f 100644--- a/docs/operations/gfs-large-file-host-downloads.md+++ b/docs/operations/gfs-large-file-host-downloads.md@@ -47,16 +47,16 @@ without discarding the path, checksum, version or retained original.## Effective limits-| Environment variable | Default | Ceiling | Meaning |-| -------------------------------------------- | -----------: | ------------------: | ----------------------------------------------------------------- |-| `MCP_HOST_GFS_MAX_FILE_BYTES` | `16777216` | `209715200` | Largest GFS source admitted by MCP Host. |-| `MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES` | `1073741824` | deployment-approved | Aggregate retained download budget. |-| `MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES` | `268435456` | aggregate budget | Per-caller retained download budget. |-| `MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES` | `8` | `64` | Retained files per caller, complete copies plus active transfers. |-| `MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY` | `1` | `2` | Simultaneous active transfers per caller. |-| `MCP_HOST_GFS_DOWNLOAD_TTL_HOURS` | `168` | `8760` | Retention period for a completed copy. |+| Environment variable | Default | Ceiling | Meaning |+| ------------------------------------------ | ---------: | ----------: | ------------------------------------------------------------------ |+| `MCP_HOST_GFS_MAX_FILE_BYTES` | `16777216` | `209715200` | Largest GFS source admitted by MCP Host. |+| `MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT` | `85` | `100` | Retained download budget, as a percentage of the workspace volume. |+| `MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY` | `1` | `2` | Simultaneous active transfers per caller. |+| `MCP_HOST_GFS_DOWNLOAD_TTL_HOURS` | `168` | `8760` | Retention period for a completed copy. |-All values are parsed as positive decimal byte/count/hour integers. Empty, fractional, negative, exponent, padded, partial, non-integer, and above-ceiling values fail startup. Per-caller storage cannot exceed aggregate storage.+All values are parsed as positive decimal byte/percent/count/hour integers. Empty, zero, fractional, negative, exponent, padded, partial, non-integer, and above-ceiling values fail startup; the storage percent therefore accepts 1 to 100.++`MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES`, `MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES` and `MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES` were removed. The per-user byte and file limits were removed by user decision: a fixed byte budget did not follow the size of the workspace volume. A Host that still has any of them set starts normally, ignores it and logs one `warn` `GFS download store ignores a removed retained-storage variable; the budget is MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT of the workspace volume` per variable, naming the variable and never its value.The supported end-to-end size is the minimum of the applicable Desktop/GFS upload limit, GFSC transport limits, MCP Host admission, workspace PVC capacity, download quotas, and provider-specific visual limits. Raising only MCP Host admission does not raise any other layer.@@ -172,11 +172,14 @@ a new ID, after fresh GFS authorization.files under `users/*`, including their `.gfs-downloads` copies. Per-userisolation of the shell (a per-user UID, a chroot or a sandbox) is out ofscope of #1028; approval remains the shell's control.-6. Quotas, free space and the Host-wide active-transfer limit are shared by- every caller on a Host. A caller can therefore observe aggregate pressure- from others (`host_quota_exceeded`, Host-scope `download_busy`, or a Host- eviction that removes one of its own unpinned copies). These signals carry- no identity, count, name or path of another caller's files.+6. The retained-storage budget, free space and the Host-wide active-transfer+ limit are shared by every caller on a Host; there is no per-caller byte or+ file limit. A caller can therefore observe aggregate pressure from others+ (`host_quota_exceeded`, Host-scope `download_busy`, or an eviction that+ removes one of its own unpinned copies), and one caller's admission can+ evict another caller's unpinned copies, which costs that caller a+ re-download. These signals carry no identity, count, name or path of+ another caller's files, and an evicted copy exposes no data.7. Check-then-use windows on paths are narrowed, not closed. Node has no`openat`/`renameat`/`unlinkat`, so the store cannot hold a directorydescriptor across a check and the call that uses the path. It opens files@@ -200,9 +203,8 @@ Host process published. Reuse and full managed reads re-hash the content againstthe digest held in memory, and a mismatch deletes the copy; the managed prefixread checks inode, size and mode only (see [Integrity](#integrity)).Directories found on disk that this process did not publish (left by a previous-process or planted by a command) are counted against the quota of the-`users/<key>` directory that contains them and removed when they expire or are-evicted; they are never reused, never read back into a model and never pinned.+process or planted by a command) are counted against the Host budget and+removed when they expire or are evicted; they are never reused, never read back into a model and never pinned.A Host restart therefore loses reuse for every copy, at the cost of one extradownload per file; accounting and cleanup survive the restart. Approvedarbitrary shell access remains a documented Stage 1 residual; stronger executor@@ -278,8 +280,8 @@ incomplete: it is not charged and the next sweep removes it.Each complete copy the store knows about is either _published_ (written by thisHost process) or _adopted_ (found on disk by a sweep). Only published copies arereused, served by managed reads or pinned, and only for the caller that-downloaded them. Adopted copies count against the quota of the `users/<key>`-directory that holds them, are evicted first and are removed when they expire.+downloaded them. Adopted copies count against the Host budget, are evicted+first and are removed when they expire.A restart turns every copy into an adopted one: the files stay charged and arecleaned up on schedule, and a model that needs one downloads it again.@@ -305,30 +307,48 @@ affected.### Quotas and eviction-Usage is the sum of complete copies plus the reservations of active transfers.-A caller's usage is everything under its own `users/<key>` directory, whoever-wrote it. Admission refuses with `caller_quota_exceeded` when the caller's bytes-or files would exceed its limits, and with `host_quota_exceeded` when the Host-totals would (1024 MiB and 64 files by default). Before refusing, the store-plans an eviction of complete, unpinned copies that are not being transferred:-adopted copies first (oldest `createdAt` first), then published copies least-recently used first (publication, reuse or managed read). A caller-quota denial-evicts only that caller's own copies; a Host-quota denial can evict any-caller's. The whole plan is computed before anything is deleted: when no plan-fits, nothing is deleted and the admission is refused. Eviction candidates are-not hashed.+The store has one retained-storage limit: Host bytes. Usage is the sum of+complete copies, the reservations of active transfers and the duplicates a+sweep could not remove, in every caller's directory. The budget is+`floor(volume bytes × MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT / 100)`, where the+volume bytes are `blocks × bsize` from the same `statfs` of the Host root that+the free-space check reads at each admission, so a resized volume counts from+the next admission without a restart. By default the cache can therefore use+up to 85% of the volume. An admission is refused with `host_quota_exceeded`+(reason `storage_bytes`) when usage plus its size would exceed the budget; a+usage exactly at the budget is admitted. There is no per-caller byte or file+limit and no file count: per-user limits were removed by user decision, and one+caller can hold any number of copies while the budget has room.++Before refusing, the store plans an eviction of complete, unpinned copies that+are not being transferred, in any caller's directory: adopted copies first+(oldest `createdAt` first), then published copies least recently used first+(publication, reuse or managed read). Pinned copies are never evicted. One+caller's admission can thus evict another caller's unpinned copies; that caller+pays a re-download on its next use and learns nothing about who caused it, and+the denial is the same code whoever's copies fill the budget. The whole plan is+computed before anything is deleted: when no plan fits, nothing is deleted and+the admission is refused. Eviction candidates are not hashed.++Shell writes do not trigger eviction. Files a command writes elsewhere in a+workspace share the volume with the cache but are not charged to the budget, so+a full cache can make a shell write fail with `ENOSPC` until the next admission+evicts copies or the next sweep removes expired ones.Free space is checked before the plan and again after it. Free space must coverthe block-rounded size of the new download, every active reservation and a16 MiB margin; otherwise the admission is refused with `host_quota_exceeded`(reason `free_space`). The first check runs before any eviction, so a volume-that cannot hold the download costs no cached copy. A Host runs at most 2+that cannot hold the download costs no cached copy. A `statfs` that reports a+block size or block count that is not positive cannot size a budget; the+admission is refused the same way, as `host_quota_exceeded` with reason+`free_space`. A Host runs at most 2transfers at once, and a caller at most its configured concurrency; beyond thatadmission returns `download_busy`.-If the quota limits (`MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES`, the caller limits-or the file counts) are lowered, existing copies remain charged and new-admissions evict or are refused until usage falls below the new policy.+If `MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT` is lowered or the volume shrinks,+existing copies remain charged and new admissions evict or are refused until+usage falls below the new budget.Lowering `MCP_HOST_GFS_DOWNLOAD_TTL_HOURS` or `MCP_HOST_GFS_MAX_FILE_BYTES` isdifferent: a `meta.json` is validated against the limits in force, so after therestart every copy whose size or retention exceeds the new value is incomplete@@ -365,7 +385,7 @@ it` and counts `sweep_failed`. All three log the error code only.A directory that cannot be listed is skipped and retried by the next sweep(`sweep_failed`). A removal that fails is logged with its error code(`remove_failed`) and retried by the next sweep; the copy stays where it is,-indexed and charged to its caller, and a published copy stays published. Only a+indexed and charged, and a published copy stays published. Only aremoval that moved a directory counts as `incomplete_removed` or`expired_removed`; one whose directory never existed counts nothing. Expiry is the boundary itself: acopy whose `expiresAt` equals the current time is expired for reuse, managed@@ -406,17 +426,16 @@ byte is sent to a model.### Errors visible to the model-| Code | Meaning |-| ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |-| `caller_quota_exceeded` | The caller's retained bytes or files would exceed its limits and eviction cannot make room. |-| `host_quota_exceeded` | The Host's bytes or files, the admission size limit or free space would be exceeded. |-| `download_busy` | Too many active transfers, the store is closed or closing, or no such transfer exists. |-| `download_missing` | No copy this process published for this caller has that path, or the copy failed verification. |-| `download_expired` | The copy or the transfer is past its expiry. |-| `publication_cancelled` | The task was cancelled or ran out of time while the copy was being verified or published. |-| `storage_write_failed` | A filesystem operation failed during admission, publication or removal. |-| `workspace_unavailable` | The store is not initialized, or the Host root or caller directory is not a real directory inside the Host root. |-| `caller_mismatch` | The request carries no caller identity, one that is not its caller directory's key, or a malformed retention owner ID. |+| Code | Meaning |+| ----------------------- | ------------------------------------------------------------------------------------------------------------------------ |+| `host_quota_exceeded` | The Host's retained bytes would exceed the volume budget and eviction cannot make room, or free space would be exceeded. |+| `download_busy` | Too many active transfers, the store is closed or closing, or no such transfer exists. |+| `download_missing` | No copy this process published for this caller has that path, or the copy failed verification. |+| `download_expired` | The copy or the transfer is past its expiry. |+| `publication_cancelled` | The task was cancelled or ran out of time while the copy was being verified or published. |+| `storage_write_failed` | A filesystem operation failed during admission, publication or removal. |+| `workspace_unavailable` | The store is not initialized, or the Host root or caller directory is not a real directory inside the Host root. |+| `caller_mismatch` | The request carries no caller identity, one that is not its caller directory's key, or a malformed retention owner ID. |Another caller's download is answered with the same code and message as an IDthat does not exist (`download_missing` for reads and publication,@@ -467,7 +486,8 @@ The global `/metrics` endpoint exposes fixed-cardinality instruments:- `clerum_gfs_download_duration_seconds`- `clerum_gfs_download_active`- `clerum_gfs_download_quota_total{scope,reason}`, with `reason` one of- `storage_bytes`, `retained_files`, `active_downloads`, `free_space`+ `storage_bytes`, `active_downloads`, `free_space` (`storage_bytes` and+ `free_space` are Host-scope only)- `clerum_gfs_download_expiry_total{outcome}`, with `outcome` one of`expired_removed` (expired or evicted), `incomplete_removed`, `remove_failed`,`retired_legacy_store`, `sweep_failed`@@ -485,6 +505,9 @@ sweep retries it` and `GFS download store could not list a downloaddirectory; the next sweep retries it`, each with an errno `code`.- `warn` `GFS download store closed with active transfers; their directoriesare removed at the next start` with the `active` count.+- `warn` `GFS download store ignores a removed retained-storage variable; the+budget is MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT of the workspace volume`, once+ per removed variable that is set at startup, with the `variable` name only.## Rollout and rollback@@ -519,8 +542,8 @@ Rolling back to the dev image (`74e0d81d9`) is safe. That image creates a newthe `meta.json` directories this image left. The dev image charges only itsledger records, so those directories are outside its accounting: they are notcharged against its quota, only its free-space check sees them, and their size-is bounded by the quota in force when this image wrote them (1024 MiB by-default) plus any partial files. They stay until a later image sweeps them. A+is bounded by the budget in force when this image wrote them (85% of the volume+by default) plus any partial files. They stay until a later image sweeps them. Aretired tree or a `.gfs-downloads.trash-*` tree left by a failed removal is notprotected from workspace tools under that image. Rolling forward again retiresthe store the dev image created and keeps every copy that is still complete anddiff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 55bf53a3c..d0b4ad2b6 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.538",+ "version": "0.1.539","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.538",+ "version": "0.1.539","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 6a90ae8cf..a6564b3b5 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.538",+ "version": "0.1.539","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/agent/__tests__/gfsFilePreparation.test.ts b/mcp-host/src/agent/__tests__/gfsFilePreparation.test.tsindex a359f2ba9..40064e58d 100644--- a/mcp-host/src/agent/__tests__/gfsFilePreparation.test.ts+++ b/mcp-host/src/agent/__tests__/gfsFilePreparation.test.ts@@ -285,7 +285,7 @@ describe('GFS file preparation', () => {['Error: GFS read failed (gfsc 403: forbidden)', 'denied'],['Error: GFS read failed (gfsc 404: not_found)', 'missing'],['Error: GFS download failed (version_conflict)', 'stale'],- ['Error: GFS download store failed (caller_quota_exceeded)', 'quota_exceeded'],+ ['Error: GFS download store failed (host_quota_exceeded)', 'quota_exceeded'],['Error: untrusted transport detail', 'download_failed'],] as const)('publishes a fixed category for %s', async (content, code) => {const test = subject(vi.fn(async () => ({ content, duration_ms: 1, is_error: true })))diff --git a/mcp-host/src/agent/gfsFilePreparation.ts b/mcp-host/src/agent/gfsFilePreparation.tsindex 0212fe13f..db7e26f63 100644--- a/mcp-host/src/agent/gfsFilePreparation.ts+++ b/mcp-host/src/agent/gfsFilePreparation.ts@@ -50,7 +50,7 @@ function failureCode(content: string): GfsPreparationFailure {const fixed = /^Error: GFS (?:download(?: store)?|read) failed \(([a-z_]+)\)$/.exec(content)?.[1]if (fixed === 'version_conflict') return 'stale'if (fixed === 'download_missing' || fixed === 'download_expired') return 'missing'- if (fixed === 'caller_quota_exceeded' || fixed === 'host_quota_exceeded') return 'quota_exceeded'+ if (fixed === 'host_quota_exceeded') return 'quota_exceeded'if (fixed === 'workspace_unavailable') return 'workspace_unavailable'if (fixed === 'limit_exceeded') return 'limit_exceeded'if (fixed === 'timeout') return 'timeout'diff --git a/mcp-host/src/internalTools/gfsDownloadMetrics.test.ts b/mcp-host/src/internalTools/gfsDownloadMetrics.test.tsindex 001661a73..ea9cc21cb 100644--- a/mcp-host/src/internalTools/gfsDownloadMetrics.test.ts+++ b/mcp-host/src/internalTools/gfsDownloadMetrics.test.ts@@ -41,7 +41,7 @@ describe('GFS download metrics', () => {['clerum_gfs_download_admissions_total', { outcome: 'workspace_attempt' }],['clerum_gfs_download_transfers_total', { outcome: 'success' }],['clerum_gfs_shell_output_limits_total', { outcome: 'output_limit_exceeded' }],- ['clerum_gfs_download_quota_total', { scope: 'caller', reason: 'storage_bytes' }],+ ['clerum_gfs_download_quota_total', { scope: 'host', reason: 'storage_bytes' }],['clerum_gfs_download_expiry_total', { outcome: 'remove_failed' }],] as constconst before = await Promise.all(series.map(([name, labels]) => counterValue(name, labels)))@@ -53,7 +53,7 @@ describe('GFS download metrics', () => {recordGfsDownloadTransfer('success', 0.25)exitGfsDownloadTransfer()recordGfsShellOutputLimit('output_limit_exceeded')- recordGfsDownloadQuota('caller', 'storage_bytes')+ recordGfsDownloadQuota('host', 'storage_bytes')recordGfsDownloadExpiry('remove_failed')// Each call moved its own series by exactly one.@@ -69,7 +69,7 @@ describe('GFS download metrics', () => {'clerum_gfs_shell_output_limits_total{outcome="output_limit_exceeded"}')expect(scraped).toContain(- 'clerum_gfs_download_quota_total{scope="caller",reason="storage_bytes"}'+ 'clerum_gfs_download_quota_total{scope="host",reason="storage_bytes"}')expect(scraped).toContain('clerum_gfs_download_expiry_total{outcome="remove_failed"}')})diff --git a/mcp-host/src/internalTools/gfsDownloadMetrics.ts b/mcp-host/src/internalTools/gfsDownloadMetrics.tsindex ecb9fc7e1..215861968 100644--- a/mcp-host/src/internalTools/gfsDownloadMetrics.ts+++ b/mcp-host/src/internalTools/gfsDownloadMetrics.ts@@ -39,11 +39,7 @@ export type GfsDownloadShellLimitOutcome = 'output_limit_exceeded'export type GfsDownloadQuotaScope = 'host' | 'caller'-export type GfsDownloadQuotaReason =- | 'storage_bytes'- | 'retained_files'- | 'active_downloads'- | 'free_space'+export type GfsDownloadQuotaReason = 'storage_bytes' | 'active_downloads' | 'free_space'export type GfsDownloadExpiryOutcome =| 'expired_removed'diff --git a/mcp-host/src/internalTools/gfsDownloadStore.test.ts b/mcp-host/src/internalTools/gfsDownloadStore.test.tsindex 6c1ea78b3..bf0b3c509 100644--- a/mcp-host/src/internalTools/gfsDownloadStore.test.ts+++ b/mcp-host/src/internalTools/gfsDownloadStore.test.ts@@ -399,35 +399,27 @@ describe('GFS download store: reuse', () => {})})-/** The smallest limits the policy accepts with two callers' worth of Host storage. */-const HOST_30_CALLER_15 = {+/** A 10-byte file limit and the whole (mocked) volume as the retained budget. */+const SMALL_FILES_FULL_VOLUME = {MCP_HOST_GFS_MAX_FILE_BYTES: '10',- MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES: '30',- MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES: '15',+ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100',}-describe('GFS download store: quotas and eviction', () => {- it("F8: a caller over quota evicts its own oldest completed downloads, never another caller's", async () => {- const { limited, limits } = await limitedStore({ MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES: '2' })- expect(limits.callerRetainedFiles).toBe(2)- const otherRoot = await callerDirectory(hostRoot, 'caller-b')- const other = await completedCopy(limited, otherRoot, 'caller-b', 10, 8)- tick()- const oldest = await completedCopy(limited, callerRoot, CALLER, 11, 8)- tick()- const newer = await completedCopy(limited, callerRoot, CALLER, 12, 8)- tick()-- await startTransfer(limited, callerRoot, CALLER, 13, 8)-- expect(await exists(downloadDirectory(callerRoot, oldest.receipt.id))).toBe(false)- // Witnesses: the caller's newer copy and the other caller's older copy stay.- expect(await exists(downloadDirectory(callerRoot, newer.receipt.id))).toBe(true)- expect(await exists(downloadDirectory(otherRoot, other.receipt.id))).toBe(true)+/**+ * statfs reports the real free space but a volume of `totalBytes` (block size+ * 1), so the retained budget is `floor(totalBytes * percent / 100)`.+ */+function volumeOf(totalBytes: number): void {+ statfsBoundary.mockImplementation(async (target: string) => {+ const real = await nativeFs.statfs(target, { bigint: true })+ return { ...real, bsize: 1n, blocks: BigInt(totalBytes), bavail: real.bavail * real.bsize }})+}+describe('GFS download store: quotas and eviction', () => {it("F9: a host over quota may evict any caller's oldest completed download", async () => {- const { limited } = await limitedStore(HOST_30_CALLER_15)+ volumeOf(30)+ const { limited } = await limitedStore(SMALL_FILES_FULL_VOLUME)const otherRoot = await callerDirectory(hostRoot, 'caller-b')const thirdRoot = await callerDirectory(hostRoot, 'caller-c')const other = await completedCopy(limited, otherRoot, 'caller-b', 20, 10)@@ -447,36 +439,38 @@ describe('GFS download store: quotas and eviction', () => {})it('F10: when eviction cannot make room nothing is deleted', async () => {- const { limited } = await limitedStore({ MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES: '2' })+ volumeOf(16)+ const { limited } = await limitedStore(SMALL_FILES_FULL_VOLUME)await completedCopy(limited, callerRoot, CALLER, 30, 8, { owner: 'task-1' })tick()await completedCopy(limited, callerRoot, CALLER, 31, 8, { owner: 'task-1' })const downloads = path.join(callerRoot, '.gfs-downloads')const before = (await nativeFs.readdir(downloads)).sort()- const denied = await quotaCount('caller', 'retained_files')+ const denied = await quotaCount('host', 'storage_bytes')lstatBoundary.mockClear()await expect(startTransfer(limited, callerRoot, CALLER, 32, 8)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})// Witness: the admission read the inventory before refusing.expect(lstatBoundary.mock.calls.length).toBeGreaterThan(0)expect((await nativeFs.readdir(downloads)).sort()).toEqual(before)expect(before).toHaveLength(2)- expect(await quotaCount('caller', 'retained_files')).toBe(denied + 1)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)})it("F10b: a quota denial carries only its code, never another caller's id, path, name or usage", async () => {- const { limited } = await limitedStore(HOST_30_CALLER_15)+ volumeOf(30)+ const { limited } = await limitedStore(SMALL_FILES_FULL_VOLUME)const otherRoot = await callerDirectory(hostRoot, 'caller-b')const thirdRoot = await callerDirectory(hostRoot, 'caller-c')const other = await completedCopy(limited, otherRoot, 'caller-b', 24, 10, { owner: 'task-b' })const third = await completedCopy(limited, thirdRoot, 'caller-c', 25, 10, { owner: 'task-c' })await completedCopy(limited, callerRoot, CALLER, 28, 5, { owner: 'task-a' })- // Within maxFileBytes (10) and caller-a's 15; the Host would reach 35 of 30- // and every copy is pinned, so only the Host quota decision can refuse it.+ // Within maxFileBytes (10); the Host would reach 35 of 30 and every copy+ // is pinned, so only the Host quota decision can refuse it.const error = await startTransfer(limited, callerRoot, CALLER, 26, 10).then(() => undefined,(rejection: unknown) => rejection@@ -508,9 +502,8 @@ describe('GFS download store: quotas and eviction', () => {})it('F11: pinned and active downloads are never evicted', async () => {- const { limited } = await limitedStore({- ...HOST_30_CALLER_15,- })+ volumeOf(30)+ const { limited } = await limitedStore(SMALL_FILES_FULL_VOLUME)const otherRoot = await callerDirectory(hostRoot, 'caller-b')const thirdRoot = await callerDirectory(hostRoot, 'caller-c')const pinned = await completedCopy(limited, callerRoot, CALLER, 40, 10, { owner: 'task-40' })@@ -550,9 +543,8 @@ describe('GFS download store: quotas and eviction', () => {})it('F13: eviction candidates are not hashed', async () => {- const { limited } = await limitedStore({- ...HOST_30_CALLER_15,- })+ volumeOf(15)+ const { limited } = await limitedStore(SMALL_FILES_FULL_VOLUME)const first = await completedCopy(limited, callerRoot, CALLER, 60, 3)tick()const second = await completedCopy(limited, callerRoot, CALLER, 61, 3)@@ -561,7 +553,7 @@ describe('GFS download store: quotas and eviction', () => {tick()hashBoundary.mockClear()- // 15 retained + 6 requested against 15: the plan takes the two 3-byte copies.+ // 15 retained + 6 requested against a budget of 15: the plan takes the two 3-byte copies.await startTransfer(limited, callerRoot, CALLER, 64, 6)// Witness: two candidates were evicted.@@ -990,16 +982,17 @@ describe('GFS download store: pins, lifecycle and errors', () => {// (S08, S10, S11, S12, S13, S22, S24), adapted from its verified repros.describe('GFS download store: adversarial review kill tests', () => {it('ADV-S08: an infeasible eviction plan deletes nothing even when some copies are evictable', async () => {- const { limited } = await limitedStore(HOST_30_CALLER_15)+ volumeOf(15)+ const { limited } = await limitedStore(SMALL_FILES_FULL_VOLUME)const loose = await completedCopy(limited, callerRoot, CALLER, 70, 5)tick()await completedCopy(limited, callerRoot, CALLER, 71, 8, { owner: 'task-1' })- const denied = await quotaCount('caller', 'storage_bytes')+ const denied = await quotaCount('host', 'storage_bytes')await expect(startTransfer(limited, callerRoot, CALLER, 72, 10)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})// Witness: the admission reached the quota decision.- expect(await quotaCount('caller', 'storage_bytes')).toBe(denied + 1)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)// The unpinned copy could not make room on its own, so it must survive.expect(await exists(downloadDirectory(callerRoot, loose.receipt.id))).toBe(true)// Witness: once the pin is released the same admission evicts and succeeds.diff --git a/mcp-host/src/internalTools/gfsDownloadStore.ts b/mcp-host/src/internalTools/gfsDownloadStore.tsindex abe0482df..ca3725f24 100644--- a/mcp-host/src/internalTools/gfsDownloadStore.ts+++ b/mcp-host/src/internalTools/gfsDownloadStore.ts@@ -12,7 +12,7 @@ import { recordGfsDownloadExpiry, recordGfsDownloadQuota } from './gfsDownloadMeimport {GFS_FILE_LIMITS,GFS_HOST_ACTIVE_DOWNLOADS,- GFS_HOST_RETAINED_FILES,+ REMOVED_GFS_STORAGE_VARIABLES,} from './gfsFilePolicy'import {PrivateStoreUntrustedError,@@ -53,7 +53,6 @@ const SHA256_RE = /^[0-9a-f]{64}$/export type GfsDownloadStoreErrorCode =| 'caller_mismatch'- | 'caller_quota_exceeded'| 'download_busy'| 'download_expired'| 'download_missing'@@ -103,8 +102,8 @@ interface StoredMeta {* Provenance lives only in memory. A `published` entry was written by this* process, so its caller identity and sha256 are trusted. An `adopted` entry* was found on disk (left by an earlier process or planted by a shell command- * running with the Host UID): it counts against the quota of the directory- * that contains it and is swept, but it is never reused, read or pinned.+ * running with the Host UID): it counts against the Host budget and is swept,+ * but it is never reused, read or pinned.*//** dev/ino of an inode, compared against an open descriptor or a later lstat. */interface InodeIdentity {@@ -125,7 +124,7 @@ interface Entry extends StoredMeta {* never served.*/sourceIdentity?: InodeIdentity- /** `<hostRoot>/users/<key>` containing the entry: the owner for quota and inventory. */+ /** `<hostRoot>/users/<key>` containing the entry: the owner for inventory. */callerRoot: stringprovenance: 'published' | 'adopted'/** Last publish, reuse or managed read in this process; adopted entries use createdAt. */@@ -148,10 +147,24 @@ interface ActiveTransfer {/** A duplicate directory the last sweep could not remove; it stays charged. */interface HeldCopy {- callerRoot: stringsizeBytes: number}+/** The statfs fields admission uses, validated: bsize and blocks positive. */+interface VolumeSpace {+ bsize: bigint+ blocks: bigint+ bavail: bigint+}++/**+ * The retained-storage budget, `floor(volumeTotalBytes * percent / 100)`,+ * computed in bigint so no volume size loses precision.+ */+function retainedBudget(volume: VolumeSpace): bigint {+ return (volume.blocks * volume.bsize * BigInt(GFS_FILE_LIMITS.storagePercent)) / 100n+}+export interface GfsDownloadSweepResult {removedExpired: numberremovedIncomplete: number@@ -425,6 +438,13 @@ export class GfsDownloadStore {}private async runInitialize(): Promise<void> {+ // Named, never echoed: a stale value could be anything an operator typed.+ for (const variable of REMOVED_GFS_STORAGE_VARIABLES)+ if (process.env[variable] !== undefined)+ logger.warn(+ { component: GFS_DOWNLOAD_STORE_LOG_COMPONENT, variable },+ 'GFS download store ignores a removed retained-storage variable; the budget is MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT of the workspace volume'+ )try {await fs.mkdir(this.requestedHostRoot, { recursive: true, mode: 0o700 })const requested = await fs.lstat(this.requestedHostRoot)@@ -518,16 +538,16 @@ export class GfsDownloadStore {}if (input.retentionOwnerId !== undefined) this.assertReceiptOwner(input.retentionOwnerId)// Verified free capacity first: no eviction happens for an admission the- // volume cannot hold anyway. Measured again after eviction below.- await this.assertPhysicalCapacity(input.sizeBytes)+ // volume cannot hold anyway. Measured again after eviction below. The+ // same statfs sizes the budget, so a resized volume counts at once.+ const volume = await this.assertPhysicalCapacity(input.sizeBytes)await this.sweep(Date.now())- await this.reclaimForAdmission(callerRoot, input.sizeBytes)- const denial = this.quotaDenial(callerRoot, input.sizeBytes)- if (denial) {- recordGfsDownloadQuota(denial.scope, denial.reason)- throw new GfsDownloadStoreError(- denial.scope === 'host' ? 'host_quota_exceeded' : 'caller_quota_exceeded'- )+ const budget = retainedBudget(volume)+ await this.reclaimForAdmission(input.sizeBytes, budget)+ if (this.overBudget(input.sizeBytes, budget)) {+ // The code alone: whose copies fill the budget is never part of it.+ recordGfsDownloadQuota('host', 'storage_bytes')+ throw new GfsDownloadStoreError('host_quota_exceeded')}await this.assertPhysicalCapacity(input.sizeBytes)@@ -990,17 +1010,12 @@ export class GfsDownloadStore {return result !== 'failed'}// A duplicate this sweep could not remove is still on disk, so it stays- // charged to the caller root that holds it: a failed cleanup never turns- // into free capacity.+ // charged: a failed cleanup never turns into free capacity.const held = new Map<string, HeldCopy>()const removeDuplicate = async (id: string, directory: string): Promise<void> => {if (await removeIncomplete(directory)) returnconst state = await this.inspectDirectory(directory, id, now)- if (state.state === 'complete')- held.set(directory, {- callerRoot: state.entry.callerRoot,- sizeBytes: state.entry.sizeBytes,- })+ if (state.state === 'complete') held.set(directory, { sizeBytes: state.entry.sizeBytes })}for (const [id, directories] of candidates) {@@ -1382,9 +1397,13 @@ export class GfsDownloadStore {.map(entry => entry.id)}- private async assertPhysicalCapacity(sizeBytes: number): Promise<void> {+ /**+ * A statfs whose block size or block count is not positive cannot size+ * anything; it refuses the admission as `free_space`, like a full volume.+ */+ private async assertPhysicalCapacity(sizeBytes: number): Promise<VolumeSpace> {const space = await fs.statfs(this.hostRoot, { bigint: true })- if (space.bsize <= 0n || space.bavail < 0n) {+ if (space.bsize <= 0n || space.blocks <= 0n || space.bavail < 0n) {recordGfsDownloadQuota('host', 'free_space')throw new GfsDownloadStoreError('host_quota_exceeded')}@@ -1400,71 +1419,47 @@ export class GfsDownloadStore {recordGfsDownloadQuota('host', 'free_space')throw new GfsDownloadStoreError('host_quota_exceeded')}+ return { bsize: space.bsize, blocks: space.blocks, bavail: space.bavail }}- /** Caller usage is keyed by the caller directory that holds each copy, never by meta.json. */- private usage(excluded: ReadonlySet<string> = new Set()) {- const usage = {- bytes: 0,- files: 0,- callerBytes: new Map<string, number>(),- callerFiles: new Map<string, number>(),- }- const add = (callerRoot: string, sizeBytes: number) => {- usage.bytes += sizeBytes- usage.files += 1- usage.callerBytes.set(callerRoot, (usage.callerBytes.get(callerRoot) ?? 0) + sizeBytes)- usage.callerFiles.set(callerRoot, (usage.callerFiles.get(callerRoot) ?? 0) + 1)- }+ /** Retained bytes: indexed copies, active reservations and held duplicates. */+ private usageBytes(excluded: ReadonlySet<string> = new Set()): bigint {+ let bytes = 0nfor (const entry of this.entries.values())- if (!excluded.has(entry.id)) add(entry.callerRoot, entry.sizeBytes)- for (const transfer of this.active.values()) add(transfer.callerRoot, transfer.sizeBytes)- for (const copy of this.held.values()) add(copy.callerRoot, copy.sizeBytes)- return usage+ if (!excluded.has(entry.id)) bytes += BigInt(entry.sizeBytes)+ for (const transfer of this.active.values()) bytes += BigInt(transfer.sizeBytes)+ for (const copy of this.held.values()) bytes += BigInt(copy.sizeBytes)+ return bytes}- private quotaDenial(- callerRoot: string,- sizeBytes: number,- excluded?: ReadonlySet<string>- ): { scope: 'host' | 'caller'; reason: 'storage_bytes' | 'retained_files' } | undefined {- const usage = this.usage(excluded)- // Prove caller admission before considering eviction of another caller.- if ((usage.callerBytes.get(callerRoot) ?? 0) + sizeBytes > GFS_FILE_LIMITS.callerStorageBytes)- return { scope: 'caller', reason: 'storage_bytes' }- if ((usage.callerFiles.get(callerRoot) ?? 0) >= GFS_FILE_LIMITS.callerRetainedFiles)- return { scope: 'caller', reason: 'retained_files' }- if (usage.bytes + sizeBytes > GFS_FILE_LIMITS.storageBytes)- return { scope: 'host', reason: 'storage_bytes' }- if (usage.files >= GFS_HOST_RETAINED_FILES) return { scope: 'host', reason: 'retained_files' }- return undefined+ /** The only retained-storage limit: Host bytes against the volume budget. */+ private overBudget(sizeBytes: number, budget: bigint, excluded?: ReadonlySet<string>): boolean {+ return this.usageBytes(excluded) + BigInt(sizeBytes) > budget}/**- * Completed, unpinned copies are a cache. The whole eviction plan is computed- * before anything is deleted: adopted copies first, so files planted in one- * directory can never cost another caller a copy this process published,- * then published copies least recently used first. A caller denial evicts- * only copies in that caller's directory. With no feasible plan nothing is- * deleted and the admission fails with the quota code; nothing is retained,- * so the next admission plans again. Candidates are not hashed: a corrupt- * copy is as good an eviction candidate as a sound one.+ * Completed, unpinned copies are a cache, whoever downloaded them: one+ * caller's admission may evict another caller's copy, which costs that+ * caller a re-download and reveals nothing. The whole eviction plan is+ * computed before anything is deleted: adopted copies first, so files+ * planted in one directory can never cost another caller a copy this+ * process published, then published copies least recently used first.+ * With no feasible plan nothing is deleted and the admission fails with the+ * quota code; nothing is retained, so the next admission plans again.+ * Candidates are not hashed: a corrupt copy is as good an eviction+ * candidate as a sound one.*/- private async reclaimForAdmission(callerRoot: string, sizeBytes: number): Promise<void> {- if (!this.quotaDenial(callerRoot, sizeBytes)) return+ private async reclaimForAdmission(sizeBytes: number, budget: bigint): Promise<void> {+ if (!this.overBudget(sizeBytes, budget)) returnconst candidates = [...this.entries.values()].filter(entry => !this.isPinned(entry.id)).sort(evictionOrder)const plan = new Set<string>()- for (;;) {- const denial = this.quotaDenial(callerRoot, sizeBytes, plan)- if (!denial) break- const next = candidates.find(- entry => !plan.has(entry.id) && (denial.scope === 'host' || entry.callerRoot === callerRoot)- )- if (!next) return- plan.add(next.id)+ for (const candidate of candidates) {+ if (!this.overBudget(sizeBytes, budget, plan)) break+ plan.add(candidate.id)}+ if (this.overBudget(sizeBytes, budget, plan)) returnfor (const id of plan) {const entry = this.entries.get(id)if (entry) await this.removeEntry(entry, 'expired_removed', false)diff --git a/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts b/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.tsindex 9bcf5041a..7daf5665b 100644--- a/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts+++ b/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts@@ -34,7 +34,6 @@ import {} from '../workspace/protectedPaths'import { deriveUserKey } from '../workspace/userKey'import { GfsDownloadStore } from './gfsDownloadStore'-import { GFS_FILE_LIMITS } from './gfsFilePolicy'type FsOperation = 'open' | 'lstat' | 'rename' | 'rm' | 'readdir' | 'realpath'/**@@ -44,8 +43,9 @@ type FsOperation = 'open' | 'lstat' | 'rename' | 'rm' | 'readdir' | 'realpath'type Fault = (target: string) => string | undefinedconst SKIP_CALL = 'SKIP_CALL'-const { faults } = vi.hoisted(() => ({+const { faults, volume } = vi.hoisted(() => ({faults: new Map<string, (target: string) => string | undefined>(),+ volume: { totalBytes: undefined as bigint | undefined },}))function errnoError(code: string): NodeJS.ErrnoException {@@ -72,6 +72,13 @@ vi.mock('node:fs/promises', async original => {rm: wrap('rm', actual.rm),readdir: wrap('readdir', actual.readdir),realpath: wrap('realpath', actual.realpath),+ // Real free space; a test that sets `volume.totalBytes` sizes the volume+ // (block size 1), and with it the retained budget.+ statfs: async (target: string, options: { bigint: true }) => {+ const real = await actual.statfs(target, options)+ if (volume.totalBytes === undefined) return real+ return { ...real, bsize: 1n, blocks: volume.totalBytes, bavail: real.bavail * real.bsize }+ },}})@@ -121,6 +128,7 @@ async function openStore(): Promise<GfsDownloadStore> {beforeEach(() => {faults.clear()+ volume.totalBytes = undefinedhostRoot = syncFs.mkdtempSync(path.join(tmpdir(), 'gfs-store-adversarial-'))})@@ -383,11 +391,11 @@ describe('GFS download store adversarial round: trash, eviction and undo (ADV-2/})it('an eviction whose removal fails keeps the copy published and charged', async () => {+ volume.totalBytes = 15nconst limited = await withEnvironment({MCP_HOST_GFS_MAX_FILE_BYTES: '10',- MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES: '30',- MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES: '15',+ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100',},async () => {vi.resetModules()@@ -404,7 +412,7 @@ describe('GFS download store adversarial round: trash, eviction and undo (ADV-2/const renames = watch('rename', `input-${receipt.id}`, 'EIO')await expect(startTransfer(limited, root, KEY, 4, 10)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})faults.clear()@@ -564,11 +572,11 @@ describe('GFS download store adversarial round: expiry, close, recency and removit('S28: a managed read refreshes recency, so the unread copy is evicted first', async () => {vi.useFakeTimers({ toFake: ['Date'] })vi.setSystemTime(T0)+ volume.totalBytes = 15nconst limited = await withEnvironment({MCP_HOST_GFS_MAX_FILE_BYTES: '10',- MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES: '30',- MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES: '15',+ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100',},async () => {vi.resetModules()@@ -720,22 +728,22 @@ describe('GFS download store adversarial round: a failed duplicate removal staysreturn calls}- it('duplicates of a full caller’s ids whose removal fails keep both callers charged', async () => {+ it('duplicates of another caller’s ids whose removal fails stay charged against the Host budget', async () => {const owner = callerDirectory(hostRoot, OWNER)const planter = callerDirectory(hostRoot, PLANTER)const bytes = Buffer.from('quota')- const ids = Array.from({ length: GFS_FILE_LIMITS.callerRetainedFiles }, () => randomUUID())+ const ids = Array.from({ length: 8 }, () => randomUUID())for (const id of ids) plantDownload(owner, { id, bytes, meta: metaFor(id, bytes, Date.now()) })+ // 8 copies of 5 bytes plus one 5-byte admission fit; their duplicates do not.+ volume.totalBytes = 80nconst store = await openStore()expect((await store.debugInventory()).byCaller.get(OWNER)?.files).toBe(ids.length)const renames = failRemovals([OWNER, PLANTER], ids)- // Control: without duplicates the full caller is refused; its one eviction- // attempt fails like every other removal here.- await expect(startTransfer(store, owner, OWNER, 1, 5)).rejects.toMatchObject({- code: 'caller_quota_exceeded',- })- expect(renames).toHaveLength(1)+ // Control: without duplicates the budget has room and nothing is evicted.+ const control = await startTransfer(store, owner, OWNER, 1, 5)+ await store.fail(control.transfer.id, OWNER)+ expect(renames).toHaveLength(0)for (const id of ids)plantDownload(planter, { id, bytes, meta: metaFor(id, bytes, Date.now()) })@@ -743,19 +751,19 @@ describe('GFS download store adversarial round: a failed duplicate removal stays// Witness: every copy of every id was a removal attempt, and each failed.expect(sweep.removeFailed).toBe(ids.length * 2)- expect(renames).toHaveLength(1 + ids.length * 2)+ expect(renames).toHaveLength(ids.length * 2)for (const id of ids) {expect(exists(downloadDirectory(owner, id))).toBe(true)expect(exists(downloadDirectory(planter, id))).toBe(true)// The indexed copy is forgotten only once its removal succeeds.expect(indexedEntry(store, id)).toBeDefined()}- // The copies left on disk are still charged to the caller root holding them.+ // The copies left on disk are still charged: 80 retained + 5 > 80.await expect(startTransfer(store, owner, OWNER, 2, 5)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})await expect(startTransfer(store, planter, PLANTER, 3, 5)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})// Once the removals succeed, both callers have their capacity back.@@ -771,9 +779,11 @@ describe('GFS download store adversarial round: a failed duplicate removal staysawait store.fail(planted.transfer.id, PLANTER)})- it('a duplicate of a published copy whose removal fails stays charged to its caller', async () => {+ it('a duplicate of a published copy whose removal fails stays charged', async () => {+ // Room for the published copy and one more of its size, not for a duplicate too.+ volume.totalBytes = 32nconst limited = await withEnvironment(- { MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES: '1' },+ { MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100' },async () => {vi.resetModules()const { GfsDownloadStore: Store } = await import('./gfsDownloadStore')@@ -785,7 +795,10 @@ describe('GFS download store adversarial round: a failed duplicate removal stays)const owner = callerDirectory(hostRoot, OWNER)const planter = callerDirectory(hostRoot, PLANTER)- const { receipt, bytes } = await completedCopy(limited, owner, OWNER, 6, 16)+ // Pinned, so no admission can evict it to make room.+ const { receipt, bytes } = await completedCopy(limited, owner, OWNER, 6, 16, {+ owner: 'task-erin',+ })// Control: the planter has capacity for one copy.const control = await startTransfer(limited, planter, PLANTER, 7, 16)await limited.fail(control.transfer.id, PLANTER)@@ -805,7 +818,7 @@ describe('GFS download store adversarial round: a failed duplicate removal staysexpect(exists(downloadDirectory(planter, receipt.id))).toBe(true)await expect(limited.readManagedFile(receipt.path, OWNER)).resolves.toEqual(bytes)await expect(startTransfer(limited, planter, PLANTER, 8, 16)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})faults.clear()diff --git a/mcp-host/src/internalTools/gfsDownloadStoreBoundaries.test.ts b/mcp-host/src/internalTools/gfsDownloadStoreBoundaries.test.tsindex 5e3d5ec30..faf6930b9 100644--- a/mcp-host/src/internalTools/gfsDownloadStoreBoundaries.test.ts+++ b/mcp-host/src/internalTools/gfsDownloadStoreBoundaries.test.ts@@ -27,7 +27,7 @@ import {} from '../__tests__/fixtures/gfsStoreTestKit'import { logger } from '../logger'import { GfsDownloadStore, GfsDownloadStoreError } from './gfsDownloadStore'-import { GFS_FILE_LIMITS, GFS_HOST_RETAINED_FILES } from './gfsFilePolicy'+import { GFS_FILE_LIMITS } from './gfsFilePolicy'const { statfsBoundary, renameBoundary, openBoundary, realpathBoundary } = vi.hoisted(() => ({statfsBoundary: vi.fn(),@@ -51,10 +51,10 @@ const A = 'caller-a'const B = 'caller-b'const HOUR = 60 * 60_000const META_MAX_BYTES = 64 * 1024-const HOST_30_CALLER_15 = {+/** A 10-byte file limit and the whole (mocked) volume as the retained budget. */+const SMALL_FILES_FULL_VOLUME = {MCP_HOST_GFS_MAX_FILE_BYTES: '10',- MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES: '30',- MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES: '15',+ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100',}let nativeFs: typeof fs@@ -98,6 +98,17 @@ async function limitedStore(env: Record<string, string>): Promise<GfsDownloadSto})}+/**+ * statfs reports the real free space but a volume of `totalBytes` (block size+ * 1), so the retained budget is `floor(totalBytes * percent / 100)`.+ */+function volumeOf(totalBytes: number): void {+ statfsBoundary.mockImplementation(async (target: string) => {+ const real = await nativeFs.statfs(target, { bigint: true })+ return { ...real, bsize: 1n, blocks: BigInt(totalBytes), bavail: real.bavail * real.bsize }+ })+}+/** meta.json padded with an ignored field to exactly `bytes` bytes. */function paddedMeta(id: string, bytes: Buffer, size: number): string {const base = JSON.stringify({ ...metaFor(id, bytes, Date.now()), padding: '' })@@ -230,7 +241,7 @@ describe('GFS download store boundaries: meta.json validation', () => {const atLimit = Buffer.alloc(10, 0x34)const over = plantComplete(rootA, A, 301, tooLarge)const kept = plantComplete(rootB, B, 302, atLimit)- const limited = await limitedStore(HOST_30_CALLER_15)+ const limited = await limitedStore({ MCP_HOST_GFS_MAX_FILE_BYTES: '10' })expect(exists(over.directory)).toBe(false)// Witness: the copy exactly at maxFileBytes is retained.@@ -294,37 +305,45 @@ describe('GFS download store boundaries: meta.json validation', () => {})describe('GFS download store boundaries: quota and capacity', () => {- it('Q1: caller bytes exactly at the budget are admitted and one byte more is refused', async () => {- const limited = await limitedStore(HOST_30_CALLER_15)+ it('Q1: retained bytes exactly at the volume budget are admitted and one byte more is refused', async () => {+ volumeOf(15)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)await completedCopy(limited, rootA, A, 310, 10, { owner: 'task-q1' })- const denied = await quotaCount('caller', 'storage_bytes')+ const denied = await quotaCount('host', 'storage_bytes')const atBudget = await completedCopy(limited, rootA, A, 311, 5, { owner: 'task-q1' })- expect(await quotaCount('caller', 'storage_bytes')).toBe(denied)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied)await expect(limited.readManagedFile(atBudget.receipt.path, A)).resolves.toEqual(atBudget.bytes)await expect(startTransfer(limited, rootA, A, 312, 1)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})- expect(await quotaCount('caller', 'storage_bytes')).toBe(denied + 1)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)})- it('Q2: caller file count at the limit is refused and one below is admitted', async () => {- const limited = await limitedStore({ MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES: '2' })- await completedCopy(limited, rootA, A, 313, 4, { owner: 'task-q2' })- const denied = await quotaCount('caller', 'retained_files')-- await completedCopy(limited, rootA, A, 314, 4, { owner: 'task-q2' })- expect(await quotaCount('caller', 'retained_files')).toBe(denied)+ it('Q2: there is no retained-file limit: one caller keeps 65 copies and only bytes refuse', async () => {+ // 65 one-byte copies: more than the removed 8-per-caller and 64-per-Host limits.+ const files = 65+ volumeOf(files)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)+ const denied = await quotaCount('host', 'storage_bytes')+ for (let index = 0; index < files; index += 1)+ await completedCopy(limited, rootA, A, 400 + index, 1, { owner: 'task-q2' })+ expect((await limited.debugInventory()).byCaller.get(A)).toEqual({ files, bytes: files })+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied)- await expect(startTransfer(limited, rootA, A, 315, 4)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ // Every copy is pinned, so the byte budget is the only thing that can refuse.+ await expect(startTransfer(limited, rootA, A, 400 + files, 1)).rejects.toMatchObject({+ code: 'host_quota_exceeded',})- expect(await quotaCount('caller', 'retained_files')).toBe(denied + 1)- })+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)+ // 65 real publications: the timeout is explicit rather than the 5 s+ // default that a loaded machine can exceed.+ }, 60_000)it('Q3: Host bytes exactly at the budget are admitted and one byte more is refused', async () => {- const limited = await limitedStore(HOST_30_CALLER_15)+ volumeOf(30)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)const rootC = callerDirectory(hostRoot, 'caller-c')await completedCopy(limited, rootB, B, 316, 10, { owner: 'task-b' })await completedCopy(limited, rootC, 'caller-c', 317, 10, { owner: 'task-c' })@@ -341,36 +360,6 @@ describe('GFS download store boundaries: quota and capacity', () => {expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)})- it('Q4: Host file count at the limit is refused and one below is admitted', async () => {- const perCaller = GFS_FILE_LIMITS.callerRetainedFiles- let index = 400- for (let n = 0; n < GFS_HOST_RETAINED_FILES - 1; n += 1) {- const caller = `caller-${Math.floor(n / perCaller)}`- await completedCopy(store, callerDirectory(hostRoot, caller), caller, index, 1, {- owner: `task-${caller}`,- })- index += 1- }- expect((await store.debugInventory()).files).toBe(GFS_HOST_RETAINED_FILES - 1)- const denied = await quotaCount('host', 'retained_files')- const lastCaller = `caller-${Math.floor((GFS_HOST_RETAINED_FILES - 1) / perCaller)}`-- await completedCopy(store, callerDirectory(hostRoot, lastCaller), lastCaller, index, 1, {- owner: `task-${lastCaller}`,- })- expect(await quotaCount('host', 'retained_files')).toBe(denied)- expect((await store.debugInventory()).files).toBe(GFS_HOST_RETAINED_FILES)-- const fresh = 'caller-fresh'- await expect(- startTransfer(store, callerDirectory(hostRoot, fresh), fresh, index + 1, 1)- ).rejects.toMatchObject({ code: 'host_quota_exceeded' })- expect(await quotaCount('host', 'retained_files')).toBe(denied + 1)- // 64 real publications: the bound is the Host file limit, which is a- // constant, so the timeout is explicit rather than the 5 s default that a- // loaded machine can exceed.- }, 60_000)-it('Q5: free space exactly at the threshold is admitted and one byte less is refused', async () => {const observed = await nativeFs.statfs(hostRoot, { bigint: true })const size = 100@@ -411,7 +400,8 @@ describe('GFS download store boundaries: quota and capacity', () => {})it('Q9: Host eviction takes adopted copies before any published copy', async () => {- const limited = await limitedStore(HOST_30_CALLER_15)+ volumeOf(30)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)const published = await completedCopy(limited, rootB, B, 323, 10)tick()const rootC = callerDirectory(hostRoot, 'caller-c')@@ -420,7 +410,7 @@ describe('GFS download store boundaries: quota and capacity', () => {await completedCopy(limited, rootA, A, 325, 10)tick()- // caller-a stays within 15; the Host would reach 35 of 30.+ // The Host would reach 35 of 30.await startTransfer(limited, rootA, A, 326, 5)expect(exists(adopted.directory)).toBe(false)@@ -428,25 +418,27 @@ describe('GFS download store boundaries: quota and capacity', () => {expect(exists(downloadDirectory(rootB, published.receipt.id))).toBe(true)})- it('Q10: caller eviction takes adopted copies in its own directory before its published copies', async () => {- const limited = await limitedStore(HOST_30_CALLER_15)+ it("Q10: an admission evicts adopted copies in any caller's directory before its own published copies", async () => {+ volumeOf(15)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)const published = await completedCopy(limited, rootA, A, 327, 5)tick()const adopted = plantComplete(rootA, A, 328, Buffer.alloc(5, 0x37))const foreign = plantComplete(rootB, B, 329, Buffer.alloc(5, 0x38))tick()- // 5 + 5 + 10 against 15: one copy of caller-a's directory goes.+ // 5 + 5 + 5 + 10 against 15: both adopted copies go, whoever's directory holds them.await startTransfer(limited, rootA, A, 330, 10)expect(exists(adopted.directory)).toBe(false)+ expect(exists(foreign.directory)).toBe(false)+ // Witness: the published copy, older than both, stays.expect(exists(downloadDirectory(rootA, published.receipt.id))).toBe(true)- // Witness: a caller denial never reaches another directory's adopted copy.- expect(exists(foreign.directory)).toBe(true)})it('Q11: published copies are evicted least recently used first', async () => {- const limited = await limitedStore(HOST_30_CALLER_15)+ volumeOf(15)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)const older = await completedCopy(limited, rootA, A, 331, 5)tick()const newer = await completedCopy(limited, rootA, A, 332, 5)@@ -463,21 +455,22 @@ describe('GFS download store boundaries: quota and capacity', () => {})it('Q12: when every copy is pinned admission fails with the quota code and succeeds after release', async () => {- const limited = await limitedStore(HOST_30_CALLER_15)+ volumeOf(15)+ const limited = await limitedStore(SMALL_FILES_FULL_VOLUME)const pinned = await completedCopy(limited, rootA, A, 334, 10, { owner: 'task-q12' })const directory = downloadDirectory(rootA, pinned.receipt.id)- const denied = await quotaCount('caller', 'storage_bytes')+ const denied = await quotaCount('host', 'storage_bytes')await expect(startTransfer(limited, rootA, A, 335, 10)).rejects.toMatchObject({- code: 'caller_quota_exceeded',+ code: 'host_quota_exceeded',})- expect(await quotaCount('caller', 'storage_bytes')).toBe(denied + 1)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)expect(exists(directory)).toBe(true)await limited.releaseReceiptOwner('task-q12', A)await expect(startTransfer(limited, rootA, A, 335, 10)).resolves.toBeDefined()expect(exists(directory)).toBe(false)- expect(await quotaCount('caller', 'storage_bytes')).toBe(denied + 1)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)})})diff --git a/mcp-host/src/internalTools/gfsDownloadStoreBudget.test.ts b/mcp-host/src/internalTools/gfsDownloadStoreBudget.test.tsnew file mode 100644index 000000000..f19dc18fc--- /dev/null+++ b/mcp-host/src/internalTools/gfsDownloadStoreBudget.test.ts@@ -0,0 +1,355 @@+/**+ * The retained-storage budget of the GFS download store (#1028, Addendum 8):+ * `floor(volumeTotalBytes * percent / 100)`, with the volume measured by+ * statfs at every admission. There is no per-caller or file-count limit;+ * eviction order and the free-space check are unchanged. statfs is the only+ * boundary replaced: it reports the real free space and a chosen volume size.+ */+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { hash } from 'node:crypto'+import * as syncFs from 'node:fs'+import * as fs from 'node:fs/promises'+import { tmpdir } from 'node:os'+import * as path from 'node:path'+import {+ callerDirectory,+ completedCopy,+ downloadDirectory,+ exists,+ metaFor,+ plantDownload,+ quotaCount,+ sourceFor,+ startTransfer,+ withEnvironment,+} from '../__tests__/fixtures/gfsStoreTestKit'+import { logger } from '../logger'+import { GfsDownloadStore, GfsDownloadStoreError } from './gfsDownloadStore'+import { REMOVED_GFS_STORAGE_VARIABLES } from './gfsFilePolicy'++const { statfsBoundary } = vi.hoisted(() => ({ statfsBoundary: vi.fn() }))+vi.mock('node:fs/promises', async original => ({+ ...(await original<typeof fs>()),+ statfs: statfsBoundary,+}))++const A = 'caller-a'+const B = 'caller-b'+const MIB = 1024 * 1024+const REMOVED_VARIABLE_WARNING =+ 'GFS download store ignores a removed retained-storage variable; the budget is MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT of the workspace volume'++let nativeFs: typeof fs+let hostRoot: string+let rootA: string+let rootB: string+const stores: GfsDownloadStore[] = []++/** statfs as the volume reports it, but with `blocks * bsize` total bytes. */+function volumeOf(blocks: bigint, bsize = 1n): void {+ statfsBoundary.mockImplementation(async (target: string) => {+ const real = await nativeFs.statfs(target, { bigint: true })+ return { ...real, bsize, blocks, bavail: (real.bavail * real.bsize) / bsize }+ })+}++async function openStore(root = hostRoot): Promise<GfsDownloadStore> {+ const opened = new GfsDownloadStore(root)+ stores.push(opened)+ await opened.initialize()+ return opened+}++/** A store re-imported with environment limits applied. */+async function limitedStore(env: Record<string, string>, root = hostRoot) {+ return withEnvironment(env, async () => {+ vi.resetModules()+ const { GfsDownloadStore: Store } = await import('./gfsDownloadStore')+ const opened = new Store(root) as unknown as GfsDownloadStore+ stores.push(opened)+ await opened.initialize()+ return opened+ })+}++/** Distinct createdAt values so the eviction order is deterministic. */+function tick(): void {+ vi.setSystemTime(Date.now() + 1_000)+}++beforeEach(async () => {+ nativeFs = await vi.importActual<typeof fs>('node:fs/promises')+ vi.useFakeTimers({ toFake: ['Date'] })+ vi.setSystemTime(new Date('2026-10-08T10:00:00.000Z'))+ statfsBoundary.mockReset()+ statfsBoundary.mockImplementation(nativeFs.statfs)+ hostRoot = syncFs.mkdtempSync(path.join(tmpdir(), 'gfs-store-budget-'))+ rootA = callerDirectory(hostRoot, A)+ rootB = callerDirectory(hostRoot, B)+})++afterEach(async () => {+ vi.restoreAllMocks()+ vi.unstubAllEnvs()+ vi.useRealTimers()+ for (const opened of stores.splice(0)) await opened.close(0)+ await nativeFs.rm(hostRoot, { recursive: true, force: true })+})++describe('GFS download store budget: share of the workspace volume', () => {+ it('BUD-1: the default 85% budget admits exactly up to floor(total * 85 / 100) bytes', async () => {+ // 101 bytes of volume: 85.85 floors to 85.+ volumeOf(101n)+ const store = await openStore()+ await completedCopy(store, rootA, A, 1, 80, { owner: 'task-a' })+ const denied = await quotaCount('host', 'storage_bytes')++ const atBudget = await completedCopy(store, rootA, A, 2, 5, { owner: 'task-a' })+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied)+ await expect(store.readManagedFile(atBudget.receipt.path, A)).resolves.toEqual(atBudget.bytes)++ await expect(startTransfer(store, rootA, A, 3, 1)).rejects.toMatchObject({+ code: 'host_quota_exceeded',+ })+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)+ // Witness: the budget was sized from statfs at that admission.+ expect(statfsBoundary).toHaveBeenCalled()+ })++ it.each([+ { percent: '1', blocks: 1000n, budget: 10 },+ { percent: '100', blocks: 10n, budget: 10 },+ ])(+ 'BUD-2: percent $percent of a $blocks-byte volume admits $budget bytes and refuses one more',+ async ({ percent, blocks, budget }) => {+ volumeOf(blocks)+ const store = await limitedStore({ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: percent })+ const denied = await quotaCount('host', 'storage_bytes')++ await completedCopy(store, rootA, A, 10, budget, { owner: 'task-a' })+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied)+ await expect(startTransfer(store, rootB, B, 11, 1)).rejects.toMatchObject({+ code: 'host_quota_exceeded',+ })+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied + 1)+ }+ )++ it('BUD-3: a volume resized between two admissions is used by the second, without restart', async () => {+ volumeOf(20n)+ const store = await limitedStore({ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100' })+ await completedCopy(store, rootA, A, 20, 10, { owner: 'task-a' })++ await expect(startTransfer(store, rootB, B, 21, 15)).rejects.toMatchObject({+ code: 'host_quota_exceeded',+ })++ volumeOf(25n)+ statfsBoundary.mockClear()+ const admitted = await startTransfer(store, rootB, B, 21, 15)+ expect(admitted.transfer.sizeBytes).toBe(15)+ // Witness: the new size came from a statfs taken by this admission.+ expect(statfsBoundary).toHaveBeenCalled()+ })++ it('BUD-4: a large volume is sized in bigint without rounding', async () => {+ // 2^53 + 2 blocks of 4096 bytes is far beyond Number precision.+ volumeOf(2n ** 53n + 2n, 4096n)+ const store = await openStore()+ const admitted = await startTransfer(store, rootA, A, 30, 1024)+ expect(admitted.transfer.sizeBytes).toBe(1024)+ })++ it.each([+ { name: 'a zero block size', bsize: 0n, blocks: 1000n },+ { name: 'a zero block count', bsize: 1n, blocks: 0n },+ { name: 'a negative block count', bsize: 1n, blocks: -1n },+ ])('BUD-5: statfs reporting $name refuses with free_space', async ({ bsize, blocks }) => {+ const store = await openStore()+ const observed = await nativeFs.statfs(hostRoot, { bigint: true })+ statfsBoundary.mockResolvedValue({ ...observed, bsize, blocks })+ const denied = await quotaCount('host', 'free_space')++ await expect(startTransfer(store, rootA, A, 31, 4)).rejects.toMatchObject({+ code: 'host_quota_exceeded',+ })+ expect(await quotaCount('host', 'free_space')).toBe(denied + 1)++ // Witness: the real statfs admits the same request.+ statfsBoundary.mockImplementation(nativeFs.statfs)+ await expect(startTransfer(store, rootA, A, 31, 4)).resolves.toBeDefined()+ })+})++describe('GFS download store budget: no per-caller limit', () => {+ it('BUD-6: one caller fills the whole budget with 18 files of 16 MiB and another caller evicts its least recently used copy', async () => {+ const size = 16 * MIB+ const files = 18+ const zeros = hash('sha256', Buffer.alloc(size), 'hex')+ volumeOf(BigInt(files * size))+ const store = await limitedStore({ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100' })+ const ids: string[] = []+ for (let index = 0; index < files; index += 1) {+ const transfer = await store.createTransfer({+ callerIdentity: A,+ callerWorkspacePath: rootA,+ source: sourceFor(100 + index),+ sizeBytes: size,+ expiresAt: new Date(Date.now() + 60 * 60_000).toISOString(),+ })+ // A sparse partial: 16 MiB of zeros without writing them.+ syncFs.truncateSync(path.join(rootA, transfer.partialPath), size)+ ids.push((await store.publish(transfer.id, A, zeros)).id)+ tick()+ }+ // 288 MiB and 18 files: above the removed 256 MiB and 8-file caller limits.+ expect((await store.debugInventory()).byCaller.get(A)).toEqual({ files, bytes: files * size })++ const admitted = await store.createTransfer({+ callerIdentity: B,+ callerWorkspacePath: rootB,+ source: sourceFor(200),+ sizeBytes: size,+ expiresAt: new Date(Date.now() + 60 * 60_000).toISOString(),+ })++ expect(admitted.sizeBytes).toBe(size)+ expect(exists(downloadDirectory(rootA, ids[0]!))).toBe(false)+ // Witness: only the least recently used copy went.+ for (const id of ids.slice(1)) expect(exists(downloadDirectory(rootA, id))).toBe(true)+ expect((await store.debugInventory()).byCaller.get(A)?.files).toBe(files - 1)+ }, 60_000)++ it("BUD-7: another caller's admission never evicts a pinned copy and takes an adopted one first", async () => {+ volumeOf(30n)+ const store = await limitedStore({ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100' })+ const pinned = await completedCopy(store, rootA, A, 40, 10, { owner: 'task-a' })+ tick()+ const unpinned = await completedCopy(store, rootA, A, 41, 10)+ tick()+ const bytes = Buffer.alloc(10, 0x42)+ const plantedId = '00000000-0000-4000-8000-000000000042'+ const planted = plantDownload(rootA, {+ id: plantedId,+ bytes,+ meta: metaFor(plantedId, bytes, Date.now()),+ })+ tick()++ // 30 retained + 10 requested against 30: one copy goes, and it is the adopted one.+ await startTransfer(store, rootB, B, 42, 10)+ expect(exists(planted.directory)).toBe(false)+ expect(exists(downloadDirectory(rootA, unpinned.receipt.id))).toBe(true)+ expect(exists(downloadDirectory(rootA, pinned.receipt.id))).toBe(true)++ // Next: the unpinned published copy goes; the pinned one, older, never does.+ const second = await startTransfer(+ store,+ callerDirectory(hostRoot, 'caller-c'),+ 'caller-c',+ 43,+ 10+ )+ expect(second.transfer.sizeBytes).toBe(10)+ expect(exists(downloadDirectory(rootA, unpinned.receipt.id))).toBe(false)+ expect(exists(downloadDirectory(rootA, pinned.receipt.id))).toBe(true)+ })++ it('BUD-8: the quota denial is identical whoever fills the budget', async () => {+ const denialFor = async (fillOwnRoot: boolean) => {+ const host = syncFs.mkdtempSync(path.join(tmpdir(), 'gfs-store-budget-denial-'))+ try {+ const own = callerDirectory(host, A)+ const other = callerDirectory(host, `caller-${'b'.repeat(12)}`)+ const store = await openStore(host)+ const filler = fillOwnRoot ? own : other+ const fillerKey = path.basename(filler)+ await completedCopy(store, filler, fillerKey, 50, 80, { owner: 'task-fill' })+ const error = await startTransfer(store, own, A, 51, 10).then(+ () => undefined,+ (rejection: unknown) => rejection+ )+ // Witness: the refusal was the budget; releasing the pin admits the same request.+ await store.releaseReceiptOwner('task-fill', fillerKey)+ await expect(startTransfer(store, own, A, 51, 10)).resolves.toBeDefined()+ return error+ } finally {+ await nativeFs.rm(host, { recursive: true, force: true })+ }+ }+ // 100 bytes of volume, default 85%: 80 retained + 10 requested is over.+ volumeOf(100n)+ const ownFill = await denialFor(true)+ const foreignFill = await denialFor(false)++ expect(ownFill).toBeInstanceOf(GfsDownloadStoreError)+ expect(foreignFill).toBeInstanceOf(GfsDownloadStoreError)+ const shape = (error: unknown) => {+ const visible = error as Error & Record<string, unknown>+ return JSON.stringify({ ...visible, name: visible.name, message: visible.message })+ }+ expect(shape(foreignFill)).toBe(shape(ownFill))+ expect(shape(foreignFill)).toBe(+ JSON.stringify({+ code: 'host_quota_exceeded',+ name: 'GfsDownloadStoreError',+ message: 'GFS download store failed (host_quota_exceeded)',+ })+ )+ expect(shape(foreignFill)).not.toContain('caller-b')+ })+})++describe('GFS download store budget: removed variables', () => {+ function removedWarnings(warn: { mock: { calls: unknown[][] } }) {+ return warn.mock.calls.filter(call => call[1] === REMOVED_VARIABLE_WARNING)+ }++ it.each(REMOVED_GFS_STORAGE_VARIABLES)(+ 'BUD-9: %s still set is warned about once, by name and never by value',+ async variable => {+ for (const name of REMOVED_GFS_STORAGE_VARIABLES) vi.stubEnv(name, undefined)+ const value = 'secret-value-1073741824'+ vi.stubEnv(variable, value)+ const warn = vi.spyOn(logger, 'warn')++ const store = await openStore()++ expect(store.isAvailable()).toBe(true)+ const logged = removedWarnings(warn)+ expect(logged).toHaveLength(1)+ expect(logged[0]![0]).toEqual({ component: 'GfsDownloadStore', variable })+ expect(JSON.stringify(warn.mock.calls)).not.toContain(value)+ }+ )++ it('BUD-9b: every removed variable set at once gives one warning each', async () => {+ for (const name of REMOVED_GFS_STORAGE_VARIABLES) vi.stubEnv(name, '1')+ const warn = vi.spyOn(logger, 'warn')++ const store = await openStore()++ expect(store.isAvailable()).toBe(true)+ expect(+ removedWarnings(warn)+ .map(call => (call[0] as { variable: string }).variable)+ .sort()+ ).toEqual([...REMOVED_GFS_STORAGE_VARIABLES].sort())+ })++ it('BUD-10: with no removed variable set nothing is warned and the store initializes', async () => {+ for (const name of REMOVED_GFS_STORAGE_VARIABLES) vi.stubEnv(name, undefined)+ const warn = vi.spyOn(logger, 'warn')+ const info = vi.spyOn(logger, 'info')++ const store = await openStore()++ // Witness: initialization ran to its own log line.+ expect(info).toHaveBeenCalledWith(+ expect.objectContaining({ component: 'GfsDownloadStore' }),+ 'GFS download store initialized'+ )+ expect(store.isAvailable()).toBe(true)+ expect(removedWarnings(warn)).toHaveLength(0)+ })+})diff --git a/mcp-host/src/internalTools/gfsDownloadStoreProvenance.test.ts b/mcp-host/src/internalTools/gfsDownloadStoreProvenance.test.tsindex 0ba8bc06a..f622656e3 100644--- a/mcp-host/src/internalTools/gfsDownloadStoreProvenance.test.ts+++ b/mcp-host/src/internalTools/gfsDownloadStoreProvenance.test.ts@@ -29,12 +29,28 @@ import {import { logger } from '../logger'import { GfsDownloadStore } from './gfsDownloadStore'-const { hashBoundary } = vi.hoisted(() => ({ hashBoundary: vi.fn() }))+const { hashBoundary, volume } = vi.hoisted(() => ({+ hashBoundary: vi.fn(),+ volume: { totalBytes: undefined as bigint | undefined },+}))// Pass-through: the store hashes through createHash; the kit uses crypto.hash.vi.mock('node:crypto', async original => ({...(await original<typeof crypto>()),createHash: hashBoundary,}))+// statfs reports the real free space; a test that sets `volume.totalBytes`+// sizes the volume (block size 1), and with it the retained budget.+vi.mock('node:fs/promises', async original => {+ const actual = await original<typeof fs>()+ return {+ ...actual,+ statfs: async (target: string, options: { bigint: true }) => {+ const real = await actual.statfs(target, options)+ if (volume.totalBytes === undefined) return real+ return { ...real, bsize: 1n, blocks: volume.totalBytes, bavail: real.bavail * real.bsize }+ },+ }+})const A = 'caller-a'const B = 'caller-b'@@ -103,6 +119,7 @@ beforeEach(async () => {vi.setSystemTime(new Date('2026-10-08T10:00:00.000Z'))hashBoundary.mockReset()hashBoundary.mockImplementation((algorithm: string) => nativeCrypto.createHash(algorithm))+ volume.totalBytes = undefinedhostRoot = syncFs.mkdtempSync(path.join(tmpdir(), 'gfs-store-provenance-'))rootA = callerDirectory(hostRoot, A)rootB = callerDirectory(hostRoot, B)@@ -176,14 +193,14 @@ describe('GFS download store provenance: planted copies', () => {await expect(store.readManagedFile(published.receipt.path, B)).resolves.toEqual(published.bytes)})- it('T-S4: a planted entry is charged to the directory that contains it', async () => {+ it('T-S4: a planted entry is inventoried under the directory that contains it and evicted first', async () => {const bytes = Buffer.alloc(10, 0x43)const planted = plantComplete(rootB, C, 9, bytes)+ volume.totalBytes = 20nconst limited = await withEnvironment({MCP_HOST_GFS_MAX_FILE_BYTES: '10',- MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES: '30',- MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES: '15',+ MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT: '100',},async () => {vi.resetModules()@@ -197,17 +214,17 @@ describe('GFS download store provenance: planted copies', () => {const inventory = await limited.debugInventory()expect(inventory.byCaller.get(B)).toEqual({ files: 1, bytes: 10 })expect(inventory.byCaller.has(C)).toBe(false)- const callerDenied = await quotaCount('caller', 'storage_bytes')+ const denied = await quotaCount('host', 'storage_bytes')- // C's directory holds nothing, so C's full budget is free and nothing is evicted.+ // 10 planted + 10 requested fit the budget of 20, so nothing is evicted.const rootC = callerDirectory(hostRoot, C)await startTransfer(limited, rootC, C, 10, 10)expect(exists(planted.directory)).toBe(true)- // B's directory holds the plant: B's admission evicts it to fit 10 + 10 into 15.+ // 10 + 10 + 10 does not: the plant goes, the active reservation stays.await startTransfer(limited, rootB, B, 11, 10)expect(exists(planted.directory)).toBe(false)- expect(await quotaCount('caller', 'storage_bytes')).toBe(callerDenied)+ expect(await quotaCount('host', 'storage_bytes')).toBe(denied)})it('T-R1: a restart keeps the copy for accounting and cleanup but does not reuse it', async () => {diff --git a/mcp-host/src/internalTools/gfsFilePolicy.test.ts b/mcp-host/src/internalTools/gfsFilePolicy.test.tsindex 0d03ad1c7..e2edfcde7 100644--- a/mcp-host/src/internalTools/gfsFilePolicy.test.ts+++ b/mcp-host/src/internalTools/gfsFilePolicy.test.ts@@ -11,9 +11,7 @@ describe('GFS file policy', () => {it('uses independent defaults for source transfer, text, retention and quotas', async () => {for (const name of ['MCP_HOST_GFS_MAX_FILE_BYTES',- 'MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES',- 'MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES',- 'MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES',+ 'MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT','MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY','MCP_HOST_GFS_DOWNLOAD_TTL_HOURS',]) {@@ -28,9 +26,7 @@ describe('GFS file policy', () => {inlineTextBytes: 8192,metadataBytes: 64 * 1024,errorBytes: 8 * 1024,- storageBytes: 1024 * 1024 * 1024,- callerStorageBytes: 256 * 1024 * 1024,- callerRetainedFiles: 8,+ storagePercent: 85,callerActiveDownloads: 1,retentionMs: 7 * 24 * 60 * 60 * 1000,})@@ -62,37 +58,51 @@ describe('GFS file policy', () => {expect(() => configuredGfsInteger('limit', raw, 16, 200)).toThrow()})- it('enforces source, caller, aggregate and concurrency relationships', async () => {- expect(configuredGfsInteger('limit', '200', 16, 200)).toBe(200)- expect(() => configuredGfsInteger('limit', '201', 16, 200)).toThrow()+ it.each(['1', '85', '100'])('accepts a storage percent of %s', async raw => {+ vi.stubEnv('MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT', raw)+ vi.resetModules()- vi.stubEnv('MCP_HOST_GFS_MAX_FILE_BYTES', String(17 * 1024 * 1024))- vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES', String(16 * 1024 * 1024))+ const { GFS_FILE_LIMITS } = await import('./gfsFilePolicy')++ expect(GFS_FILE_LIMITS.storagePercent).toBe(Number(raw))+ })++ it.each(['0', '101', '85.5', '', '-1'])('refuses storage percent %j at startup', async raw => {+ vi.stubEnv('MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT', raw)vi.resetModules()- await expect(import('./gfsFilePolicy')).rejects.toThrow(- 'must fit within the caller retained-storage budget'- )- vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES', String(1024 * 1024 * 1024 + 1))+ await expect(import('./gfsFilePolicy')).rejects.toThrow('MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT')+ })++ it('enforces the protocol ceilings of the remaining integer limits', async () => {+ expect(configuredGfsInteger('limit', '200', 16, 200)).toBe(200)+ expect(() => configuredGfsInteger('limit', '201', 16, 200)).toThrow()++ vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY', '3')vi.resetModules()- await expect(import('./gfsFilePolicy')).rejects.toThrow(- 'must not exceed the Host aggregate retained-storage budget'- )+ await expect(import('./gfsFilePolicy')).rejects.toThrow('must be no greater than 2')- vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES', String(512 * 1024 * 1024 + 1))+ // Witness: the same module loads once the value is within its ceiling.+ vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY', '2')vi.resetModules()- await expect(import('./gfsFilePolicy')).rejects.toThrow(- 'must leave aggregate storage for another caller'- )+ await expect(import('./gfsFilePolicy')).resolves.toBeDefined()+ })- vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES', undefined)+ it('removed retained-storage variables no longer shape the policy', async () => {+ vi.stubEnv('MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES', '1')+ vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES', 'not-a-number')vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES', '65')+ vi.stubEnv('MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT', undefined)vi.resetModules()- await expect(import('./gfsFilePolicy')).rejects.toThrow('must be no greater than 64')- vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES', undefined)- vi.stubEnv('MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY', '3')- vi.resetModules()- await expect(import('./gfsFilePolicy')).rejects.toThrow('must be no greater than 2')+ const policy = await import('./gfsFilePolicy')++ expect(policy.GFS_FILE_LIMITS.storagePercent).toBe(85)+ expect(Object.keys(policy.GFS_FILE_LIMITS)).not.toContain('storageBytes')+ expect(policy.REMOVED_GFS_STORAGE_VARIABLES).toEqual([+ 'MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES',+ 'MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES',+ 'MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES',+ ])})})diff --git a/mcp-host/src/internalTools/gfsFilePolicy.ts b/mcp-host/src/internalTools/gfsFilePolicy.tsindex afd4a97f3..977e48f15 100644--- a/mcp-host/src/internalTools/gfsFilePolicy.ts+++ b/mcp-host/src/internalTools/gfsFilePolicy.ts@@ -1,8 +1,18 @@const MIB = 1024 * 1024-export const GFS_HOST_RETAINED_FILES = 64export const GFS_HOST_ACTIVE_DOWNLOADS = 2+/**+ * Retained-storage variables of the fixed quota model, removed in #1028 when+ * the budget became a share of the workspace volume. A deployment that still+ * sets one is warned about at store startup, never failed.+ */+export const REMOVED_GFS_STORAGE_VARIABLES = Object.freeze([+ 'MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES',+ 'MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES',+ 'MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES',+] as const)+export function configuredGfsInteger(name: string,raw: string | undefined,@@ -17,10 +27,6 @@ export function configuredGfsInteger(return value}-function requiredGfsInteger(name: string, raw: string | undefined, fallback: number): number {- return configuredGfsInteger(name, raw, fallback, Number.MAX_SAFE_INTEGER)-}-/** Generic GFS transfer policy, independent of visual model delivery. */export const GFS_FILE_LIMITS = Object.freeze({maxFileBytes: configuredGfsInteger(@@ -32,21 +38,16 @@ export const GFS_FILE_LIMITS = Object.freeze({inlineTextBytes: 8 * 1024,metadataBytes: 64 * 1024,errorBytes: 8 * 1024,- storageBytes: requiredGfsInteger(- 'MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES',- process.env.MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES,- 1024 * MIB- ),- callerStorageBytes: requiredGfsInteger(- 'MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES',- process.env.MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES,- 256 * MIB- ),- callerRetainedFiles: configuredGfsInteger(- 'MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES',- process.env.MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES,- 8,- GFS_HOST_RETAINED_FILES+ /**+ * Share of the volume holding the Host root that retained downloads may+ * occupy: `floor(volumeTotalBytes * storagePercent / 100)`, measured with+ * statfs at every admission.+ */+ storagePercent: configuredGfsInteger(+ 'MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT',+ process.env.MCP_HOST_GFS_DOWNLOAD_STORAGE_PERCENT,+ 85,+ 100),callerActiveDownloads: configuredGfsInteger('MCP_HOST_GFS_CALLER_DOWNLOAD_CONCURRENCY',@@ -65,16 +66,3 @@ export const GFS_FILE_LIMITS = Object.freeze({60 *1000,})--if (GFS_FILE_LIMITS.maxFileBytes > GFS_FILE_LIMITS.callerStorageBytes)- throw new Error('MCP_HOST_GFS_MAX_FILE_BYTES must fit within the caller retained-storage budget')--if (GFS_FILE_LIMITS.callerStorageBytes > GFS_FILE_LIMITS.storageBytes)- throw new Error(- 'MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES must not exceed the Host aggregate retained-storage budget'- )--if (GFS_FILE_LIMITS.callerStorageBytes * 2 > GFS_FILE_LIMITS.storageBytes)- throw new Error(- 'MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES must leave aggregate storage for another caller'- )diff --git a/mcp-host/src/internalTools/gfsManagedImage.test.ts b/mcp-host/src/internalTools/gfsManagedImage.test.tsindex 19a6ee332..1ffff8ee1 100644--- a/mcp-host/src/internalTools/gfsManagedImage.test.ts+++ b/mcp-host/src/internalTools/gfsManagedImage.test.ts@@ -344,7 +344,6 @@ describe('GFS managed image projection', () => {describe('GFS download store errors at the tool boundary', () => {const codes: GfsDownloadStoreErrorCode[] = ['caller_mismatch',- 'caller_quota_exceeded','download_busy','download_expired','download_missing',diff --git a/scripts/ci/pinned-vitest-cases/mcp-host.json b/scripts/ci/pinned-vitest-cases/mcp-host.jsonindex a6da54fce..357a97348 100644--- a/scripts/ci/pinned-vitest-cases/mcp-host.json+++ b/scripts/ci/pinned-vitest-cases/mcp-host.json@@ -159,10 +159,6 @@"suite": "gfsDownloadStore.test.ts","fullName": "GFS download store: reuse F6: reuse deletes a directory whose content no longer matches and returns undefined"},- {- "suite": "gfsDownloadStore.test.ts",- "fullName": "GFS download store: quotas and eviction F8: a caller over quota evicts its own oldest completed downloads, never another caller's"- },{"suite": "gfsDownloadStore.test.ts","fullName": "GFS download store: quotas and eviction F10: when eviction cannot make room nothing is deleted"@@ -241,20 +237,16 @@},{"suite": "gfsDownloadStoreBoundaries.test.ts",- "fullName": "GFS download store boundaries: quota and capacity Q1: caller bytes exactly at the budget are admitted and one byte more is refused"+ "fullName": "GFS download store boundaries: quota and capacity Q1: retained bytes exactly at the volume budget are admitted and one byte more is refused"},{"suite": "gfsDownloadStoreBoundaries.test.ts",- "fullName": "GFS download store boundaries: quota and capacity Q2: caller file count at the limit is refused and one below is admitted"+ "fullName": "GFS download store boundaries: quota and capacity Q2: there is no retained-file limit: one caller keeps 65 copies and only bytes refuse"},{"suite": "gfsDownloadStoreBoundaries.test.ts","fullName": "GFS download store boundaries: quota and capacity Q3: Host bytes exactly at the budget are admitted and one byte more is refused"},- {- "suite": "gfsDownloadStoreBoundaries.test.ts",- "fullName": "GFS download store boundaries: quota and capacity Q4: Host file count at the limit is refused and one below is admitted"- },{"suite": "gfsDownloadStoreBoundaries.test.ts","fullName": "GFS download store boundaries: quota and capacity Q5: free space exactly at the threshold is admitted and one byte less is refused"@@ -273,7 +265,7 @@},{"suite": "gfsDownloadStoreBoundaries.test.ts",- "fullName": "GFS download store boundaries: quota and capacity Q10: caller eviction takes adopted copies in its own directory before its published copies"+ "fullName": "GFS download store boundaries: quota and capacity Q10: an admission evicts adopted copies in any caller's directory before its own published copies"},{"suite": "gfsDownloadStoreBoundaries.test.ts",@@ -353,7 +345,7 @@},{"suite": "gfsDownloadStoreProvenance.test.ts",- "fullName": "GFS download store provenance: planted copies T-S4: a planted entry is charged to the directory that contains it"+ "fullName": "GFS download store provenance: planted copies T-S4: a planted entry is inventoried under the directory that contains it and evicted first"},{"suite": "gfsDownloadStoreProvenance.test.ts",@@ -403,10 +395,6 @@"suite": "gfsManagedImage.test.ts","fullName": "GFS download store errors at the tool boundary surfaces store code caller_mismatch to the model"},- {- "suite": "gfsManagedImage.test.ts",- "fullName": "GFS download store errors at the tool boundary surfaces store code caller_quota_exceeded to the model"- },{"suite": "gfsManagedImage.test.ts","fullName": "GFS download store errors at the tool boundary surfaces store code download_busy to the model"@@ -439,10 +427,6 @@"suite": "gfsManagedImage.test.ts","fullName": "GFS download store errors at the tool boundary surfaces download admission code caller_mismatch to the model"},- {- "suite": "gfsManagedImage.test.ts",- "fullName": "GFS download store errors at the tool boundary surfaces download admission code caller_quota_exceeded to the model"- },{"suite": "gfsManagedImage.test.ts","fullName": "GFS download store errors at the tool boundary surfaces download admission code download_busy to the model"@@ -781,14 +765,114 @@},{"suite": "gfsDownloadStoreAdversarial.test.ts",- "fullName": "GFS download store adversarial round: a failed duplicate removal stays charged duplicates of a full caller’s ids whose removal fails keep both callers charged"+ "fullName": "GFS download store adversarial round: a failed duplicate removal stays charged duplicates of another caller’s ids whose removal fails stay charged against the Host budget"},{"suite": "gfsDownloadStoreAdversarial.test.ts",- "fullName": "GFS download store adversarial round: a failed duplicate removal stays charged a duplicate of a published copy whose removal fails stays charged to its caller"+ "fullName": "GFS download store adversarial round: a failed duplicate removal stays charged a duplicate of a published copy whose removal fails stays charged"},{"suite": "gfsDownloadStoreNonBlocking.test.ts","fullName": "GFS download store: a FIFO in the store tree never blocks a meta.json FIFO with a writer attached is judged by its type, not read"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-1: the default 85% budget admits exactly up to floor(total * 85 / 100) bytes"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-2: percent '1' of a 1000n-byte volume admits 10 bytes and refuses one more"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-2: percent '100' of a 10n-byte volume admits 10 bytes and refuses one more"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-3: a volume resized between two admissions is used by the second, without restart"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-4: a large volume is sized in bigint without rounding"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-5: statfs reporting 'a zero block size' refuses with free_space"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-5: statfs reporting 'a zero block count' refuses with free_space"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: share of the workspace volume BUD-5: statfs reporting 'a negative block count' refuses with free_space"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: no per-caller limit BUD-6: one caller fills the whole budget with 18 files of 16 MiB and another caller evicts its least recently used copy"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: no per-caller limit BUD-7: another caller's admission never evicts a pinned copy and takes an adopted one first"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: no per-caller limit BUD-8: the quota denial is identical whoever fills the budget"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: removed variables BUD-9: MCP_HOST_GFS_DOWNLOAD_STORAGE_BYTES still set is warned about once, by name and never by value"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: removed variables BUD-9: MCP_HOST_GFS_CALLER_DOWNLOAD_STORAGE_BYTES still set is warned about once, by name and never by value"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: removed variables BUD-9: MCP_HOST_GFS_CALLER_DOWNLOAD_MAX_FILES still set is warned about once, by name and never by value"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: removed variables BUD-9b: every removed variable set at once gives one warning each"+ },+ {+ "suite": "gfsDownloadStoreBudget.test.ts",+ "fullName": "GFS download store budget: removed variables BUD-10: with no removed variable set nothing is warned and the store initializes"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy accepts a storage percent of 1"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy accepts a storage percent of 85"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy accepts a storage percent of 100"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy refuses storage percent \"0\" at startup"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy refuses storage percent \"101\" at startup"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy refuses storage percent \"85.5\" at startup"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy refuses storage percent \"\" at startup"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy refuses storage percent \"-1\" at startup"+ },+ {+ "suite": "gfsFilePolicy.test.ts",+ "fullName": "GFS file policy removed retained-storage variables no longer shape the policy"}]