Repository navigation
Conversation
|
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. |
input() only supports arrow keys and history once the readline module is imported, and the CLI never imported it. Pressing arrow up in `adk run` printed `^[[A` instead of recalling the previous message. Import readline when the interactive session starts. Skip it where readline is unavailable, such as Windows.
Stephnn0
force-pushed
the
fix/cli-input-history
branch
from
November 12, 2026 10:10
d2720f7 to
4772120
Compare
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.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
adk rundoes not support arrow keys or input history #8022Problem:
adk runreads user input withinput(), which only supports arrow keys and history oncereadlineis imported. The CLI never imported it, so pressing arrow up printed^[[Aand sent the raw escape sequence to the agent.Solution:
Add
_enable_line_editing(), which importsreadlineand is called at the start ofrun_interactively. Wherereadlineis unavailable (Windows), it does nothing.Testing Plan
Unit Tests:
Added three tests in
tests/unittests/cli/utils/test_cli.py:test_enable_line_editing_imports_readlinetest_enable_line_editing_without_readlinetest_run_interactively_enables_line_editingWith the fix removed,
test_enable_line_editing_imports_readlineandtest_run_interactively_enables_line_editingfail.Manual End-to-End (E2E) Tests:
Ran the CLI input path in a pseudo-terminal: typed
hello+ Enter, then arrow up + Enter, and printed the two valuesinput()returned.Checklist
Additional context
adk run --reload_agentsreads input throughsys.stdin.readline()in a background thread, so it is not covered by this change. It can be handled in a follow-up if wanted.🤖 Generated with Claude Code
https://claude.ai/code/session_01SXKq7AVswkhFGAQZqanCsM