sandbox: do not flag expected not-found reads as errored spans#3890
sandbox: do not flag expected not-found reads as errored spans#3890knQzx wants to merge 1 commit into
Conversation
Let instrumented ops declare expected exceptions via expected_errors so a raised expected error is still recorded on the audit finish event but does not mark the trace span as errored. Apply it to read for WorkspaceReadNotFoundError, which a first-time lazy load_skill probe read triggers by design.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cd5523f14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @instrumented_op( | ||
| "read", | ||
| data=_read_start_data, | ||
| expected_errors=(WorkspaceReadNotFoundError,), |
There was a problem hiding this comment.
Keep direct read failures visible in traces
By putting WorkspaceReadNotFoundError on the read decorator, every failed session.read() that raises this error is treated as a non-error span, not just the lazy-skill existence probe. In a caller trace around await session.read(Path("missing.txt")) (and Docker also maps any non-zero cat read, such as permission denied, to this error), the operation still raises and the audit finish event has ok=False, but the trace contains no error, so direct sandbox read failures disappear from trace-based debugging. Make the suppression a per-probe/per-call opt-in instead of global to read.
Useful? React with 👍 / 👎.
|
Thanks for sharing this idea. The issue was resolved by #3893 |
summary
fixes #3889. LocalDirLazySkillSource.load_skill() probe reads a not yet materialized SKILL.md. the inner session correctly raises WorkspaceReadNotFoundError, load_skill catches it and proceeds, but the sandbox.read trace span was already marked errored by the instrumentation decorator, so a normal first time skill load surfaces a spurious errored span
this adds an expected_errors tuple to instrumented_op and _annotate. when a raised exception matches, the audit finish event still records it (retryability included) but the trace span is not flagged as errored, and the exception is re-raised unchanged. read declares WorkspaceReadNotFoundError as expected
one scope decision worth confirming: declaring this on the read op means it applies to every read, so a direct session.read() of a missing file also stops producing an errored span, though the audit event still records it. that felt right to me since a not found read is an expected, recoverable condition rather than a sandbox failure, but if you would rather keep direct reads visibly errored and only silence the load_skill probe i can switch to a per-call opt-in instead
test plan
closes #3889