Repository navigation
fix(agents): OpenCode installs on a bare target, and defaults to claude-sonnet-5-5 - #917
Merged
Merged
Conversation
…ith none Since OpenCode's model calls go through the turn's model relay (#865), the agent's own Python makes them, and it reads the system's CA certificates. A bare target has none: on a remote sandbox, where install_agent passes no trust lines, every call the relay forwarded failed TLS and came back 502, so the installed agent never answered and install/v1 failed (the promotion gate has rolled back opencode-cli on every release since 0.9.1624). Like Codex, such a target's agent now trusts certifi's bundle, from its own Python, unless the trust lines name one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test read install.sh's text, so a broken check would still have passed. It now runs the decision itself, its target's /etc a temp folder: no bundle, each system bundle, an empty one, and trust lines naming a bundle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCode still defaulted to claude-sonnet-4-6. On the promotion gate's task run
("list every email" over a search-only tool) that model searches for "the" and
reports one email of the inbox's three; since judges default to
claude-sonnet-5-5 (#878) the gate grades that 0. With claude-sonnet-5-5 OpenCode
lists the inbox with an empty query, as Claude Code does, at a lower price per
token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
opencode-clihas failed its promotion gate on every release since 0.9.1624: 0.9.1624, 0.9.1636, 0.9.1639 and 0.9.1642. Two checks failed,installand the task run, and each time the gate rolled back to the image from before #865. This PR fixes both.1.
install: an installed OpenCode had no CA certificatesmodel_relay.py. The relay runs in the agent's own Python, an aiohttpClientSession, so it verifies TLS against the system's CA store. Before feat(agents): OpenCode reports each turn's token usage, counted at a model relay of its own #865 the OpenCode CLI made those calls itself and used its own bundled CAs.install/v1installs the agent into a bareubuntu:24.04container, which has noca-certificates.modal_vm, which the gate uses),install_agentpasses no trust lines. So every call the relay forwards fails TLS and comes back to the CLI as a 502 (model relay: ClientConnectorCertificateError). OpenCode retries until the turn times out and never answers.install_agentpassesLOCAL_TRUST_ENV, whoseSSL_CERT_FILEnames a bundle. That's why local runs pass.Fix:
install.shports Codex's fallback. When the target has no system CA bundle, and the trust lines don't name one, the agent's environment getsSSL_CERT_FILEpointing at certifi's bundle from the agent's own Python. Both the relay (Python's default TLS context) and the CLI (Bun) honourSSL_CERT_FILE.certifiis now listed in the agent's requirements. It was already installed as a dependency ofhttpx.install.sh's actual decision against faked targets.2. The task run: OpenCode's default model gets the task wrong
mailenv, whose only tool issearch_emails(query). An empty query returns all three emails.anthropic/claude-sonnet-4-6. With that model OpenCode searched for "the", got one match (m-2), and replied that the inbox holds one email. It did this on every run, with the old image and the new one.claude-sonnet-5-5, and it correctly fails the answer: "the returned id m-2 suggests at least one other message". That's why the failures started at 0.9.1624.Fix: OpenCode's default model is now
anthropic/claude-sonnet-5-5, the model the hub already sets for pi and OpenHands. On the same task it lists the inbox with an empty query and gets all three emails, as Claude Code does. It also costs less per token: $2/$10 per million input/output tokens, against $3/$15.Testing
All runs were on Linux EC2 boxes in the agent-environments-admin account. Real turns used LiteLLM and cost about $20 in total. "Fixed image" means this branch; the comparison is
main.The gate's task run, with its own verifier (an agent judge plus the trajectory, no judge model set, the gate's prompt and criteria):
main's image and the image with only fix 1 both reply "1 email" and score 0.0, on every run.Bare
ubuntu:24.04with no trust lines (install.sh container, then "Respond with OK." over A2A, asinstall/v1does on a remote sandbox):main: every relayed call returned a 502 and the agent never answered.SSL_CERT_FILEpoints at certifi, and the agent replies "OK".Other install targets: on
python:3.12-slim(which has its own CAs), on a bare ubuntu whose trust lines name a bundle, and as a host install on the box,mainand the fixed tree write the sameSSL_CERT_FILE(or none), and the agent answers.Full A2A validator (
agent-env a2a-agent validate, local Docker): every extension result matchesmain, includinginstall/v1andclock/v1(synced, follows writes).Clock e2e (
tst/integration/task_step/test_agent_env_clock_local.py -k opencode): passes on both images.tst/integration/agent/opencode_env_date_test.pypasses 2 of 2.Clock chaos with real model turns. Each round deploys the
mailenv and the agent, arms the clock withrequire_agent_clock, and runs 13 scenarios:kill -9, restarted by supervisord, with writes waiting for it again;Every date turn has to echo a fresh nonce, so an answer copied from history doesn't pass.
main: 13/13 in 3 rounds.main's, and it didn't recur in 22 other rounds, including 6 run at the same time.Unit tests:
tst/unit/agents/opencodepasses.Not in this PR
install.shhas no CA fallback either. Hermes also still defaults toclaude-sonnet-4-6. Neither is in the promotion gate.COPYlayer. The staged build context sets every file's mtime to 1970. When a file is edited without changing its size (as with4-6to5-5here), BuildKit treats it as unchanged and keeps the cached layer. CI and release builds start without a local cache, so they're unaffected.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues were found.Summary
OpenCode installs now use certifi’s CA bundle when the target has no system bundle and no explicit
SSL_CERT_FILE.Reviews (3) · Last reviewed commit: "fix(agents): OpenCode's default model is..." · Reviewed by Greptile