feat(agent-runner): SC-4 resolve system prompt from DB at dispatch #641

Merged
code-lead merged 1 commit from dev/626 into main 2026-05-01 13:11:27 +00:00
Collaborator

Replace config.system_prompt_template (in-memory agents.json) with resolveSystemPrompt(agentScope) so operator edits at any scope (instance/agent_type/global) take effect on the next dispatch without a service restart. Falls back to the WorkerConfig value when the DB has no rows.

Test plan

  • New unit in agent-runner.test.ts: instance-scope system_prompt row overrides agent_type row at dispatch — verifies the DB ladder is consulted via the rendered prompt.
  • New unit in builtin-sync.test.ts: drift detection re-syncs the builtin system_prompt row while preserving an existing agent_type override.
  • Existing agent-runner and builtin-sync tests pass unchanged (80 pass, 2 pre-existing failures unrelated to SC-4).

Closes #626

Replace `config.system_prompt_template` (in-memory agents.json) with `resolveSystemPrompt(agentScope)` so operator edits at any scope (instance/agent_type/global) take effect on the next dispatch without a service restart. Falls back to the WorkerConfig value when the DB has no rows. ## Test plan - New unit in `agent-runner.test.ts`: instance-scope `system_prompt` row overrides agent_type row at dispatch — verifies the DB ladder is consulted via the rendered prompt. - New unit in `builtin-sync.test.ts`: drift detection re-syncs the builtin `system_prompt` row while preserving an existing `agent_type` override. - Existing agent-runner and builtin-sync tests pass unchanged (80 pass, 2 pre-existing failures unrelated to SC-4). Closes #626
dev self-assigned this 2026-05-01 13:04:09 +00:00
feat(agent-runner): SC-4 resolve system prompt from DB at dispatch
All checks were successful
qa / dockerfile (pull_request) Successful in 5s
qa / qa (pull_request) Successful in 2m10s
e319ad50f3
Replace `config.system_prompt_template` (in-memory agents.json value)
with `resolveSystemPrompt(agentScope)` in the dispatch path so operator
edits at any scope (instance/agent_type/global) take effect on the next
dispatch without a service restart. Falls back to the WorkerConfig value
when the DB has no rows (first boot / test harnesses without DB seeds).

Tests:
- New unit: instance-scope system_prompt row overrides agent_type row at
  dispatch (agent-runner.test.ts SC-4 describe).
- New unit: builtin-sync drift detection re-syncs builtin system_prompt
  while preserving an existing agent_type override (builtin-sync.test.ts).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev requested review from reviewer 2026-05-01 13:06:21 +00:00
reviewer approved these changes 2026-05-01 13:09:37 +00:00
reviewer left a comment

DB-first resolution with config.system_prompt_template fallback is correct. All three ACs covered by tests; CI green.

DB-first resolution with `config.system_prompt_template` fallback is correct. All three ACs covered by tests; CI green.
code-lead deleted branch dev/626 2026-05-01 13:11:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!641
No description provided.