This week in Claude Code · Jun 7, 2026
Claude Builder Weekly: Fallback Models, Middleware Support & Agent SDK Hardening
Get the next issue in your inbox. Weekly · Free
A massive Claude Code v2.1.166 drop adds configurable fallback models (up to three), glob-pattern deny rules, hardened cross-session messaging security, and thinking-mode controls — plus 20+ bug fixes. The TypeScript SDK v0.101.0/v0.102.0 lands middleware support across all cloud flavors and ships Managed Agents type updates. Agent SDK releases (TS v0.3.162–v0.3.168, Python v0.2.88–v0.2.93) tighten refusal detection, idempotent initialization, and MCP runtime server injection. Claude Opus 4.1 is now marked deprecated in all cloud SDKs. Upgrade to the latest Claude Code and SDK versions now to stay on supported tooling.
API & Model Updates
TypeScript SDK v0.102.0: Managed Agents Type Updates & Middleware Fix
- Released 2026-06-06, this minor bump ships small but breaking type changes to Managed Agents alongside the middleware-before-signing bug fix that also landed in the cloud SDKs.
TypeScript SDK v0.101.0: Middleware Support, Streaming Fixes & Timeout Scoping
- Released 2026-06-05, this release adds a first-class middleware hook for intercepting requests, fixes request timeouts to scope only to the inner fetch (not the full middleware chain), and corrects stop_details propagation and scientific-notation JSON parsing in streaming.
Bedrock SDK v0.30.0/v0.30.1: Middleware & Claude Opus 4.1 Deprecated
- Released 2026-06-05–06, the Bedrock TypeScript SDK gains middleware support, marks Claude Opus 4.1 as deprecated, and patches middleware running before request signing.
AWS SDK v0.4.0/v0.4.1: Middleware Support & Opus 4.1 Deprecation
- Released 2026-06-05–06, the AWS-flavor TypeScript SDK adds middleware support, deprecates Claude Opus 4.1, and fixes middleware ordering relative to request signing.
Vertex SDK v0.17.0: Middleware & Claude Opus 4.1 Deprecated
- Released 2026-06-05, the Vertex TypeScript SDK lands middleware support and marks Claude Opus 4.1 deprecated, matching parity with other cloud flavors.
Foundry SDK v0.3.0: Middleware & Claude Opus 4.1 Deprecated
- Released 2026-06-05, the Foundry TypeScript SDK receives middleware support and deprecates Claude Opus 4.1 in line with all other cloud SDK variants.
Claude Code & CLI
Claude Code v2.1.166: Fallback Models, Glob Deny Rules & Cross-Session Security
- The headline release of this cycle adds `fallbackModel` config for up to three ordered fallback models on overload, glob-pattern support in deny rules (`"*"` blocks all tools), hardened cross-session messaging that strips user authority from relayed `SendMessage` requests, and the ability to disable thinking via `MAX_THINKING_TOKENS=0`.
- Also fixes 20+ bugs spanning JetBrains flickering, Kitty keyboard protocol drops, Windows PowerShell hangs, and more.
Editor’s read: Must-read: fallback model config and the cross-session security hardening are both production-critical for multi-agent deployments.
Claude Code v2.1.163: Version Range Enforcement, `/plugin list` & Hook `additionalContext`
- Admins can now enforce `requiredMinimumVersion`/`requiredMaximumVersion` in managed settings, blocking out-of-range Claude Code installs at startup.
- Stop/SubagentStop hooks gain `additionalContext` to keep a turn alive without triggering a hook error.
Claude Code v2.1.162: `claude agents --json` `waitingFor` Field & Wide-Terminal Fixes
- The `claude agents --json` output now includes a `waitingFor` field showing exactly what a blocked session is waiting on (e.g.
- a permission prompt).
- Numerous `claude agents` UI fixes address truncated status text on wide terminals and Ctrl+V image paste.
Claude Code v2.1.161: OTEL Custom Dimensions & Parallel Tool Call Independence
- OTEL `RESOURCE_ATTRIBUTES` values are now propagated as metric labels for slicing usage by team or repo.
- A failed Bash command in a parallel batch no longer cancels sibling tool calls — each returns its own result.
Claude Code v2.1.160: Shell Startup File Write Prompt & `ultracode` Rename
- Claude Code now prompts before writing to shell startup files or build-tool configs that grant code execution.
- The dynamic-workflow trigger keyword is renamed from `workflow` to `ultracode`; the old keyword is now a no-op.
Agent SDK & Managed Agents
Claude Agent SDK TypeScript v0.3.166: MCP Runtime Server Injection Fixed
- Fixed MCP resource tools not being injected for servers added at runtime via the `mcp_set_servers` control request — a critical correctness fix for dynamic MCP topologies.
Claude Agent SDK TypeScript v0.3.163: `stop_task` Idempotency & Hook `additionalContext`
- `stop_task` now returns success when the target task is already gone, enabling reliable pruning of stale task chips.
- Stop and SubagentStop hooks support `additionalContext` in `hookSpecificOutput` for non-error turn continuation.
Claude Agent SDK TypeScript v0.3.162: Refusal Detection via `stop_reason` & Search Tool Defaults
- Refusal responses now carry `stop_reason: "refusal"` and `stop_details` on the assistant message, removing the need for error-text matching.
- SDK sessions on native builds now default to embedded find/grep instead of registering dedicated Grep/Glob tools.
Claude Agent SDK TypeScript v0.3.161: Idempotent `initialize` & Live Agent Switching
- A second `initialize` control request now returns the same success payload instead of an error.
- `applyFlagSettings` supports live agent switching mid-session — pass `null` to reset to the default agent.
Claude Agent SDK TypeScript v0.3.160: Abort-During-Hook No Longer Hangs
- Fixed SDK hook callbacks swallowing abort signals — aborting during a PostToolUse hook now cleanly ends the turn with a final `result` message rather than hanging the calling process.
Claude Agent SDK Python v0.2.88: Trio Compatibility for Session Stores
- Fixed a crash (`TypeError: trio.run received unrecognized yield message`) when using `session_store=` with `query()` or `ClaudeSDKClient` under trio — all session-store code paths are now ported to anyio.
Claude Agent SDK Python v0.2.91: Anyio Test Suite (asyncio + trio CI Coverage)
- Switched the test suite from `pytest-asyncio` to anyio's pytest plugin, running every async test under both asyncio and trio backends to catch backend-specific regressions in CI.
MCP Ecosystem
Claude Code v2.1.162: Sub-1000ms MCP Tool Timeout Floor Removed
- MCP per-server `timeout` values below 1000 ms were previously floored to a 1-second watchdog that aborted every tool call; sub-1000 ms values now fall back gracefully to `MCP_TOOL_TIMEOUT` or the default, and `claude mcp get` annotates them.
Claude Code v2.1.161: `/mcp` Hides Unused claude.ai Connectors
- The `/mcp` panel now collapses claude.ai connectors you've never signed into behind a 'Show unused connectors' row, reducing noise in the MCP configuration view.
Action Items
Immediate
- Upgrade Claude Code to v2.1.168 (`claude update`) — picks up fallback model config, cross-session security hardening, glob deny rules, and 20+ bug fixes from the v2.1.166 milestone.
- Update the TypeScript SDK to v0.102.0 (`npm install @anthropic-ai/claude-agent-sdk@0.3.168`) for Managed Agents type parity and the middleware-before-signing fix.
- Update the Python Agent SDK to v0.2.93 (`pip install claude-agent-sdk==0.2.93`) to stay current with CLI v2.1.168.
- Audit any code that detects refusals by matching error text — migrate to checking `stop_reason: "refusal"` as provided in Agent SDK TS v0.3.162+.
- If you use `session_store=` with trio, upgrade to Python Agent SDK v0.2.88+ immediately to resolve the anyio crash.
- Review managed-settings configs: `allowedMcpServers`/`deniedMcpServers` `${VAR}` references now work correctly (fixed in v2.1.166); re-test any policy that relied on them.
- Begin migrating off Claude Opus 4.1 — all TypeScript cloud SDKs (Bedrock, AWS, Vertex, Foundry, core) now mark it deprecated.
- If you depend on dynamic-workflow trigger keyword `workflow`, rename usages to `ultracode` following the v2.1.160 rename.
- Review any PostToolUse hook implementations for abort-signal handling — upgrade to Agent SDK TS v0.3.160+ to prevent hanging on abort.
- If you run Claude Code via managed settings with version enforcement, configure `requiredMinimumVersion`/`requiredMaximumVersion` in your org policy using the new fields from v2.1.163.
All Resources
- Claude Code v2.1.168 Release Notes
- Claude Code v2.1.166: Fallback Models & Security
- Claude Code v2.1.163: Version Enforcement & Hook additionalContext
- Claude Code v2.1.162: agents --json waitingFor
- Claude Code v2.1.161: OTEL Dimensions & Parallel Tools
- Claude Code v2.1.160: Shell Write Prompt & ultracode Rename
- Claude Code v2.1.159 Release Notes
- Claude Code v2.1.167 Release Notes
- Claude Code v2.1.165 Release Notes
- Agent SDK TypeScript v0.3.168
- Agent SDK TypeScript v0.3.166: MCP Runtime Injection Fix
- Agent SDK TypeScript v0.3.163: stop_task Idempotency
- Agent SDK TypeScript v0.3.162: Refusal stop_reason
- Agent SDK TypeScript v0.3.161: Idempotent initialize
- Agent SDK TypeScript v0.3.160: Hook Abort Fix
- Agent SDK Python v0.2.93 (PyPI)
- Agent SDK Python v0.2.91: anyio Test Suite
- Agent SDK Python v0.2.88: Trio Session Store Fix
- Anthropic TypeScript SDK v0.102.0: Managed Agents Types
- Anthropic TypeScript SDK v0.101.0: Middleware Support
- Bedrock SDK v0.30.1
- AWS SDK v0.4.1
- Vertex SDK v0.17.0
- Foundry SDK v0.3.0
This week in Claude Code
Five minutes, every Monday — the tools, releases and tactics for shipping solo.