-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix(logging): keep verbose openai.agents DEBUG off sandbox stdout #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,10 +122,17 @@ def setup_scan_logging(run_dir: Path, *, debug: bool | None = None) -> Callable[ | |
| setattr(stream_handler, _HANDLER_TAG, True) | ||
|
|
||
| tracked_loggers = [logging.getLogger(name) for name in _TRACKED_ROOTS] | ||
| for tracked in tracked_loggers: | ||
| for name, tracked in zip(_TRACKED_ROOTS, tracked_loggers): | ||
| tracked.setLevel(logging.DEBUG) | ||
| tracked.addHandler(file_handler) | ||
| tracked.addHandler(stream_handler) | ||
| # The openai-agents SDK emits one DEBUG record per span / function-call | ||
| # / reasoning-item. Routing that to stdout -- which Docker's json-file | ||
| # driver captures without rotation -- can grow the sandbox container log | ||
| # to tens of GB and exhaust the host disk on long runs. Keep its verbose | ||
| # DEBUG in the per-scan strix.log file only; stdout stays on Strix's own | ||
| # logger. | ||
| if name != "openai.agents": | ||
| tracked.addHandler(stream_handler) | ||
|
Comment on lines
+134
to
+135
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The guard Consider attaching the stream_handler unconditionally and instead raising its floor for Prompt To Fix With AIThis is a comment left during a code review.
Path: strix/telemetry/logging.py
Line: 134-135
Comment:
**ERROR/WARNING from `openai.agents` also silenced on stdout**
The guard `if name != "openai.agents"` removes the stream handler entirely, not just at DEBUG level. In production mode (`debug=False`) the stream handler runs at `ERROR`, meaning that before this change `openai.agents` ERROR records did reach stdout; after it they go only to `strix.log`. The PR description focuses on the DEBUG flood, but this is a silent secondary behaviour change. If operators or external monitors tail stdout for SDK errors (API failures, auth issues, etc.) they'll now miss them.
Consider attaching the stream_handler unconditionally and instead raising its floor for `openai.agents` to `WARNING` (or `ERROR`) to stop the DEBUG flood while keeping higher-severity signals visible on stdout.
How can I resolve this? If you propose a fix, please make it concise. |
||
| tracked.propagate = False | ||
|
|
||
| for name in _NOISY_LIBS: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_TRACKED_ROOTSThe string
"openai.agents"appears only at the call site, disconnected from the_TRACKED_ROOTSdefinition at line 64. If a future contributor adds another chatty SDK to_TRACKED_ROOTS, there's no signal that this exclusion logic exists. A small named constant (e.g._STDOUT_EXCLUDED_ROOTS: frozenset[str] = frozenset({"openai.agents"})) defined next to_TRACKED_ROOTSwould keep the two declarations together and make the intent discoverable.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!