Repository navigation
refactor(builder-sidecar): ephemeral builder containers launched from host - #162
Merged
Merged
Conversation
azchin
commented
Apr 1, 2026
| repo_hash = self.__get_repo_hash() | ||
| return f"{self.name}:{repo_hash}-{sanitizer}-snapshot" | ||
|
|
||
| def _snapshot_lock_path(self, snapshot_tag: str) -> Path: |
Collaborator
Author
There was a problem hiding this comment.
Do we need to restore this locking logic?
| cached_hash = cache_file.read_text().strip() | ||
| return cached_hash == base_image_hash and self._snapshot_exists(snapshot_tag) | ||
|
|
||
| def create_snapshot( |
Collaborator
Author
There was a problem hiding this comment.
In general, seems odd we're completely removing snapshot logic from this module.
azchin
commented
Apr 3, 2026
Collaborator
Author
There was a problem hiding this comment.
@acorn421 Can you check out these verify-patch-* scripts and make something similar using CRSBench for E2E testing?
…s context conflict) Signed-off-by: Dongkwan Kim <0xdkay@gmail.com>
…source Signed-off-by: Dongkwan Kim <0xdkay@gmail.com>
azchin
commented
Apr 3, 2026
Collaborator
Author
There was a problem hiding this comment.
@acorn421 Testing logic here for rebuild sidecar
Builder-sidecar: FastAPI server that spawns ephemeral Docker containers for builds and tests via Docker socket. Extracts build CMD from image via docker inspect, disables REPLAY_ENABLED, uses oss_crs_handler.sh for both build (image CMD) and test (test.sh). Runner-sidecar: FastAPI server on base-runner for POV reproduction via OSS-Fuzz reproduce script. Simplify oss_crs_handler.sh to: git apply + run $OSS_CRS_BUILD_CMD. Signed-off-by: Andrew Chin <achin34@gatech.edu>
…-test - apply-patch-build: submit patch to builder-sidecar, poll for result - apply-patch-test: renamed from run-test, takes patch_path explicitly - run-pov: submit POV to runner-sidecar - download-build-output: fetch versioned artifacts as zip - Remove _last_patch_path stateful hack (broken across CLI invocations) Signed-off-by: Andrew Chin <achin34@gatech.edu>
…builder - Sidecar injection triggered by any CRS with snapshot builds - Remove _builder_crs property and "at most one builder" restriction - Remove is_builder gates from LLM, bug-finding, and compose template - Fix BASE_IMAGE to use snapshot image instead of raw target - Add get_rebuild_out_dir to workdir for sidecar artifact storage Signed-off-by: Andrew Chin <achin34@gatech.edu>
- Unit tests for builder-sidecar, runner-sidecar, and libCRS sidecar methods - Integration tests for sidecar lifecycle - sandbox/crs-sidecar-test: manual e2e test CRS with ground-truth patch - Remove old builder/ directory (replaced by builder-sidecar) Signed-off-by: Andrew Chin <achin34@gatech.edu>
…g properties - Remove snapshot: bool from BuildConfig - Remove run_snapshot: bool from CRSRunPhaseModule - Update validate_dockerfile_requirement: all modules always require dockerfile - Remove snapshot_builds, has_snapshot, has_builder_module properties from CRSConfig - Delete test_snapshot_flag, test_snapshot_module_can_omit_dockerfile tests - Add test_module_requires_dockerfile_always test Signed-off-by: Andrew Chin <achin34@gatech.edu>
- Remove _any_needs_snapshot property from CRSCompose - Remove snapshot creation block from CRSCompose.build_target() - Remove snapshot image check and snapshot_image_tag assignment from CRSCompose.run() - Replace non_snapshot_builds filter with plain builds in CRS.build_target() and is_target_built() - Remove snapshot_image_tag attr, create_snapshot(), get_snapshot_image_name(), _snapshot_lock_path(), _snapshot_exists(), _is_snapshot_reusable(), _get_base_image_hash() from Target - Remove tempfile import (no longer needed) - Update renderer.py: disable sidecar injection (has_sidecar=False), remove snapshot_image_tag from target reference, remove run_snapshot logic from module env computation - Update Jinja2 template: remove run_snapshot conditional blocks - Delete test_crs_compose_snapshot_sanitizer.py and test_target_snapshot.py Signed-off-by: Andrew Chin <achin34@gatech.edu>
- Remove has_sidecar conditional; sidecars now always injected as infra - Compute rebuild_out_dir unconditionally from crs_list[0] - Remove snapshot_image_tag, has_sidecar, sidecar_crs_name from context - Template: replace single sidecar_crs_name alias with crs_list loop - Template: BASE_IMAGE uses target.get_docker_image_name() unconditionally - Sandbox crs.yaml: remove inc-builder snapshot build entry Signed-off-by: Andrew Chin <achin34@gatech.edu>
- Add --incremental-build store_true arg to build-target subcommand - Add --incremental-build store_true arg to run subcommand - Pass incremental_build=args.incremental_build in both CLI dispatch sites - Add incremental_build: bool = False to CRSCompose.build_target() signature - Add incremental_build: bool = False to CRSCompose.run() signature - Thread incremental_build through __run(), __run_local(), __prepare_local_running_env() - 4 unit tests verify flag parsing on both subcommands (present/absent) Signed-off-by: Andrew Chin <achin34@gatech.edu>
- get_test_image() signature drops builder_name parameter per D-05
- run_ephemeral_test() snapshot_tag and commit tag use test-{build_id}
- server.py _handle_test() updated to call get_test_image() without builder_name
- All sidecar tests updated to assert test-{build_id} format (no builder_name)
Signed-off-by: Andrew Chin <achin34@gatech.edu>
- Add docker/requests.exceptions imports to crs_compose.py
- _snapshot_one(): helper to run a container from base_image and commit on success
- _create_incremental_snapshots(): commit builder snapshots (build-{name}-{build_id}) and
project image snapshot (test-{build_id}) with all-or-nothing cleanup on failure (D-04/D-05/D-06)
- _check_snapshots_exist(): pre-run validation returning clear error with oss-crs build-target
--incremental-build instructions when any snapshot is missing (SNAP-05/D-09)
- Wire _create_incremental_snapshots into build_target() after success, gated by incremental_build
- Wire _check_snapshots_exist into run() before compose starts, gated by incremental_build
- 9 unit tests passing with mocked Docker SDK
Signed-off-by: Andrew Chin <achin34@gatech.edu>
- _handle_test() now reads PROJECT_BASE_IMAGE env var directly (not BASE_IMAGE_*) - Raises ValueError if PROJECT_BASE_IMAGE is not set (clear error message) - Template unconditionally emits PROJECT_BASE_IMAGE on builder-sidecar service - Module docstring documents the new env var Signed-off-by: Andrew Chin <achin34@gatech.edu>
…ts on --incremental-build flag - Bundle oss_crs_handler.sh in sidecar image and bind-mount into ephemeral build/test containers via HANDLER_SCRIPT_PATH env var - Sidecar only uses snapshot images when INCREMENTAL_BUILD=true (fresh base image otherwise), enforcing SNAP-04 - Forward OSS-Fuzz env vars (FUZZING_ENGINE, SANITIZER, ARCHITECTURE, FUZZING_LANGUAGE) from sidecar to ephemeral containers - Stream ephemeral container logs to sidecar stdout with [build:name]/[test:id] prefix while still capturing for response - Extract OSS_FUZZ_TARGET_ENV constant in env_policy.py to dedup env var definitions Signed-off-by: Andrew Chin <achin34@gatech.edu>
…rce limits
- Replace v1/v2 versioning with rebuild_id (auto-incrementing int, optional
override). Output dir: /rebuild_out/{crs_name}/{rebuild_id}/
- Merge download_rebuild_output into download_build_output: with rebuild_id
fetches from sidecar, without uses local filesystem. Ephemeral containers
auto-try sidecar via OSS_CRS_REBUILD_ID env var, fallback to local.
- Rename build_id to rebuild_id on sidecar endpoints; add crs_name form field
- Forward CRS resource limits (cpuset, mem_limit) per-request to ephemeral containers
- Replace sequential job queue with ThreadPoolExecutor (MAX_PARALLEL_JOBS=4)
- Remove dead include_snapshot code from env_policy and renderer
Signed-off-by: Andrew Chin <achin34@gatech.edu>
…ardized response files - builder defaults to BUILDER_MODULE env var; run_pov defaults to runner-sidecar - builder_name param separates service routing from image resolution - submit_build_output validates OSS_CRS_CURRENT_PHASE: local at build-target, sidecar upload at run - response dir files standardized: retcode, stdout.log, stderr.log, rebuild_id - run_pov takes rebuild_id (int) instead of build_id (str) Signed-off-by: Andrew Chin <achin34@gatech.edu>
…_output_dir - POST /upload-build-output on builder sidecar for run-phase artifact pre-staging - rebuild_output_dir() extracted as shared path helper - runner-sidecar: build_id -> rebuild_id, stdout added to POVResult Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
…OSS_CRS_PROJ_PATH/test.sh) - New run_tests.sh script resolves test script with fallback chain - Mounted into both sidecar ephemeral containers and orchestrator snapshot containers - Replaces hardcoded test.sh references in docker_ops.py and crs_compose.py - Test snapshot is optional (skip if no test script found) Signed-off-by: Andrew Chin <achin34@gatech.edu>
…ecified Signed-off-by: Andrew Chin <achin34@gatech.edu>
…{crs_name}/{rebuild_id}/
- Replace /out bind mount with container.get_archive() to preserve snapshot
state + new files (bind mount was shadowing snapshot's prebuilt /out)
- Runner sidecar takes crs_name, resolves harness at /out/{crs_name}/{rebuild_id}/
- libCRS run_pov sends crs_name to runner
Signed-off-by: Andrew Chin <achin34@gatech.edu>
…compile) Signed-off-by: Andrew Chin <achin34@gatech.edu>
…(OOM on compile)" This reverts commit 1f5a6bd0ee7f10b973f54c63806ed0c3a1660cb5. Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
…iner Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
acorn421
force-pushed
the
feat/125-sidecar
branch
from
April 9, 2026 03:57
f18de48 to
0810201
Compare
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
…e RTS in content key Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
…call in verify_patch Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
…gistry entries Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
refactor: replace download-source with mount-based API
Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
…mits Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
acorn421
force-pushed
the
feat/125-sidecar
branch
from
April 11, 2026 05:23
ce735ef to
32306ff
Compare
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Andrew Chin <achin34@gatech.edu>
… does mkdir Signed-off-by: Andrew Chin <achin34@gatech.edu>
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
…ail configurable Signed-off-by: Youngjoon Kim <acorn421@gmail.com>
acorn421
force-pushed
the
feat/125-sidecar
branch
from
April 15, 2026 05:49
f551bb9 to
1d05949
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the builder sidecar architecture per #125. Instead of CRS-declared long-running builder containers with snapshot configs (
snapshot: true/run_snapshot: true), the framework now:crs.yaml--incremental-buildflag (operator-controlled) tobuild-targetandrunfor Docker snapshot-based fast rebuildsrun-testtoapply-patch-test— patches are now applied in a fresh container rather than reusing a stateful buildBreaking changes
snapshotandrun_snapshotfields removed fromcrs.yamlOSS_CRS_SNAPSHOT_IMAGEenv var removedlibCRS run-testreplaced bylibCRS apply-patch-test--build-idin sidecar commands replaced by--rebuild-idbuild_exit_code→retcode,build_id→rebuild_idTest plan
test_builder_sidecar_full— E2E: prepare → build-target → run with patch, POV, and test.sh through the full sidecar pipeline. Tests multiple builder configs (default-build + coverage-build) to verify custom/multi-builder support, coverage instrumentation verification, and rebuild artifact download.test_builder_sidecar_lite— E2E: prepare → build-target → run with patch verification (build, rebuild, POV, test)test_sidecar_lifecycle— Ephemeral container lifecycle: start, build, snapshot creation/reuse, cleanup on failuretest_env_policy— Framework injectsBUILDER_MODULEand CRS cannot override itapply-patch-build/run-pov/apply-patch-test)