Skip to content

fix: control buildkit cache exports#2399

Closed
simonrosenberg wants to merge 3 commits intomainfrom
fix/prebuilt-sdist-api
Closed

fix: control buildkit cache exports#2399
simonrosenberg wants to merge 3 commits intomainfrom
fix/prebuilt-sdist-api

Conversation

@simonrosenberg
Copy link
Copy Markdown
Collaborator

@simonrosenberg simonrosenberg commented Mar 12, 2026

Summary

  • disable shared registry cache-to export by default while keeping shared cache-from
  • add OPENHANDS_BUILDKIT_CACHE_MODE=off|min|max so callers can disable or reduce cache-to exports
  • add tests covering shared cache tag scoping, default non-export behavior, opt-in shared export, and fully disabled cache export

Scope

The prebuilt SDK sdist feature from this branch already merged separately in #2426, so this PR now carries only the remaining BuildKit cache export controls.

Behavior change

  • shared registry cache export is opt-in via OPENHANDS_SHARED_REGISTRY_CACHE_EXPORT=1
  • OPENHANDS_BUILDKIT_CACHE_MODE=max|min|off controls all cache-to exports
    • max keeps full cache export behavior
    • min exports a smaller cache
    • off disables all cache-to exports while preserving cache-from

Validation

  • uv run pytest tests/agent_server/test_docker_build.py
  • uv run pre-commit run --files openhands-agent-server/openhands/agent_server/docker/build.py tests/agent_server/test_docker_build.py

Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:9c0379f-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-9c0379f-python \
  ghcr.io/openhands/agent-server:9c0379f-python

All tags pushed for this build

ghcr.io/openhands/agent-server:9c0379f-golang-amd64
ghcr.io/openhands/agent-server:9c0379f-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:9c0379f-golang-arm64
ghcr.io/openhands/agent-server:9c0379f-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:9c0379f-java-amd64
ghcr.io/openhands/agent-server:9c0379f-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:9c0379f-java-arm64
ghcr.io/openhands/agent-server:9c0379f-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:9c0379f-python-amd64
ghcr.io/openhands/agent-server:9c0379f-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-amd64
ghcr.io/openhands/agent-server:9c0379f-python-arm64
ghcr.io/openhands/agent-server:9c0379f-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-arm64
ghcr.io/openhands/agent-server:9c0379f-golang
ghcr.io/openhands/agent-server:9c0379f-java
ghcr.io/openhands/agent-server:9c0379f-python

About Multi-Architecture Support

  • Each variant tag (e.g., 9c0379f-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 9c0379f-python-amd64) are also available if needed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

API breakage checks (Griffe)

Result: Passed

Action log

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

Agent server REST API breakage checks (OpenAPI)

Result: Failed

Log excerpt (first 1000 characters)
::error title=openhands-agent-server REST API::Breaking REST API change detected without MINOR version bump (1.14.0 -> 1.14.0).

Breaking REST API changes detected compared to baseline release:
- added '#/components/schemas/ACPAgent-Output, #/components/schemas/Agent-Output' to the '/items/anyOf[subschema #1: ConversationInfo]/agent' response property 'oneOf' list for the response status '200'
- the '/items/anyOf[subschema #1: ConversationInfo]/agent' response's property type/format changed from 'object'/'' to ''/'' for status '200'
- removed the required property '/items/anyOf[subschema #1: ConversationInfo]/agent/kind' from the response with the '200' status
- removed the required property '/items/anyOf[subschema #1: ConversationInfo]/agent/llm' from the response with the '200' status
- the 'agent' request property type/format changed from 'object'/'' to ''/''
- added '#/components/schemas/ACPAgent-Output, #/components/schemas/Agent-Output' to the 'agent' response property 'oneOf' li

Action log

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-agent-server/openhands/agent_server/docker
   build.py53315970%73, 76–77, 91, 96, 100–102, 106, 111, 128–133, 136, 159, 161, 169, 171–172, 174–178, 180, 184, 187, 190–193, 195–197, 199, 201, 203, 205, 295–296, 300–301, 305–306, 310–311, 324, 326–334, 407, 509, 523, 526, 530–531, 535–536, 540, 556–558, 561, 567–570, 580, 595, 613, 618, 625, 629, 649, 652, 679, 698–699, 703–705, 750, 849, 859–860, 931–932, 937, 940, 947, 952, 957, 963, 968, 975–976, 981, 986, 992, 998, 1003, 1012, 1015–1021, 1024–1026, 1029, 1043–1048, 1050–1051, 1053–1055, 1058–1059, 1063–1066, 1068, 1077, 1089, 1092, 1108–1113, 1115–1116, 1118–1122, 1124, 1131, 1135
TOTAL20321913055% 

Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

🟢 Good taste - Clean, pragmatic solution solving a real performance problem. No over-engineering, just straightforward implementation: optional parameter, conditional build skip, proper cleanup. Backward compatible, well-tested. This is how code should be written. LGTM! 🚀

Co-authored-by: openhands <openhands@all-hands.dev>
@simonrosenberg simonrosenberg force-pushed the fix/prebuilt-sdist-api branch from e1753d6 to ed53ab2 Compare March 13, 2026 21:08
@simonrosenberg simonrosenberg changed the title feat: support reusing prebuilt SDK sdists fix: control buildkit cache exports Mar 13, 2026
@all-hands-bot
Copy link
Copy Markdown
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @simonrosenberg, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

2 similar comments
@all-hands-bot
Copy link
Copy Markdown
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @simonrosenberg, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

@all-hands-bot
Copy link
Copy Markdown
Collaborator

[Automatic Post]: It has been a while since there was any activity on this PR. @simonrosenberg, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up.

@xingyaoww
Copy link
Copy Markdown
Collaborator

@OpenHands can you fix merge conflict?

@simonrosenberg is this still needed?

@openhands-ai
Copy link
Copy Markdown

openhands-ai bot commented Mar 30, 2026

I'm on it! xingyaoww can track my progress at all-hands.dev

@simonrosenberg
Copy link
Copy Markdown
Collaborator Author

Not needed anymore.

@openhands-ai
Copy link
Copy Markdown

openhands-ai bot commented Mar 30, 2026

Summary

The merge conflict in PR #2399 has been resolved and pushed.

What was done:

  1. Merged main into fix/prebuilt-sdist-api — two files had conflicts:

    • openhands-agent-server/openhands/agent_server/docker/build.py
    • tests/agent_server/test_docker_build.py
  2. Resolved conflicts by taking main's version — this was the correct approach because main already incorporates the OPENHANDS_BUILDKIT_CACHE_MODE feature (the core of this PR) with a simpler implementation. The PR's additional shared cache features (OPENHANDS_SHARED_REGISTRY_CACHE_EXPORT, _scoped_cache_tags, shared_cache_tags) had been superseded by main's streamlined approach.

  3. Verified the resolution — all 35 tests in test_docker_build.py pass, and all pre-commit hooks pass (ruff, pycodestyle, pyright).

  4. Pushed to the PR branch — commit ea779d19 on fix/prebuilt-sdist-api.

Important note:

With this merge resolution, the PR now carries no meaningful diff against main. The cache export control features this PR originally introduced have already been incorporated into main through other work. This confirms the reviewer's suspicion — this PR can likely be closed as its changes are already in main.

Conciseness:

The changes are minimal — a single merge commit with no extraneous modifications. No new code was added beyond what was needed to resolve the conflict.

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.

3 participants