← Back to the briefs
Coding

Anthropic fixes subagent worktree cleanup and runner handling in Claude Code v2.1.311

Anthropic Claude Code v2.1.311 adds idle process controls for self-hosted runners and fixes bugs affecting subagent worktree retention, delayed MCP server connections, memory file staleness, and sandboxed Bash commands.

Subagent coordination and worktree isolation

The v2.1.311 update resolves several synchronization flaws in nested agent execution. Isolated Git worktrees generated for subagents previously faced premature cleanup while background subagents spawned within them continued working. The release prevents those worktrees from being deleted before child processes complete their tasks.

Subagents also gain reliable tool access when using Model Context Protocol integrations. Previous builds prevented subagents from accessing MCP tools if the target servers finalized connections after the agent process started. In addition, the engine corrects SubagentStop hooks, ensuring termination signals fire once at completion rather than repeatedly during execution.

Runner resilience and memory compaction

For self-hosted runner infrastructure, the update introduces idle hold parameters that prevent host sessions from closing while external host processes run. Runners also handle repository startup barriers more gracefully by continuing even when rate limits block secondary read-only repositories.

Context compaction workflows receive reliability adjustments. Standard-context sessions that exceed 200,000 tokens now compact history and proceed instead of halting with billing credit notifications. The compaction mechanism also avoids referencing outdated memory and guidance files modified earlier in the active session, while sandboxed command execution fixes address Linux container boundaries.

Our assessment

Teams running autonomous subagent graphs should audit their lifecycle hooks and check whether background agent tasks suffered from early worktree pruning. Operators deploying self-hosted runners can configure idle hold flags to ensure long-running host operations do not terminate mid-turn. Furthermore, administrators relying on dynamic MCP connections should verify that secondary workers successfully discover tools exposed by late-starting servers.

Source: Anthropic original publication.

Original source

Read the original material

Anthropic (opens in a new tab)

The article date belongs to Agentic Horizon. The source publication date is listed separately. Vendor claims remain attributed; we have not independently tested the reported capability.

Search the publication

Find a story by title, topic, or keyword.

Press Escape to close

Ask HorizonYour site guide
Your guide to the publication

Ask Horizon.

Ask a question about the publication.

Privacy