Add tests for logging utilities#377
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| assert record["node_id"] == "node-1" | ||
| assert record["action_id"] == "action-1" |
There was a problem hiding this comment.
Align node_id/action_id assertions with log_event behavior
These assertions assume log_event will copy node_id/action_id from the payload when the explicit args are omitted, but log_event currently initializes those keys to None and then uses record.setdefault(...), which does not overwrite existing keys. As a result, the emitted JSON line will keep node_id/action_id as null and this test will fail unless the production code is updated to override or the test passes node_id/action_id explicitly. Consider adjusting the test expectations or the logging logic to match the intended behavior.
Useful? React with 👍 / 👎.
Motivation
log_eventincludesworkflow_run_id,trace_id,span_id, and payload overrides fornode_id/action_id.log_llm_messagecorrectly serializes object-style messages includingtool_calls[].function.nameandarguments.Description
tests/test_logging_utils.pycontainingtest_configure_run_logging_sets_and_resets_run_id,test_use_trace_context_sets_current_and_resets,test_log_event_includes_context_and_payload_override, andtest_log_llm_message_serializes_tool_calls.capsysto capturestdoutJSONL output andtmp_pathto write temporary log files.configure_run_logging,use_trace_context,log_event, andlog_llm_message, and verify payload merging and trace context propagation.Testing
Codex Task