Repository navigation
feat(runner): support steering active LLM invocations - #1932
Draft
zhangxiangnan wants to merge 2 commits into
Draft
zhangxiangnan wants to merge 2 commits into
zhangxiangnan wants to merge 2 commits into
Conversation
zhangxiangnan
force-pushed
the
feature/invocation-steering
branch
from
November 26, 2026 08:35
44c4711 to
8f2d549
Compare
zhangxiangnan
force-pushed
the
feature/invocation-steering
branch
from
November 27, 2026 13:32
8f2d549 to
1deb55b
Compare
Add opt-in input queues and a steering service contract with an in-memory implementation. Persist accepted user messages at model/tool step boundaries without resetting invocation budgets, and close admission on termination. Preserve existing RunConfig and runAsync contracts. Cover lifecycle races, ordered persistence, shared-service submission, and unsupported configurations.
zhangxiangnan
force-pushed
the
feature/invocation-steering
branch
from
November 30, 2026 03:38
1deb55b to
ba4e1fe
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.
Closes #1931
Description of Change
Allow applications to submit additional user messages to an active ordinary LLM invocation. Steering is explicitly enabled by
runSteerableAsync; configuring a service only selects its backend. ExistingrunAsyncandRunConfigcontracts remain unchanged.SteeringInputQueueexposes readiness, text/content submission, and cancellation for one invocation. Receipts acknowledge persisted user events, not provider receipt or model compliance.BaseSteeringServiceseparates admission/storage from execution. The SDK suppliesInMemorySteeringService; applications can provide shared storage for cross-Runner/process submission throughRunner.steer(...).LlmAgentwithout sub-agents and with default conversation history. It admits user text/media, rejects model output/tool responses, and leaves live execution onLiveRequestQueue.The service Javadocs specify immediate admission, atomic closing, backend admission order, stable input IDs, replayable receipts across clients, caller-thread I/O with finite timeouts, and application ownership of backend clients. The SDK does not supply distributed execution ownership, transport retry deduplication, or crash recovery.
Python alignment: google/adk-python#7642 is related design work, not an accepted API being ported. Its scoped-task proposal marks messages undelivered when no subsequent model request occurs; this proposal can continue an ordinary invocation for accepted input after a final response. The FIFO/boundary concepts are related, but completion semantics differ. #7643 was closed pending RFC agreement.
Testing Plan
Current steering commit
ba4e1fed: 682 tests, 0 failures, 0 errors, 0 skipped across 11 test classes. This includesRunnerTest(187) andInMemorySteeringServiceTest(5), plus RunConfig, LLM flow/history, root-node execution, workflow handoffs/HITL/resume, and Live callbacks. Counts are from one execution, not added across reruns.The rebase retains main's workflow handoff stop condition, task isolation scope, and Live input persistence. It also retains main's
beforeRunearly-exit fix (aa183f8b): events pass throughonEventcallbacks before persistence, including Live execution. The existingRunnerTest.steering_shortCircuitClosesBeforeLifecycleAndTerminalCallbacksadditionally verifies callback delivery and persistence with steering enabled, while preserving its closure assertions. Main's three new early-exit regressions are included in the 682-test run. Queue-dependent steering tests now wait for asynchronous startup as introduced by the current #1929; the Live compatibility fixture keeps its model stream open until input has been sent.Local Maven settings/offline dependency caches were used. Coverage includes readiness/cancellation, ordered persistence, shared-service submission, limits, pending tools, rejected configurations, and backend failures.
RunnerTest.steering_admissionAndFinalClosureHonorBothOrderingsdeterministically pauses before or after the real inboxcloseIfIdle(), while the invocation is still active. It forces both admission-before-close and close-before-admission, verifying persistence plus the next model request in the first case and synchronous rejection in the second.steering_racingNormalCompletionIsConsumedOrRejectedremains a concurrent repetition test; it does not guarantee both interleavings on every execution.8f2d549a, temporary mutation probes confirmed the deterministic test fails if normal closure only checks emptiness without closing admission, or if it closes despite pending input. These probes are not additional passing test cases.steeringService_failedCloseIsRetriedByLifecycleCleanupis inRunnerTest;InMemorySteeringServiceTestcovers receipt replay, closure, identity, and callbacks outside locks.Full repository build at implementation revision
44c4711d: JDK 21,./mvnw -Prelease clean package, all 23 reactor modules succeeded. This is not a Java 17/25 matrix result. This is historical validation, not a full-reactor run at the rebased head. The current 682-test run above covers integration with the newer main and queue fix.Consumer-side evidence at
44c4711d(separate application, not included in this PR): 14 tests and a scripted demo passed. A standalone run processed 42M measured messages without duplicate/lost acknowledgements or per-producer reordering, plus 2,000 Runner submit/complete and submit/cancel races and 500 startup-cancel races. These are controlled-model/in-memory checks, not live-provider E2E, a JMH benchmark, or production capacity measurements. They were not rerun for this rebase.Remote storage, process-restart recovery, and live-provider behavior have not been validated.
Checklist