Skip to content

fix: compact deep Docker skill snapshots - #5879

Open
xixi-box wants to merge 1 commit into
Tencent:mainfrom
xixi-box:fix/issue-5870-032c67f-3161a498
Open

xixi-box wants to merge 1 commit into
Tencent:mainfrom
xixi-box:fix/issue-5870-032c67f-3161a498

Conversation

@xixi-box

Copy link
Copy Markdown
Contributor

Fixes #5870

Description

Every Docker skill snapshot adds a layer to the image used by the previous generation. On overlay2, this can eventually make skill installs, updates, and removals fail with max depth exceeded.

When the parent image reaches 96 filesystem layers, save the maintenance container's merged filesystem as a single-layer image. Preserve the image configuration, local skill tag, and labels used for discovery and cleanup. Existing deep snapshots can compact the next time they are used for skill maintenance. The adapter uses incremental commits for shallow skill snapshots and session forks. Compaction temporarily needs disk space on the WeKnora host for the exported filesystem.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

Fixes #5870

Testing

Tests: /bin/sh -c 'DOCKER_INTEGRATION_DEEP_IMAGE=weknora-oss-scout-deep:local go test -tags=docker_integration ./internal/sandbox -run '"'"'^TestDockerSkillSnapshotCompactsDeepImageIntegration$'"'"' -count=1 -v'.
Result: go test ./internal/sandbox -count=1 exited 0 on the original sources (16.928s).
Result: DOCKER_INTEGRATION_DEEP_IMAGE=weknora-oss-scout-deep:local go test -tags=docker_integration ./internal/sandbox -run '^TestDockerSkillSnapshotCompactsDeepImageIntegration$' -count=1 -v exited 1 on base with 126 layers and 0 with the fix (3.566s for the patched package run).
Result: DOCKER_INTEGRATION_HOST=unix:///tmp/weknora-oss-docker.kNrLiI/docker.sock DOCKER_INTEGRATION_DEEP_IMAGE=weknora-oss-scout-deep:local go test -tags=docker_integration ./internal/sandbox -run '^TestDockerSkillSnapshotCompactsDeepImageIntegration$' -count=1 -v exited 1 on base with max depth exceeded and 0 with the fix (2.624s for the patched package run).
Result: go build ./internal/sandbox exited 0.
Result: go test -race -tags sqlite_fts5 ./internal/sandbox/... -count=1 exited 0 for sandbox, admission, allocation and workspace.
Result: go test -tags sqlite_fts5 ./internal/application/service -run 'Test.*(Skill|Snapshot|Maintenance|RunInstall|RunRemove|Reinstall)' -count=1 exited 0 (2.995s).
Result: go vet -tags 'sqlite_fts5,docker_integration' ./internal/sandbox/... exited 0.
Result: /tmp/weknora-oss-lint.wdvCrZ/golangci-lint run --build-tags=sqlite_fts5,docker_integration --new-from-patch=/tmp/weknora-oss-review.9YIiUn/sandbox.patch ./internal/sandbox/... exited 0 and reported 0 issues.
Regression coverage: internal/sandbox/docker_integration_test.go.

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable (for Go: golangci-lint run --new-from-rev=origin/main ./...)
  • Full-repository checks were run, or any unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation (README, website-docs/, Swagger annotations, etc.)
  • Breaking changes are clearly called out in the description above

Screenshots / Recordings

Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

[Bug]: Docker 沙箱技能快照层数持续累积,最终触发 max depth exceeded,导致 Skill 无法安装、更新和卸载

1 participant