Skip to content

fix(runners): preserve caller container configuration when adopting response ID (#1988) - #2004

Open
iosayin wants to merge 1 commit into
anthropics:mainfrom
iosayin:fix/1988-runner-preserve-container
Open

iosayin wants to merge 1 commit into
anthropics:mainfrom
iosayin:fix/1988-runner-preserve-container

Conversation

@iosayin

@iosayin iosayin commented Oct 7, 2026

Copy link
Copy Markdown

Fixes #1988

Summary

Previously, both sync and async tool runners unconditionally set self._params["container"] = last_assistant_message.container.id. This had two negative side-effects:

  1. If the caller provided a dictionary with skills (e.g. {"skills": [...]}), adopting the server ID completely converted the parameter into a raw string, dropping the configured skills on subsequent turns.
  2. If the caller pinned an explicit container ID (or string), the response's container ID could overwrite the caller's explicit configuration.

Changes

  • Added helper _update_container_from_response in src/anthropic/lib/tools/_beta_runner.py:
    • If caller provided no container (or None), it sets the server container ID.
    • If caller provided a container dictionary, it adopts the server container ID under id while preserving any existing properties such as skills. If caller already had an explicit id, it preserves the caller's ID.
    • If caller provided an explicit string ID, it preserves the caller's pinned string ID.
  • Updated BaseSyncToolRunner and BaseAsyncToolRunner to invoke _update_container_from_response.
  • Added unit tests in tests/lib/tools/test_runners.py verifying that container skills and caller-pinned IDs are preserved across runner turns.

@iosayin
iosayin requested a review from a team as a code owner October 7, 2026 01:04

This branch has not been deployed

No deployments
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.

Tool runner replaces caller container settings with the response ID

1 participant