Repository navigation
fix(runners): hide thoughts from nonverbose debug output - #7452
Closed
BlueRaddish wants to merge 1 commit into
Closed
BlueRaddish wants to merge 1 commit into
BlueRaddish wants to merge 1 commit into
Conversation
Keep thought text out of run_debug's final-response display while preserving verbose output and all parts in returned events. Assisted-by: OpenAI Codex
6 tasks done
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 8, 2026
Merge #7452 print_event() and Runner.run_debug() now skip Part(thought=True) text when verbose=False instead of printing it alongside the final response. PiperOrigin-RevId: 995933316
Collaborator
|
Thank you @BlueRaddish for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 53cb763. Closing this PR as the changes are now in the main branch. |
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
Problem:
InMemoryRunner.run_debug(verbose=False)promises output showing only final agent responses, but the shared event printer includesPart(thought=True)text. A response containing a thought followed by an answer is printed astest_agent > thinking answer; a thought-only event is also printed.Solution: Skip thought parts in nonverbose output. Preserve the existing verbose output for debugging and retain all original parts in the events returned by
run_debug. No model configuration, session persistence, or event serialization changes.Reproduction: A deterministic
BaseAgentyields anEventwith a thought part followed by an answer part. Running it with the publicInMemoryRunner.run_debugentry point prints the thought on the base revision; the same invocation with this change prints onlytest_agent > answer. No inference service or external network is involved.Testing Plan
Unit Tests:
python -m pytest tests/unittests/utils/test_debug_output.py tests/unittests/test_runners.py -k 'print_event or run_debug' -qResult: 20 passed, 182 deselected. Before the fix, the printer tests had 2 failed, 15 passed, and the public runner tests had 1 failed, 2 passed. Coverage includes a mixed thought/answer event, a thought-only event, verbose output, and preservation of the thought in returned events. The full ADK suite was not run.
Manual End-to-End (E2E) Tests: The two parameterized
test_run_debug_hides_thoughts_unless_verbosecases execute the real public runner, a deterministic customBaseAgent, and real in-memory session services. They exercise both console modes without mocking the printer or running a model. The nonverbose case failed on the base revision and passes after the fix.All repository pre-commit hooks passed on the exact diff in a native Linux checkout of the same base revision. Windows tests use Python 3.13; no paid compute or model calls were used.
Checklist
Additional context
Prepared with assistance from OpenAI Codex. This is a console verbosity fix, not a claim that debug output is a security boundary. Verbose mode intentionally continues to display the existing thought text.