Skip to content

fix(analyzer): Remove {task} template placeholder from system prompt#9

Merged
ATMackay merged 1 commit into
mainfrom
patch/fix-analyzer-template-state
May 24, 2026
Merged

fix(analyzer): Remove {task} template placeholder from system prompt#9
ATMackay merged 1 commit into
mainfrom
patch/fix-analyzer-template-state

Conversation

@ATMackay
Copy link
Copy Markdown
Owner

Problem

Running agent run analyzer fails immediately with:

Error: agent error: failed to append instructions: failed to inject session state into instruction: state key does not exist

ADK's llmagent replaces {key} placeholders in the system instruction with values from session state at runtime. The analyzer prompt contained {task} and "Understand the task from {task}", but task was never added to initState in cmd/analyze.go.

The task is already delivered as the user message via UserMessage(task) — having it in the system prompt was redundant.

Fix

Remove the two {task} references from the system instruction. {work_dir} and {output_path} remain and are correctly set in initState.

Test plan

  • go build ./... — clean compile
  • go test -race ./... — all tests pass

🤖 Generated with Claude Code

{task} was used in the instruction string but never set in session state,
causing ADK's template injection to fail with "state key does not exist"
on every run. The task is already delivered as the user message so the
placeholder is redundant. References to {task} replaced with "the user
message" in the workflow description.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ATMackay ATMackay merged commit d28bcf2 into main May 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant