Route pod-based coding agents to BridgedAgentWorkflow - #204
Merged
Conversation
claude-code-swe-agent and opencode-swe-agent never set the durable-agents.dev/bridged annotation the Temporal engine's agentWorkflowNameFor uses to pick BridgedAgentWorkflow over the declarative planner loop. Without it, both fell through to the declarative AgentWorkflow, which got the agent's real prompt (telling it to use git/gh) but an empty tools list -- so the planner tried to call "gh" as a declarative Tool and was refused with "tool not available to this agent", exactly matching a captured production failure. stub-agent (the e2e stand-in for claude-code-swe-agent) had the same gap and is fixed the same way, to stay a faithful stand-in once a cluster routes turns through the Temporal engine. Adds a hermetic Go regression test pinning agentWorkflowNameFor's routing contract, plus an e2e spec asserting the live deployed Agent CRs carry the annotation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HctRMtdZixptEZeMebhADq
4 tasks
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
claude-code-swe-agentandopencode-swe-agentnever set thedurable-agents.dev/bridged: "true"annotation that the Temporal engine'sagentWorkflowNameFor(engines/temporal/internal/temporal/workflows/agent_workflow.go) uses to route an Agent toBridgedAgentWorkflow(drives an unmodified upstream pod/CLI agent over the real NATS protocol) instead of falling through to the declarativeAgentWorkflow(an LLM planner that only ever callsTools named in the agent's owntoolRefs).Without the annotation, both agents fell through to the declarative loop. The planner got the agent's real
agentPrompt— which tells the model to invokegit/ghas plain CLI commands — but an emptytoolslist (neither agent declarestoolRefs, since their real tools are the CLI's own bash/file built-ins). So the model tried to call"gh"(and variants likegh_repo_clone,call_tool) as a declarative Tool and was refused every time with"tool not available to this agent"— matching a production failure observed on a real "open a PR" request, where the real Claude Code CLI pod never even started; a generic in-Temporal planner substituted for it and was always going to fail, having no real tools at all.stub-agent(apps/stub-agent, the e2e hermetic stand-in forclaude-code-swe-agent) had the identical gap — fixed the same way so it stays a faithful stand-in once a cluster actually routes turns through the Temporal engine. (opencode-swe-agentis fixed in the chart too, but has no live CR in this e2e cluster since it's disabled there — covered instead by the new Go test.)Fix
Added
metadata.annotations: {durable-agents.dev/bridged: "true"}to:charts/community-components/templates/agent-claude-code-swe.yamlcharts/community-components/templates/agent-opencode-swe.yamlcharts/community-components/templates/agent-stub.yamlTest coverage (previously none existed for this routing path)
engines/temporal/internal/temporal/workflows/agent_workflow_routing_test.go— hermetic Go test pinningagentWorkflowNameFor's routing contract (bridged/step-tool/neither) and decoding Agent CRs shaped like the two real pod agents to assert they resolve toBridgedAgentWorkflow.e2e/specs/bridged-agent-routing.e2e.ts— asserts the live, cluster-deployedclaude-code-swe-agentandstub-agentCRs actually carry the annotation, so a future chart edit that drops it again is caught against a real minikube deploy, not just chart-rendering logic.Test plan
go test ./...inengines/temporal— all packages pass, including the new routing testgofmt -l ./go vet ./.../go build ./...clean inengines/temporalhelm templateverified both fixed chart templates render the annotation correctlycommunity-componentsrelease on minikube and confirmed the liveAgentCRs (claude-code-swe-agent,stub-agent) carrydurable-agents.dev/bridged: "true"npm run e2e -w e2e) against minikube: 7 spec files passed, 57 tests passed, 1 skipped — no regressions🤖 Generated with Claude Code
https://claude.ai/code/session_01HctRMtdZixptEZeMebhADq