feat(plugins): add BQAA tests and view columns for AGENT_ERROR / INVOCATION_ERROR#5047
Closed
caohy1988 wants to merge 3 commits intogoogle:mainfrom
Closed
feat(plugins): add BQAA tests and view columns for AGENT_ERROR / INVOCATION_ERROR#5047caohy1988 wants to merge 3 commits intogoogle:mainfrom
caohy1988 wants to merge 3 commits intogoogle:mainfrom
Conversation
Implements RFC google#5044 to close the error callback coverage gap at the agent and runner levels. Previously, unhandled exceptions escaping agent execution or runner execution left dangling *_STARTING events with no terminal error event. Changes: - Add on_agent_error_callback and on_run_error_callback to BasePlugin (notification-only, exception always re-raised) - Wire try/except Exception in BaseAgent.run_async() and run_live() - Wire try/except Exception in Runner._exec_with_plugin() - Add AGENT_ERROR and INVOCATION_ERROR event types to BigQueryAgentAnalyticsPlugin with traceback capture and cleanup - Keep after_agent_callback and after_run_callback as success-only (no semantic change to existing callbacks) - Catch Exception (not BaseException) to exclude CancelledError/ KeyboardInterrupt from error callback dispatch Closes google#4863 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Error callbacks are documented as notification-only (all plugins must be notified), but were dispatched through _run_callbacks() which short-circuits on the first non-None return. A buggy plugin returning a value would prevent subsequent plugins from seeing the error. Add _run_notification_callbacks() that always iterates all plugins regardless of return values, and switch run_on_agent_error_callback() and run_on_run_error_callback() to use it. Update tests to assert both plugins are always called even when one returns non-None. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Follow-up to google#5045. Adds BQ plugin-specific test coverage and enriches the analytics views for AGENT_ERROR and INVOCATION_ERROR events. Changes: - Add error_traceback column extraction to v_agent_error and v_invocation_error views (JSON_VALUE from content field) - Add test_on_agent_error_callback_logs_correctly: verifies AGENT_ERROR event is logged with correct error_message, status, and traceback - Add test_on_run_error_callback_logs_correctly: verifies INVOCATION_ERROR event is logged with correct fields - Add TestRunErrorCallbackCleanupSafety: verifies TraceManager cleanup runs even when _log_event raises during on_run_error_callback - Add test_error_views_contain_traceback_column: verifies view SQL includes error_traceback extraction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #5045. Adds BigQuery Agent Analytics Plugin test coverage and enriches the analytics views for the new
AGENT_ERRORandINVOCATION_ERRORevent types.Depends on: #5045 (must merge first)
Changes
View column enrichment (
bigquery_agent_analytics_plugin.py):v_agent_errorview now extractserror_tracebackfrom content JSON +total_msfrom latencyv_invocation_errorview now extractserror_tracebackfrom content JSONNew tests (
test_bigquery_agent_analytics_plugin.py, 4 tests):test_on_agent_error_callback_logs_correctlyerror_message,status="ERROR", anderror_tracebackin contenttest_on_run_error_callback_logs_correctlyTestRunErrorCallbackCleanupSafety_log_eventraises duringon_run_error_callbacktest_error_views_contain_traceback_columnerror_tracebackextractionTest plan
🤖 Generated with Claude Code