Skip to content

Add configurable /tmp tmpfs size with ByteSize type#46

Merged
JAORMX merged 3 commits intomainfrom
feat/configurable-tmp-size
Mar 16, 2026
Merged

Add configurable /tmp tmpfs size with ByteSize type#46
JAORMX merged 3 commits intomainfrom
feat/configurable-tmp-size

Conversation

@JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Mar 16, 2026

Summary

  • Wire propolis WithTmpSize through all brood-box layers so users can configure guest /tmp tmpfs size
  • Introduce ByteSize type in config domain that accepts human-readable sizes ("512m", "2g") and bare integers (MiB) in YAML
  • Guest init reads /etc/propolis-vm.json written by the host to apply the configured size at boot

Config example

defaults:
  tmp_size: "2g"       # 2 GiB for all agents
agents:
  claude-code:
    tmp_size: "4g"     # 4 GiB for this agent

Bare integers remain backward compatible (tmp_size: 512 = 512 MiB).

Changes

  • pkg/domain/config/bytesize.go: ByteSize type with ParseByteSize, encoding.TextUnmarshaler/TextMarshaler (no yaml.v3 import in domain layer)
  • pkg/domain/config/config.go: DefaultsConfig.TmpSize and AgentOverride.TmpSizeByteSize; split clamping; Merge() converts to uint32 at agent boundary
  • pkg/domain/agent/agent.go: DefaultTmpSize uint32 field
  • pkg/domain/vm/vm.go: TmpSizeMiB uint32 in VMConfig
  • pkg/sandbox/sandbox.go: Wires TmpSizeMiB through RunOpts → override → VMConfig
  • internal/infra/vm/runner.go: Passes TmpSizeMiB to propolis.WithTmpSize
  • cmd/bbox-init/main.go: Reads vmconfig, passes to boot.WithTmpSize

Dependencies

Test plan

  • task test passes
  • Remove replace directive after propolis release and verify

🤖 Generated with Claude Code

@JAORMX JAORMX force-pushed the feat/configurable-tmp-size branch from f6bf39a to 0f2e062 Compare March 16, 2026 14:22
Wire propolis WithTmpSize through all layers so users can configure
the guest /tmp tmpfs size. Introduces a ByteSize type in the config
domain that accepts "512m", "2g", or bare integers (MiB) in YAML.

- New ByteSize type with encoding.TextUnmarshaler for yaml.v3
- DefaultsConfig and AgentOverride use ByteSize for tmp_size
- bbox-init reads vmconfig and passes TmpSize to guest boot
- VMConfig, RunOpts, and PropolisRunner pass TmpSizeMiB through

Depends on stacklok/go-microvm#44 (go.mod replace is temporary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
@JAORMX JAORMX force-pushed the feat/configurable-tmp-size branch from 0f2e062 to eb47c67 Compare March 16, 2026 14:23
Also pin gvisor.dev/gvisor to the version propolis v0.0.21
actually requires, fixing a broken templated assembly file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX JAORMX marked this pull request as ready for review March 16, 2026 14:29
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

Nice, clean feature addition — follows the existing CPUs/Memory patterns well and respects DDD boundaries. A few questions and a small correctness nit below.

- Fix uint64 overflow in ByteSize GiB parsing (silent wraparound)
- Make workspace-local TmpSize tighten-only (cannot inflate beyond global)
- Add explicit vmconfig fallback in bbox-init for future-proofing
- Add --tmp-size CLI flag (parity with --cpus and --memory)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX JAORMX enabled auto-merge (squash) March 16, 2026 17:12
@JAORMX JAORMX merged commit 824adae into main Mar 16, 2026
7 checks passed
@JAORMX JAORMX deleted the feat/configurable-tmp-size branch March 16, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants