Repository navigation
fix(agent): restore shell in sandbox-less hosts and stabilize prompt prefix - #742
Closed
delete-cloud wants to merge 4 commits into
Closed
delete-cloud wants to merge 4 commits into
delete-cloud wants to merge 4 commits into
Conversation
…prefix Two eval-blocking fixes: - shell: honor AGENT_SANDBOX_MODE / AGENT_SHELL_ADDITIONAL_ROOTS env overrides at the pipeline shell-config merge point. Eval/benchmark containers ship no bubblewrap, so sandbox_mode=native failed closed and bash_run was dead. The env contract lets hosts that already provide the isolation boundary select "none" explicitly instead of degrading silently. - context: append grounding blocks at the message tail instead of before the last user message. Grounding carries per-call volatile fields (elapsed_seconds, active approvals, runtime messages); at position ~1 it invalidated the whole prompt prefix for provider-side caching (7.5% hit rate vs 67-88% baselines). Tail placement keeps the conversation prefix stable; grounding remains part of the always-fresh tail. Model: swe-2-max Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Review feedback (confer/codex): the env override wrote shell_config, but _resolve_additional_workspace_roots prefers pipeline-level additional_workspace_roots — including an empty list — so the env contract was silently shadowed whenever pipeline roots were set. Resolve the env list at the final precedence point instead so it wins over both config layers. PM-0029 also records the system-merging-provider limitation (anthropic/codex_responses hoist volatile grounding into instructions; openai-compatible paths are unaffected). Model: swe-2-max Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Review feedback (confer/grok): document that AGENT_SANDBOX_MODE / AGENT_SHELL_ADDITIONAL_ROOTS are escape hatches for pre-isolated hosts that disable the jail/path fencing, warn once when they take effect, and trim grounding-position comments to the invariant (history lives in PM-0029). Model: swe-2-max Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Kimi's coding endpoint hard-rejects malformed tool history: a tool message whose tool_call_id is absent from every assistant tool_calls entry, or an assistant tool_calls message not immediately followed by results for each call. Eval trials died on this at ~30 model calls. Three defects produced those wire shapes: - SummarizerPlugin.resolve_context_window could open the context window inside a tool_call/tool_result group (split at len - keep_recent), orphaning results whose calls were folded away. Boundaries now back off to the start of the enclosing group. - tool_call entries and rejection tool_result entries were appended in one per-call loop, so an invalid mid-list call interleaved a result inside the call group, producing adjacent assistant tool_calls messages. All call entries are now appended before any rejection results. - Streamed tool_call ids were captured only on the first delta per index. Providers emitting the id later (or never) yielded empty tool_call_ids. Ids are now updated on every delta and a stable fallback id is synthesized when none arrives. Adds PM-0030 covering the failure class. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.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.
Summary
Fixes two eval-blocking defects found in the 2026-09-17 benchmark run (6/30, 20%):
sandbox_mode=nativerequiresbwrap; eval task containers ship without it, sobash_runfailed closed (DeepSWE 0/9, all empty patches). Adds explicit env contractAGENT_SANDBOX_MODE/AGENT_SHELL_ADDITIONAL_ROOTSapplied at the pipeline shell-config merge point, so hosts that already provide an isolation boundary (per-trial container + egress allowlist) can selectnoneinstead of silently degrading.grounding_insert_indexnow appends at the message tail, keeping the conversation prefix stable.Changes
coding_agent/tools/shell.py: env overrides at final config merge; invalid values still fail via_sandbox_mode().agentkit/context/builder.py:grounding_insert_index()returnslen(core_messages); incrementalpatch_messagesbookkeeping (grounding_start/count) stays consistent under tail placement.PM-0029.Test plan
uv run pytest tests/agentkit/context tests/agentkit/test_incremental_context.py tests/agentkit/runtime tests/tools/test_shell.py— 246 passAGENT_SANDBOX_MODE=none AGENT_SHELL_ADDITIONAL_ROOTS=/+ no bwrap → shell executesGenerated with Devin