Skip to content

fix(sandbox): pin Gemini CLI to 0.59.0 - #4001

Merged
yannickmonney merged 3 commits into
mainfrom
fix/gemini-cli-pin-0-59
Sep 30, 2026
Merged

yannickmonney merged 3 commits into
mainfrom
fix/gemini-cli-pin-0-59

Conversation

@larryro

@larryro larryro commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Why 0.59.0

The sandbox runtime pins Gemini CLI 0.49.0. Two upstream changes bound what the pin can move to:

release change effect on the harness
0.60.0 packages/cli/src/config/settings.ts refuses a system settings file unless it and every ancestor directory are owned by root and not group/other-writable (utils/security.ts) tale-gemini-run stages the per-exec settings as the agent user under a mkdtemp in /tmp → "Invalid auth method selected", exit 41 (verified with 0.62.0 in a session container)
0.61.0 isFlashModel (endsWith('flash')) replaced by the isPromotableFlashModel allow-list the flash-suffixed rewrite that #3998 works around is gone

No release has the fix without the check, so 0.59.0 is the last pin the wrapper takes unchanged. Moving past 0.60 needs the settings staging split into a root-owned system tier (baked into the image) and a per-exec user tier — separate work. The experimental.dynamicModelConfiguration fragment from #3998 stays needed on 0.59.0 (verified below), and its container guard's control run keeps asserting the rewrite exists.

What 0.49 → 0.59 brings (121 commits)

The tool-loop reliability fixes the harness lane leans on: coalesced consecutive roles and grouped cancelled tool responses so a replayed history stops 400-ing (#28407), ReAct/prompt-injection loop mitigation (#28429), capacity-exhaustion classified as terminal plus context-aware silent retries (#28599, #28790), tool-response turns no longer lost or fused (#28700, #28892, #28672), MCP OAuth refresh with the stored client id (#28481), SSRF fix in MCP OAuth discovery (#29081), fail-closed workspace trust with mcpServers filtered in restricted mode (#29099).

Verified live (0.59.0 installed into a throwaway tale-sandbox-runtime container on the host network, uid 10001, against the dev gateway; temporary virtual keys, deleted afterwards)

  • every long flag the wrapper passes is in --help (--output-format, --approval-mode, --skip-trust, --include-directories, --resume, --model);
  • a flash-suffixed managed id with the harness settings reaches the gateway as …__deepseek__deepseek-flash/deepseek-flash, HTTP 200, result: success;
  • a run_shell_command turn on deepseek-v4-pro completes with the same stream-json shapes (init, message, tool_use, tool_result, result);
  • a per-exec context file under ~/.gemini named in context.fileName is appended (a secret instruction in it is followed);
  • with --skip-trust yolo stays on and mcpServers from the system settings are loaded (a deliberately broken server is reported as an MCP issue, not filtered);
  • maxSessionTurns: 1 exits 53 with "Reached max session turns…", which gemini-stream.ts maps to max-turns;
  • --resume <uuid> reopens the session (same session_id).

One thing does not work on either version: resuming a conversation whose history holds a tool call fails on the first model call with DeepSeek's 400 "Messages with role 'tool' must be a response to a preceding message with 'tool_calls'" — identical on 0.49.0, so it is the gateway's GenAI→chat-completions replay for a chat-only custom record, not a CLI regression. Tracked separately.

Gates

  • services/sandbox-runtime/Dockerfile: GEMINI_CLI_VERSION 0.49.0 → 0.59.0; the build's gemini --version smoke and tests/integration/container-sandbox-runtime-test.ts (wrapper flags vs the pinned --help, gemini --version, and with fix(platform): keep a flash-suffixed model id on Gemini CLI runs #3998 the model-id guard) cover the pin.
  • tale-gemini-run's three "verified" notes name the new pin; the behaviours they describe were re-verified above.
  • The fix(platform): keep a flash-suffixed model id on Gemini CLI runs #3998 comments that said "the pinned CLI (0.49.0) rewrites…" now say "every release before 0.61.0", so the bump does not leave them stale (harness.yml, exec-builder.test.ts, the container guard).
  • Local: the full runtime image test against a fresh build from this branch (tests/integration/container-sandbox-runtime-test.ts, builds tale-sandbox-runtime:contest): 89 passed, 0 failed — including gemini --version runs, tale-gemini-run flags match the pinned gemini-cli --help and pinned gemini-cli keeps a flash-suffixed --model with the harness settings; the built image reports 0.59.0.

Move the sandbox runtime's Gemini CLI from 0.49.0 to 0.59.0, the last
release that still loads a per-exec system settings file: 0.60.0 requires
the system settings file and every ancestor directory to be owned by
root, which tale-gemini-run cannot satisfy as the agent user, and 0.61.0
is where the flash-suffixed model rewrite is fixed upstream — no release
has both, so 0.59.0 is the pin the wrapper can take unchanged.

The ten releases in between carry the tool-loop reliability fixes the
harness lane leans on: coalesced roles and grouped cancelled tool
responses (no more 400s on replay), ReAct loop mitigation, capacity-error
retry handling, tool-response turn fixes, MCP OAuth refresh and the
fail-closed workspace trust.

Verified live against the dev gateway with 0.59.0 in a throwaway runtime
container: every wrapper flag still exists; a flash-suffixed managed id
with the harness settings reaches the gateway verbatim and completes; a
shell-tool turn streams the same stream-json shapes; a per-exec context
file under ~/.gemini named in context.fileName is appended; yolo stays
on and mcpServers load under --skip-trust; maxSessionTurns exits 53
with the message the parser maps to max-turns. The wrapper's "verified"
notes name the new pin.
@yannickmonney
yannickmonney merged commit ed31183 into main Sep 30, 2026
76 checks passed
@yannickmonney
yannickmonney deleted the fix/gemini-cli-pin-0-59 branch September 30, 2026 16:43
@yannickmonney

Copy link
Copy Markdown
Contributor

Independent review accepted and this PR was normally squash-merged at reviewed head 079f38fa4dd97d3d1b7b24ac3f8f0c64e333ded8 as ed31183c3913dd05d857b4f17aff6e6db4fc1609 (16:43:11 UTC, 30 September). Its whole merged tree exactly equals the reviewed and CI-tested b76c147d tree; the accepted main Docker install correction remains intact.

All seven normal workflows succeeded: 61 successful checks, 14 scope-explained skips and one advisory neutral Trivy result. The full platform typecheck actually executed after the heap repair. The strict database suite passed 1,219/1,219 checks across 206/206 lanes, with zero skips/failures. Current digest-bound image validation passed 40/40, sandbox runtime 89/89 and smoke 29/29. The sandbox build actually installed Gemini0.59.0 and ran its version command.

Evidence: Checks, Build and image/runtime verification, E2E.

Limits stay explicit: the inert HTTP400 model stand-ins establish wrapper/settings/skill-request behavior, not successful live-provider, resumed-tool-loop or OAuth/keychain behavior. Both scans and SARIF uploads succeeded, but the platform result-processing wait timed out and the neutral comparison remains incomplete. The shipping Docker pruner is non-frozen; it is distinct from the hosted frozen root install. No policy was relaxed. This accepts this source/normal CI, not a subsequent release or deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants