Skip to content

Avoid noisy failed trace span for expected not-found SKILL.md during lazy skill probe (fixes #3889)#3892

Closed
MuhammadUsman-Khan wants to merge 1 commit into
openai:mainfrom
MuhammadUsman-Khan:fix/skills-lazy-probe-unwrap
Closed

Avoid noisy failed trace span for expected not-found SKILL.md during lazy skill probe (fixes #3889)#3892
MuhammadUsman-Khan wants to merge 1 commit into
openai:mainfrom
MuhammadUsman-Khan:fix/skills-lazy-probe-unwrap

Conversation

@MuhammadUsman-Khan

@MuhammadUsman-Khan MuhammadUsman-Khan commented Jul 20, 2026

Copy link
Copy Markdown

Summary

Avoid noisy failed trace span for expected not-found SKILL.md during lazy skill probe.

Fixes #3889

Root cause: LocalDirLazySkillSource.load_skill used the instrumented SandboxSession.read() to probe for SKILL.md. On first lazy load this probe raises WorkspaceReadNotFoundError (expected) and the instrumentation recorded a failed child span even though the exception is handled and the overall load succeeds.

Solution: For the existence probe only, unwrap a SandboxSession wrapper (if present) to get the underlying BaseSandboxSession and call its read() directly. This prevents the expected handled-not-found from being recorded as an error span. The change is tiny and contained to src/agents/sandbox/capabilities/skills.py.

Files changed:

  • src/agents/sandbox/capabilities/skills.py
  • tests/test_lazy_skill_probe_unwrap.py (new)

Testing performed:

  • Added unit test to ensure load_skill proceeds when the inner session read raises FileNotFoundError.
  • Recommend running the issue reporter's repro to verify traces no longer show the error span.

Limitations / follow-up:

  • The defensive unwrap relies on the wrapper exposing _inner and matching the wrapper type name/module. This matches the approach used in other parts of the repo (session sinks).
  • If other probes or reads should avoid instrumentation, apply the same pattern selectively.

@MuhammadUsman-Khan
MuhammadUsman-Khan marked this pull request as draft July 20, 2026 09:38
@MuhammadUsman-Khan
MuhammadUsman-Khan marked this pull request as ready for review July 20, 2026 09:38
@seratch

seratch commented Jul 20, 2026

Copy link
Copy Markdown
Member

Thanks for sharing this idea. The issue was resolved by #3893

@seratch seratch closed this Jul 20, 2026
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.

Lazy skill first load records expected WorkspaceReadNotFoundError as a failed span

2 participants