Skip to content

fix(sandbox): preserve falsey instrumentation instances - #4304

Closed
adityasingh2400 wants to merge 1 commit into
openai:mainfrom
adityasingh2400:fix-falsey-instrumentation
Closed

fix(sandbox): preserve falsey instrumentation instances#4304
adityasingh2400 wants to merge 1 commit into
openai:mainfrom
adityasingh2400:fix-falsey-instrumentation

Conversation

@adityasingh2400

Copy link
Copy Markdown
Contributor

Summary

The sandbox sessions defaulted their instrumentation with instrumentation or Instrumentation(), so a caller-supplied instance that is falsey was silently discarded and replaced with a fresh default. Instrumentation is a public constructor parameter on every sandbox session and is exported from agents.sandbox.session, so a subclass that defines __bool__ is a supported input.

This applies the same treatment #4286 and #4299 used for the realtime model and the compaction decision hooks, extending it to the ten remaining sites.

Test plan

New test in tests/sandbox/test_session_sinks.py constructing a SandboxSession with a falsey Instrumentation subclass and asserting the instance is preserved. It fails on main because a different object is substituted. make lint is clean. make typecheck was not run to completion locally, though the change preserves the declared type.

@seratch

seratch commented Aug 8, 2026

Copy link
Copy Markdown
Member

As I mentioned at #4299 (review), we no longer accept the similar changes.

@seratch seratch closed this Aug 8, 2026
@adityasingh2400

Copy link
Copy Markdown
Contributor Author

Understood, and sorry for the noise. I had not seen your note on #4299 when this went up. Holding off on this class entirely until your detection lands.

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.

2 participants