Skip to content

fix: route RunnerPodChatGenerator through AgentGatewayClient with typed agent kind#24

Merged
jorisjonkers-dev-agents[bot] merged 4 commits into
mainfrom
fix/runner-pod-gateway-routing
Jul 12, 2026
Merged

fix: route RunnerPodChatGenerator through AgentGatewayClient with typed agent kind#24
jorisjonkers-dev-agents[bot] merged 4 commits into
mainfrom
fix/runner-pod-gateway-routing

Conversation

@jorisjonkers-dev-agents

Copy link
Copy Markdown
Contributor

Summary

  • RunnerPodChatGenerator previously called the gateway directly via raw HTTP, bypassing AgentGatewayClient.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.
  • runnerPodAgentKind was an untyped String; the constructor now takes WorkspaceAgentKind so misconfiguration is caught at startup, not silently at runtime.
  • AgentGatewayClient.HeadlessJobRequest gains enableKbHooks: Boolean = false (forwarded through HttpAgentGatewayClient) so all headless callers can opt into KB hooks using the agent-runtime v0.18.1 enableKbHooks field on the gateway's HeadlessRequest.

Closes #14

Changes

  • AgentGatewayClient.HeadlessJobRequest: add enableKbHooks: Boolean = false.
  • HttpAgentGatewayClient: forward enableKbHooks in HeadlessRequestBody.
  • ChatGenerationProperties: runnerPodAgentKind changed from String to WorkspaceAgentKind; new runnerPodEnableKbHooks: Boolean = false.
  • RunnerPodChatGenerator: inject AgentGatewayClient for job launch (resolves full Workspace object required by the port contract); RestClient is kept only for the SSE streaming endpoint which has no equivalent on the port.
  • Tests: HttpAgentGatewayClientTest gains an enableKbHooks forwarding assertion; RunnerPodChatGeneratorTest updated for new constructor and gains three new tests covering typed-kind routing, enableKbHooks propagation, and the missing-endpoint guard.

Test plan

  • All unit tests pass in CI (RunnerPodChatGeneratorTest, HttpAgentGatewayClientTest).
  • chat.generation.runner-pod-agent-kind accepts CLAUDE, CODEX, SHELL in YAML; invalid values fail at startup.
  • When runner-pod backend is configured, AgentGatewayClient.startHeadlessJob() is called (not raw HTTP) — observable via gateway request logs in the runner Pod.

…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
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot added type: bug Something is broken or behaving incorrectly. area: agents Agent runtime, agent APIs, tools, prompts, or UI. labels Jul 12, 2026
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.
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot merged commit a8efe1d into main Jul 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent runtime, agent APIs, tools, prompts, or UI. type: bug Something is broken or behaving incorrectly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Headless/council run durability + idle-endpoint mismatch + RAG scope loss

1 participant