Repository navigation
fix(examples): inherit acp-docker image from config/defaults.json - #1434
Conversation
examples/acp-docker/docker-compose.yml hardcoded the agent-server image at
`1.25.0-python`. Canvas enforces `compatibility.minimumAgentServer` (1.28.0)
from the repo's single source of truth, so the example default fell below the
floor and rendered "Disconnected — requires 1.28.0 or newer" — a reviewer
following the quickstart as written never reached the feature.
examples/acp-docker was the lone in-repo file hardcoding a version instead of
inheriting from config/defaults.json (14 other files read it; check-sdk-version
-sync only validates the released PyPI package, not in-repo files).
- scripts/gen-acp-docker-env.mjs: read defaults.json, pin AGENT_SERVER_IMAGE to
`${images.agentServer}:${versions.agentServer}-python` in examples/acp-docker
/.env (idempotent upsert; mirrors scripts/docker-build.mjs).
- package.json: `npm run example:acp-docker:env`.
- docker-compose.yml: no-config fallback `1.25.0-python` -> `latest-python`,
always >= the compatibility floor, so zero-config `docker compose up` never
shows "Disconnected"; the generated .env overrides with the pinned SoT
version for the reproducible path.
- .env.example / README.md: document both paths; correct the version narrative
(floor is the defaults.json compatibility pin; #3510 is the deeper functional
floor at/below it).
- __tests__/scripts/acp-docker-env-sync.test.ts: assert the generator's tag
matches defaults.json, the pin satisfies the floor, and the compose fallback
stays `latest-python`. Mirrors docs-version-sync.test.ts — the guard that
makes "can't silently drift" true.
|
@georgeglarson is attempting to deploy a commit to the openhands Team on Vercel. A member of the Team first needs to authorize it. |
Addresses the cli-review-panel findings worth acting on (the rest were cosmetic or matched the no-validation idiom of scripts/docker-build.mjs): - gte() in the test guarded with parseSemver — a non-numeric pin (sha / pre-release) now fails the floor check loudly instead of silently comparing NaN. The floor check is a CI gate; its one piece of logic shouldn't mis-compare in silence. - compose-fallback assertion derives the registry from config.images .agentServer instead of hardcoding ghcr.io/openhands/... — a registry change no longer false-fails a test that only cares about the latest-python tag. - upsertEnvLine now has unit tests (append / replace-in-place+preserve / idempotent / commented-template-line / keyless-line guard), making the "idempotent upsert" claim defensible. It was the one untested piece of real logic. - upsertEnvLine guards a keyless line (no "=") with a clear throw, instead of an empty key matching every line and rewriting the whole file.
There was a problem hiding this comment.
Pull request overview
This PR fixes drift in the examples/acp-docker quickstart by removing a hardcoded, below-minimum agent-server image tag and instead deriving the pinned image version from the repo’s single source of truth (config/defaults.json). This aligns the example with the frontend’s enforced minimum agent-server compatibility floor and prevents users from hitting a “Disconnected — requires … or newer” banner when following the docs.
Changes:
- Add a small generator script (
scripts/gen-acp-docker-env.mjs) plus an npm script to write/updateexamples/acp-docker/.envwithAGENT_SERVER_IMAGE=<registry>:<versions.agentServer>-pythonfromconfig/defaults.json. - Update the compose no-config fallback image to
ghcr.io/openhands/agent-server:latest-pythonand refresh example docs/templates to explain the pinned vs. zero-config paths. - Add a Vitest drift-guard ensuring the compose fallback and generated pinned image stay in sync with
config/defaults.json(and that the pinned version satisfies the compatibility floor).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
scripts/gen-acp-docker-env.mjs |
New generator that upserts AGENT_SERVER_IMAGE in examples/acp-docker/.env using config/defaults.json. |
package.json |
Adds example:acp-docker:env script to run the generator. |
examples/acp-docker/README.md |
Updates quickstart to default to latest-python and documents the reproducible pinned .env flow. |
examples/acp-docker/docker-compose.yml |
Switches compose fallback from a hardcoded version to latest-python and documents the SoT pin workflow. |
examples/acp-docker/.env.example |
Updates comments/template to reflect latest-python default and the generator-based pinned approach. |
__tests__/scripts/acp-docker-env-sync.test.ts |
New drift-detection tests enforcing SoT version inheritance and compatibility-floor satisfaction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🔍 Review in progress… We are performing the review through OpenHands Cloud Automation. You can log in and view the conversation here. |
|
🤖 OpenHands is reviewing this PR. Trigger label: This comment was posted by an AI agent (OpenHands). |
There was a problem hiding this comment.
Summary
Real fix for a user-facing regression, with a real drift-detection test. scripts/gen-acp-docker-env.mjs reads versions.agentServer from config/defaults.json and upserts AGENT_SERVER_IMAGE= into examples/acp-docker/.env; docker-compose.yml falls back to latest-python when no .env is present so the no-config path can never silently drop below compatibility.minimumAgentServer again. The __tests__/scripts/acp-docker-env-sync.test.ts suite reads the actual compose file and asserts both the SoT-derived pin and the latest-python fallback, so the 1.25.0-python regression can't recur without CI catching it.
Verified locally on this branch:
npx vitest run __tests__/scripts/acp-docker-env-sync.test.ts→ 9/9 passednode scripts/gen-acp-docker-env.mjswrites the correct line and is idempotent on re-rundocker compose configresolves both the pinned and fallback paths correctly.envis already gitignored at the repo root (.gitignoreline 4), so the script can't accidentally commit secrets
A few non-blocking comment-density suggestions in-line. Worth merging.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
|
Note: This review was generated by an AI agent (OpenHands) on behalf of the user. Thanks for tightening the ACP Docker example around I found one correctness issue that should be fixed before merge:
One additional maintainability note: there are still below-floor Security-wise, I did not see any new credential handling risk; the generator only upserts 🔄 CHANGES REQUESTED This comment was posted by an AI agent (OpenHands). |
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
|
Hi @georgeglarson do you mind addressing the comments left by the all-hands-bot Then feel free to @ me or join the slack to ask for a PR review in #proj-agent-canvas |
… argv[1] The CLI entrypoint guard called pathToFileURL(process.argv[1]) unconditionally. process.argv[1] is undefined in some ESM contexts (e.g. importing the module for its exports via `node --input-type=module -e "import(...)"`), so the guard threw ERR_INVALID_ARG_TYPE at import, before any exported helper was reachable. Short-circuit on process.argv[1] before pathToFileURL so importing the module is side-effect-free while the CLI path is unchanged. Add a regression test that reproduces the bare-import context and asserts a clean exit. Addresses the review finding on #1434.
|
The entrypoint-guard fix is pushed (a42c663): guarded On the second note: the |
Address all-hands-bot's review suggestions on #1434: - test header describes the current invariant, not the prior-state history (that narration belonged in the PR description) - docker-compose.yml: condense the image-pin comment to the how-to-override; the compatibility-floor / #3510 rationale already lives in README §1 + the test - .env.example: 7-line pin explainer down to 2 Comment-only; env-sync test still 10/10 green, prettier clean.
|
@jamiechicago312 cleared the all-hands-bot comments (trimmed the over-verbose comments in the test, compose, and .env files). Ready for another look whenever you get a chance, thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands WDYT? /codereview this PR. Feel free to clone yourself agent-sdk from the same org, and investigate. Read all comments and inline reviews, and feel free to reply with your thoughts too. Post your feedback as a review with gh api. |
|
I'm on it! enyst can track my progress at all-hands.dev |
enyst
left a comment
There was a problem hiding this comment.
Note: This review was generated by an AI agent (OpenHands) on behalf of the user.
🟢 Taste Rating: Good taste
LGTM. The PR solves the real drift problem with a small, direct mechanism: zero-config Compose falls back to latest-python, while the reproducible path pins from the same config/defaults.json source used by the launchers. The generator is idempotent, import-safe after the entrypoint guard fix, and the new Vitest coverage exercises the important invariants plus the .env upsert behavior.
I also agree with the latest README guidance: in the realistic upgrade paths, newer Canvas brings the matching/newer agent-server default through config/defaults.json; the meaningful exception is a user-owned stale .env/shell override, and the README now documents that remediation clearly.
Local checks I ran here:
git diff --check origin/main...HEADnode --input-type=module -e "import('./scripts/gen-acp-docker-env.mjs').then(...)"import/helper smoke check
I did not rerun Vitest locally because this checkout has no node_modules; the PR body already includes the targeted Vitest and script-suite results. Current PR checks only show the Vercel authorization gate, not a code/test failure.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Docs/example/script-only change scoped to examples/acp-docker, plus an npm helper script and drift tests. No credential-handling expansion beyond preserving user-owned .env contents and no production frontend/runtime behavior change.
VERDICT:
✅ Worth merging: Core logic is sound, the realistic version paths are now accurately documented, and the stale-override edge case is handled in user-facing guidance.
KEY INSIGHT:
The fix keeps version ownership in config/defaults.json for the reproducible path without making the zero-config Docker example depend on a stale hardcoded release tag.
enyst
left a comment
There was a problem hiding this comment.
🟢 Taste Rating: Good taste — this is a small, practical fix that removes a stale hardcoded image and makes the reproducible path inherit from config/defaults.json.
Reviewed the latest head (41c03413) plus the prior comments/inline threads. The earlier entrypoint-guard issue is fixed, and the version-guidance cleanup now matches the realistic paths: zero-config Compose uses the existing latest-python image, while npm run example:acp-docker:env pins to the exact release from the repo defaults.
Verification I ran:
git diff --check origin/main...HEAD- Import guard:
node --input-type=module -e "import('./scripts/gen-acp-docker-env.mjs')" - Generator helper smoke check for
AGENT_SERVER_IMAGE=ghcr.io/openhands/agent-server:1.28.1-python docker compose configresolves both fallbacklatest-pythonand pinned1.28.1-pythondocker manifest inspectsucceeds for bothghcr.io/openhands/agent-server:latest-pythonand the pinned1.28.1-python
I did not run the Vitest suite because this checkout has no node_modules; the lightweight checks above cover the code paths I wanted to verify locally, and the PR description includes the focused test run.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
This touches an example compose file, docs, a small local generator script, and focused drift tests. No dependency changes, no production runtime path, and no new credential exposure — the generator only upserts the image line in a gitignored.envwhile preserving the rest of the file. The only currently failing check I saw is Vercel authorization, not a code failure.
VERDICT:
✅ Worth merging
KEY INSIGHT:
The split between a floating quickstart image and a reproducible config-derived pin is the right data model for this example.
This review was created by an AI agent (OpenHands) on behalf of the user.
|
Done — I reviewed PR #1434 and posted feedback via GitHub API as an approving review: I also replied to the remaining inline question about Checks I ran locally:
I did not install dependencies or run Vitest because |
✅ Mock-LLM E2E Tests60/60 passed Commit: Details
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
|
🚀 Released in v1.2.0. |
HUMAN:
docker compose configresolveslatest-python(zero-config) and1.28.1-python(afternpm run example:acp-docker:env);npx vitest run __tests__/scripts/acp-docker-env-sync.test.ts→ 9 passed.AGENT:
Why
examples/acp-docker/docker-compose.ymlhardcodedagent-server:1.25.0-python. Canvas enforcescompatibility.minimumAgentServer(1.28.0) fromconfig/defaults.json, so the example's default image fell below the floor and rendered "Disconnected — requires 1.28.0 or newer" — a user following the quickstart as written never reached the feature.examples/acp-dockerwas the only in-repo file hardcoding a version instead of inheriting from the single source of truth.Summary
scripts/gen-acp-docker-env.mjs(+npm run example:acp-docker:env) pinsAGENT_SERVER_IMAGEto${images.agentServer}:${versions.agentServer}-pythonfromconfig/defaults.json(idempotent upsert; mirrorsscripts/docker-build.mjs).1.25.0-python→latest-python(always ≥ the floor; zero-configdocker compose upnever shows "Disconnected")..env.example+README.mddocument both paths and correct the version narrative (floor = the defaults.json compatibility pin; fix(ci): repo owner for docker pull OpenHands#3510 is the deeper functional floor at/below it).__tests__/scripts/acp-docker-env-sync.test.ts(mirrorsdocs-version-sync.test.ts) — the guard that makes "can't silently drift" true.Issue Number
Closes #2020
How to Test
Verified end-to-end on Linux:
docker compose configresolves both images as shown above; full__tests__/scriptssuite green (168 passed);npm run typecheckclean.Type
Notes
examples/acp-docker/.envis gitignored; the generator writes it. Separate concern from OpenHands/OpenHands#15643/#1430 (the ACP auth banner) — its own issue + PR.