fix: route RunnerPodChatGenerator through AgentGatewayClient with typed agent kind#24
Merged
jorisjonkers-dev-agents[bot] merged 4 commits intoJul 12, 2026
Merged
Conversation
…ed agent kind RunnerPodChatGenerator previously bypassed AgentGatewayClient.startHeadlessJob() and called the gateway directly via raw HTTP with an untyped String kind. This meant the two-phase durability commit, idle-endpoint split, and KB hook controls added in agents-api #22 did not apply to chat-generation headless jobs. Changes: - AgentGatewayClient.HeadlessJobRequest: add enableKbHooks (default false) so callers can opt headless jobs into KB auto-recall/capture hooks; the gateway injects KB_AUTO_MCP_DISABLED=1 when the flag is absent (agent-runtime v0.18.1). - HttpAgentGatewayClient: forward enableKbHooks in HeadlessRequestBody. - ChatGenerationProperties: change runnerPodAgentKind from String to WorkspaceAgentKind (typed); add runnerPodEnableKbHooks (default false). - RunnerPodChatGenerator: inject AgentGatewayClient for job launch instead of a raw RestClient POST; resolve the full Workspace object (required by the client contract); keep RestClient only for the SSE stream endpoint that has no equivalent on the port. The class doc is updated to reflect the routing change. - Tests: new assertions in HttpAgentGatewayClientTest for enableKbHooks forwarding; RunnerPodChatGeneratorTest updated for the new constructor and extended with three new tests covering typed-kind routing, enableKbHooks propagation, and the missing-endpoint guard. Closes #14
Return Pair<Workspace, String> from resolveWorkspace() so the validated non-null endpoint is threaded through without an unsafe !! call.
Codex review flagged two issues: 1. The migration from raw HTTP to AgentGatewayClient dropped partialMessages=true. The SseChatAccumulator relies on token-level deltas; without partial-messages mode the stream would deliver no incremental chunks. Added partialMessages to HeadlessJobRequest/HeadlessRequestBody and set it true in RunnerPodChatGenerator. 2. Routing tests threw on startHeadlessJob, never exercising the SSE streaming path. Added a MockRestServiceServer-based happy-path test that asserts the correct stream URL is called and the result event is parsed and returned.
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
RunnerPodChatGeneratorpreviously called the gateway directly via raw HTTP, bypassingAgentGatewayClient.startHeadlessJob(). This meant the two-phase durability commit, idle-endpoint split, and KB hook controls from agents-api fix: headless job durability #22 (v0.18.2) did not apply to chat-generation headless jobs.runnerPodAgentKindwas an untypedString; the constructor now takesWorkspaceAgentKindso misconfiguration is caught at startup, not silently at runtime.AgentGatewayClient.HeadlessJobRequestgainsenableKbHooks: Boolean = false(forwarded throughHttpAgentGatewayClient) so all headless callers can opt into KB hooks using the agent-runtime v0.18.1enableKbHooksfield on the gateway'sHeadlessRequest.Closes #14
Changes
AgentGatewayClient.HeadlessJobRequest: addenableKbHooks: Boolean = false.HttpAgentGatewayClient: forwardenableKbHooksinHeadlessRequestBody.ChatGenerationProperties:runnerPodAgentKindchanged fromStringtoWorkspaceAgentKind; newrunnerPodEnableKbHooks: Boolean = false.RunnerPodChatGenerator: injectAgentGatewayClientfor job launch (resolves fullWorkspaceobject required by the port contract);RestClientis kept only for the SSE streaming endpoint which has no equivalent on the port.HttpAgentGatewayClientTestgains anenableKbHooksforwarding assertion;RunnerPodChatGeneratorTestupdated for new constructor and gains three new tests covering typed-kind routing,enableKbHookspropagation, and the missing-endpoint guard.Test plan
RunnerPodChatGeneratorTest,HttpAgentGatewayClientTest).chat.generation.runner-pod-agent-kindacceptsCLAUDE,CODEX,SHELLin YAML; invalid values fail at startup.runner-podbackend is configured,AgentGatewayClient.startHeadlessJob()is called (not raw HTTP) — observable via gateway request logs in the runner Pod.