Fix BridgedAgentWorkflow run names exceeding Kubernetes' 63-byte label limit - #207
Merged
Merged
Conversation
…netes' 63-byte label limit
`"agentrun-" + agentId + "-" + uuid.NewString()` is 9 + len(agentId) + 1 +
36 bytes. For `claude-code-swe-agent` (21 bytes) that's 67 -- over the
label-value limit, so core-controller's reconciler rejects the Job it
tries to create ("must be no more than 63 bytes") on every single
attempt. The AgentRun CR gets created and then sits forever with no
phase and no Job.
This is the actual, currently-live blocker in production: with the
bridged-workflow routing fix (#204/#205) and its dependent config wiring
all correctly in place, a real chat turn now authorizes correctly and
starts a real BridgedAgentWorkflow -- and then silently stalls right
here, forever, with no visible error to the caller (the conversation
just answers "I couldn't complete the goal within my step budget" once
the parent workflow's own turn budget runs out waiting for a reply that
can never come).
e2e coverage never caught it because bridged-agent-workflow.e2e.ts's
stand-in agent ("stub-agent", 10 bytes) fits comfortably; nothing this
short-sightedly assumed a length bound that only real agent IDs violate.
Fix: newAgentRunName truncates the agent ID portion (never the uuid,
which is what actually provides uniqueness) whenever the natural form
would exceed the limit, so it holds for any agent ID length.
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
BridgedAgentWorkflownames each run"agentrun-" + agentId + "-" + uuid.NewString()— 9 +len(agentId)+ 1 + 36 bytes. Forclaude-code-swe-agent(21 bytes) that's 67 bytes, over Kubernetes' 63-byte label-value limit.core-controller's reconciler uses this name directly as the Job name (and therefore the API server's auto-addedjob-namelabel), so it rejects the Job on every single reconcile attempt:"must be no more than 63 bytes". TheAgentRunCR gets created and then sits forever with no phase and no Job.This is a real, currently-live production blocker, found while debugging a live report: with the bridged-workflow routing fix (#204/#205) and its dependent config wiring all correctly in place, a real chat turn now authorizes correctly (verified via the worker's own logs:
verdict=authorized, real principal resolved) and starts a realBridgedAgentWorkflow— and then silently stalls at this exact point, forever, with no visible error surfaced to the caller (the turn just eventually reports something like "I couldn't complete the goal within my step budget" once its own turn budget runs out waiting for a reply that can never come).e2e coverage never caught this because
bridged-agent-workflow.e2e.ts's stand-in agent (stub-agent, 10 bytes) fits comfortably within the limit — nothing exercised an agent ID long enough to reproduce it.Fix
newAgentRunNametruncates the agent ID portion — never the uuid, which is what actually provides uniqueness — whenever the natural"agentrun-<agentId>-<uuid>"form would exceed the 63-byte limit, so the bound holds for any agent ID length rather than only the ones e2e happened to test with.Test plan
agentrun_name_test.go) pin the exact reproducing case (claude-code-swe-agent), verify the uuid suffix is always intact (never truncated, so uniqueness is preserved), and verify short IDs are unaffectedbridged_agent_workflow_test.go's existing assertion, which expectedRunIDto contain the full agent ID string — no longer true once truncation is necessary for this specific (real, 21-byte) agent IDgo build ./...,go vet ./...,gofmt -l .,go test ./...all clean inengines/temporalbridged-agent-workflow.e2e.tsstill passes against minikube (unaffected — its stand-in agent's ID is short enough that truncation never triggers, confirming this is purely additive)