Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: 2
updates:
# GitHub Actions — pinned SHA digests in CI workflows
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

# Python (uv) — main project dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"

# Docker — pinned image digests (tracks oss-crs-infra/dependabot-pins.Dockerfile)
# The actual refs live in oss_crs/src/constants.py; sync manually on update.
# TODO: Explore Renovate for native regex-based tracking in Python files.
- package-ecosystem: "docker"
directory: "/oss-crs-infra"
schedule:
interval: "weekly"

# Python (pip) — builder-sidecar container dependencies
- package-ecosystem: "pip"
directory: "/oss-crs-infra/builder-sidecar"
schedule:
interval: "weekly"

# Python (pip) — runner-sidecar container dependencies
- package-ecosystem: "pip"
directory: "/oss-crs-infra/runner-sidecar"
schedule:
interval: "weekly"

# Python (pip) — lifecycle container dependencies
- package-ecosystem: "pip"
directory: "/oss-crs-infra/lifecycle"
schedule:
interval: "weekly"

# Python (pip) — litellm-key-gen container dependencies
- package-ecosystem: "pip"
directory: "/oss-crs-infra/litellm-key-gen"
schedule:
interval: "weekly"
178 changes: 161 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ on:
jobs:
verify:
name: Verify
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- run: uv sync --frozen --dev
Expand All @@ -29,11 +33,15 @@ jobs:

integration-test:
name: Integration tests
permissions:
contents: read
runs-on: ubuntu-latest
needs: [verify]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: sync
Expand All @@ -43,12 +51,16 @@ jobs:

smoke-c:
name: Smoke test (C)
permissions:
contents: read
runs-on: ubuntu-latest
needs: [verify]
timeout-minutes: 30
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- run: uv sync --frozen --dev
Expand Down Expand Up @@ -135,7 +147,7 @@ jobs:

- name: Upload smoke-c workdir artifacts
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: smoke-c-workdir
path: /tmp/smoke-c-workdir.tar.gz
Expand All @@ -144,18 +156,22 @@ jobs:

smoke-c-patch:
name: Smoke test (C patching)
permissions:
contents: read
if: |
github.actor != 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
needs: [verify]
timeout-minutes: 40
timeout-minutes: 20
env:
EXTERNAL_LITELLM_API_BASE: ${{ secrets.EXTERNAL_LITELLM_API_BASE }}
EXTERNAL_LITELLM_API_KEY: ${{ secrets.EXTERNAL_LITELLM_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- run: uv sync --frozen --dev
Expand Down Expand Up @@ -229,7 +245,7 @@ jobs:
--fuzz-proj-path oss_crs/tests/integration/fixtures/mock-c-project \
--target-source-path oss_crs/tests/integration/fixtures/mock-c-repo \
--target-harness fuzz_parse_buffer \
--timeout 1200 \
--timeout 600 \
--build-id smoke-c-patch \
--run-id bugfixing-c \
--pov-dir oss_crs/tests/integration/fixtures/mock-c-povs \
Expand Down Expand Up @@ -266,21 +282,149 @@ jobs:

- name: Upload smoke-c-patch workdir artifacts
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: smoke-c-patch-workdir
path: /tmp/smoke-c-patch-workdir.tar.gz
if-no-files-found: warn
retention-days: 2

smoke-c-bugfinding-codex:
name: Smoke test (C agentic bug-finding)
permissions:
contents: read
if: |
github.actor != 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
needs: [verify]
timeout-minutes: 20
env:
EXTERNAL_LITELLM_API_BASE: ${{ secrets.EXTERNAL_LITELLM_API_BASE }}
EXTERNAL_LITELLM_API_KEY: ${{ secrets.EXTERNAL_LITELLM_API_KEY }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- run: uv sync --frozen --dev

- name: Create CI compose (bugfinding - codex)
run: |
mkdir -p /tmp/ci-config
cat > /tmp/ci-config/compose-bugfinding-codex.yaml << 'EOF'
run_env: local
docker_registry: local
oss_crs_infra:
cpuset: "0"
memory: "4G"
crs-bug-finding-codex:
cpuset: "1-3"
memory: "10G"
llm_budget: 5
additional_env:
CRS_AGENT: codex
CODEX_MODEL: gpt-5.2-codex
llm_config:
litellm:
mode: internal
internal:
config_path: /tmp/ci-config/litellm-bugfinding-codex.yaml
EOF

- name: Create CI litellm config (bugfinding codex)
run: |
cp example/crs-bug-finding-codex/litellm-config.yaml /tmp/ci-config/litellm-bugfinding-codex.yaml

- name: Setup mock-c repo as git
run: |
cd oss_crs/tests/integration/fixtures/mock-c-repo
git init
git config user.email "ci@test.com"
git config user.name "CI"
git add .
git commit -m "initial"

- name: Prepare CRSs
run: |
uv run oss-crs prepare \
--compose-file /tmp/ci-config/compose-bugfinding-codex.yaml \
--work-dir /tmp/oss-crs-work
Comment thread
azchin marked this conversation as resolved.
Resolved

- name: Build mock-c target
run: |
uv run oss-crs build-target \
--compose-file /tmp/ci-config/compose-bugfinding-codex.yaml \
--work-dir /tmp/oss-crs-work \
--fuzz-proj-path oss_crs/tests/integration/fixtures/mock-c-project \
--target-source-path oss_crs/tests/integration/fixtures/mock-c-repo \
--build-id smoke-c-bugfinding-codex

- name: Bugfinding (crs-bug-finding-codex)
run: |
uv run oss-crs run \
--compose-file /tmp/ci-config/compose-bugfinding-codex.yaml \
--work-dir /tmp/oss-crs-work \
--fuzz-proj-path oss_crs/tests/integration/fixtures/mock-c-project \
--target-source-path oss_crs/tests/integration/fixtures/mock-c-repo \
--target-harness fuzz_parse_buffer \
--timeout 600 \
--build-id smoke-c-bugfinding-codex \
--run-id bugfinding-c-codex \
--early-exit

- name: Verify POVs found
run: |
artifacts=$(uv run oss-crs artifacts \
--compose-file /tmp/ci-config/compose-bugfinding-codex.yaml \
--work-dir /tmp/oss-crs-work \
--fuzz-proj-path oss_crs/tests/integration/fixtures/mock-c-project \
--target-source-path oss_crs/tests/integration/fixtures/mock-c-repo \
--target-harness fuzz_parse_buffer \
--build-id smoke-c-bugfinding-codex \
--run-id bugfinding-c-codex)
echo "$artifacts" | jq .
pov_dir=$(echo "$artifacts" | jq -r '.crs | to_entries[0].value.pov')
echo "POV directory: $pov_dir"
if [ ! -d "$pov_dir" ] || [ -z "$(ls -A "$pov_dir")" ]; then
echo "ERROR: No POVs found"
exit 1
fi
pov_count=$(find "$pov_dir" -maxdepth 1 -type f | wc -l)
echo "Found $pov_count POV file(s)"

- name: Create smoke-c-bugfinding-codex workdir tarball
if: failure()
run: |
python scripts/create_workdir_tarball.py \
--output /tmp/smoke-c-bugfinding-codex-workdir.tar.gz \
--empty-message "No smoke-c-bugfinding-codex workdir artifacts were found."
tarball=/tmp/smoke-c-bugfinding-codex-workdir.tar.gz
ls -lh "$tarball"

- name: Upload smoke-c-bugfinding-codex workdir artifacts
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: smoke-c-bugfinding-codex-workdir
path: /tmp/smoke-c-bugfinding-codex-workdir.tar.gz
if-no-files-found: warn
retention-days: 2

smoke-java:
name: Smoke test (Java)
permissions:
contents: read
runs-on: ubuntu-latest
needs: [verify]
timeout-minutes: 30
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- run: uv sync --frozen --dev
Expand Down Expand Up @@ -367,7 +511,7 @@ jobs:

- name: Upload smoke-java workdir artifacts
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: smoke-java-workdir
path: /tmp/smoke-java-workdir.tar.gz
Expand Down
8 changes: 7 additions & 1 deletion libCRS/libCRS/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,15 @@ def _submit_and_poll(
logger.error("Failed to submit job to %s: %s", endpoint, e)
return None

job_id = resp.json()["id"]
submit_result = resp.json()
job_id = submit_result["id"]
logger.info("Submitted job %s to %s", job_id, endpoint)

# Cache hits return status=done immediately; use the POST response
# directly so any rewritten fields (e.g. rebuild_id) are preserved.
if submit_result.get("status") == "done":
return submit_result

start = time.monotonic()
while time.monotonic() - start < timeout:
try:
Expand Down
32 changes: 32 additions & 0 deletions oss-crs-infra/builder-sidecar/docker_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,38 @@ def next_rebuild_id(rebuild_out_dir: Path, crs_name: str) -> int:
return max(existing, default=0) + 1


def stage_cached_rebuild(
rebuild_out_dir: Path, crs_name: str, src_rid: int, dst_rid: int
) -> None:
"""Materialize a cached rebuild tree into a caller-requested rebuild_id slot.

Files are hardlinked so the cached directory and the staged copy share
underlying inodes (near-zero disk cost), but remain independent: removing
one directory does not affect the other. Staging goes through a sibling
``.{dst_rid}.staging`` directory and is committed via an atomic rename so
concurrent readers never observe a partial tree.

Raises RuntimeError if the source rebuild directory does not exist.
"""
src_dir = rebuild_output_dir(rebuild_out_dir, crs_name, src_rid)
dst_dir = rebuild_output_dir(rebuild_out_dir, crs_name, dst_rid)
if not src_dir.is_dir():
raise RuntimeError(f"Cached rebuild artifacts missing: {src_dir}")

staging = dst_dir.parent / f".{dst_rid}.staging"
if staging.exists():
shutil.rmtree(staging)

def _hardlink(src: str, dst: str, *, follow_symlinks: bool = True) -> None:
os.link(src, dst, follow_symlinks=follow_symlinks)

shutil.copytree(src_dir, staging, copy_function=_hardlink)

if dst_dir.exists():
shutil.rmtree(dst_dir)
staging.rename(dst_dir)


def _run_ephemeral(
base_image: str,
rebuild_id: int,
Expand Down
Loading