Repository navigation
fix(sandbox): pin Gemini CLI to 0.59.0 - #4001
Conversation
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.
|
Independent review accepted and this PR was normally squash-merged at reviewed head 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. |
Why 0.59.0
The sandbox runtime pins Gemini CLI 0.49.0. Two upstream changes bound what the pin can move to:
packages/cli/src/config/settings.tsrefuses a system settings file unless it and every ancestor directory are owned by root and not group/other-writable (utils/security.ts)tale-gemini-runstages the per-exec settings as theagentuser under amkdtempin/tmp→ "Invalid auth method selected", exit 41 (verified with 0.62.0 in a session container)isFlashModel(endsWith('flash')) replaced by theisPromotableFlashModelallow-listNo 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.dynamicModelConfigurationfragment 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
mcpServersfiltered in restricted mode (#29099).Verified live (0.59.0 installed into a throwaway
tale-sandbox-runtimecontainer on the host network, uid 10001, against the dev gateway; temporary virtual keys, deleted afterwards)--help(--output-format,--approval-mode,--skip-trust,--include-directories,--resume,--model);…__deepseek__deepseek-flash/deepseek-flash, HTTP 200,result: success;run_shell_commandturn ondeepseek-v4-procompletes with the same stream-json shapes (init,message,tool_use,tool_result,result);~/.gemininamed incontext.fileNameis appended (a secret instruction in it is followed);--skip-trustyolo stays on andmcpServersfrom the system settings are loaded (a deliberately broken server is reported as an MCP issue, not filtered);maxSessionTurns: 1exits 53 with "Reached max session turns…", whichgemini-stream.tsmaps tomax-turns;--resume <uuid>reopens the session (samesession_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_VERSION0.49.0 → 0.59.0; the build'sgemini --versionsmoke andtests/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.tests/integration/container-sandbox-runtime-test.ts, buildstale-sandbox-runtime:contest): 89 passed, 0 failed — includinggemini --version runs,tale-gemini-run flags match the pinned gemini-cli --helpandpinned gemini-cli keeps a flash-suffixed --model with the harness settings; the built image reports0.59.0.