fix: bug: code fixes to docker/agents/ don't take effect — agent image is never rebuilt (#887)
Add `pull_policy: build` to every agent service emitted by the generator that shares `docker/agents/Dockerfile` as its build context. Without it, `docker compose up -d --force-recreate agents-<name>` reuses the cached `disinto/agents:latest` image and silently keeps running stale `docker/agents/entrypoint.sh` code even after the repo is updated. This masked PR #864 (and likely earlier merges) — the fix landed on disk but never reached the container. #853 already paired `build:` with `image:` on hired-agent stanzas, which was enough for first-time ups but not for re-ups. `pull_policy: build` tells Compose to rebuild the image on every up; BuildKit's layer cache makes the no-change case near-instant, and the change case picks up the new source automatically. This covers: - TOML-driven `agents-<name>` hired via `disinto hire-an-agent` — primary target of the issue. - Legacy `agents-llama` and `agents-llama-all` stanzas — same Dockerfile, same staleness problem. `bin/disinto up` already passed `--build`, so operators on the supported UX path were already covered; this closes the gap for the direct `docker compose` path the issue explicitly names in its acceptance. Regression test added to `tests/lib-generators.bats` to pin the directive alongside the existing #853 build/image invariants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3b6325fd4f
commit
9ee704ea9c
2 changed files with 43 additions and 0 deletions
|
|
@ -123,6 +123,11 @@ _generate_local_model_services() {
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/agents/Dockerfile
|
dockerfile: docker/agents/Dockerfile
|
||||||
image: disinto/agents:\${DISINTO_IMAGE_TAG:-latest}
|
image: disinto/agents:\${DISINTO_IMAGE_TAG:-latest}
|
||||||
|
# Rebuild on every up (#887): without this, \`docker compose up -d --force-recreate\`
|
||||||
|
# reuses the cached image and silently keeps running stale docker/agents/ code
|
||||||
|
# even after the repo is updated. \`pull_policy: build\` makes Compose rebuild
|
||||||
|
# the image on every up; BuildKit layer cache makes unchanged rebuilds fast.
|
||||||
|
pull_policy: build
|
||||||
container_name: disinto-agents-${service_name}
|
container_name: disinto-agents-${service_name}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
security_opt:
|
security_opt:
|
||||||
|
|
@ -443,6 +448,9 @@ COMPOSEEOF
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/agents/Dockerfile
|
dockerfile: docker/agents/Dockerfile
|
||||||
|
# Rebuild on every up (#887): makes docker/agents/ source changes reach this
|
||||||
|
# container without a manual \`docker compose build\`. Cache-fast when clean.
|
||||||
|
pull_policy: build
|
||||||
container_name: disinto-agents-llama
|
container_name: disinto-agents-llama
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
security_opt:
|
security_opt:
|
||||||
|
|
@ -493,6 +501,9 @@ COMPOSEEOF
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/agents/Dockerfile
|
dockerfile: docker/agents/Dockerfile
|
||||||
|
# Rebuild on every up (#887): makes docker/agents/ source changes reach this
|
||||||
|
# container without a manual \`docker compose build\`. Cache-fast when clean.
|
||||||
|
pull_policy: build
|
||||||
container_name: disinto-agents-llama-all
|
container_name: disinto-agents-llama-all
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
profiles: ["agents-llama-all"]
|
profiles: ["agents-llama-all"]
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,38 @@ EOF
|
||||||
[[ "$output" == *'dockerfile: docker/agents/Dockerfile'* ]]
|
[[ "$output" == *'dockerfile: docker/agents/Dockerfile'* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "local-model agent service emits pull_policy: build so docker compose up rebuilds on source change (#887)" {
|
||||||
|
# Without pull_policy: build, `docker compose up -d --force-recreate` reuses
|
||||||
|
# the cached `disinto/agents:latest` image and silently runs stale
|
||||||
|
# docker/agents/entrypoint.sh even after the repo is updated. `pull_policy:
|
||||||
|
# build` forces a rebuild on every up; BuildKit layer cache makes unchanged
|
||||||
|
# rebuilds near-instant. The alternative was requiring every operator to
|
||||||
|
# remember `--build` on every invocation, which was the bug that prompted
|
||||||
|
# #887 (2h of debugging a fix that was merged but never reached the container).
|
||||||
|
cat > "${FACTORY_ROOT}/projects/test.toml" <<'EOF'
|
||||||
|
name = "test"
|
||||||
|
repo = "test-owner/test-repo"
|
||||||
|
forge_url = "http://localhost:3000"
|
||||||
|
|
||||||
|
[agents.dev-qwen2]
|
||||||
|
base_url = "http://10.10.10.1:8081"
|
||||||
|
model = "qwen"
|
||||||
|
api_key = "sk-no-key-required"
|
||||||
|
roles = ["dev"]
|
||||||
|
forge_user = "dev-qwen2"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
run bash -c "
|
||||||
|
set -euo pipefail
|
||||||
|
source '${ROOT}/lib/generators.sh'
|
||||||
|
_generate_local_model_services '${FACTORY_ROOT}/docker-compose.yml'
|
||||||
|
cat '${FACTORY_ROOT}/docker-compose.yml'
|
||||||
|
"
|
||||||
|
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" == *'pull_policy: build'* ]]
|
||||||
|
}
|
||||||
|
|
||||||
@test "local-model agent service keys FORGE_BOT_USER to forge_user even when it differs from service name (#849)" {
|
@test "local-model agent service keys FORGE_BOT_USER to forge_user even when it differs from service name (#849)" {
|
||||||
# Exercise the case the issue calls out: two agents in the same factory
|
# Exercise the case the issue calls out: two agents in the same factory
|
||||||
# whose service names are identical (`[agents.llama]`) but whose
|
# whose service names are identical (`[agents.llama]`) but whose
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue