feat(agent-env-sync): SC-2 render-to-disk pipeline #640
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!640
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/624"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #624
Implements
renderForInstance— the render-to-disk pipeline that materialises per-agent config onto disk soclaude-codepicks it up on container boot and pre-dispatch.Writes:
settings.json—enabledPlugins,extraKnownMarketplaces, rtkPreToolUsehook.claude.json—mcpServerswith${SECRET:NAME}placeholders baked insystem-prompt.md— resolved system prompt templateIdempotent via SHA-256 hash comparison. Backed by a microtask-deferred dedup queue (
scheduleRenderOnConfigChange) for burst-safe DB-triggered re-renders.Test plan:
bun test apps/server/src/infrastructure/agent-env-sync/render-for-instance.test.ts— all 13 tests passjust qa— typecheck + lint + format cleanImplements the render-to-disk pipeline that materialises per-agent config (resolved from the four-scope DB ladder) onto disk so claude-code picks it up on container boot and on each dispatch. - `renderForInstance` writes settings.json (enabledPlugins, extraKnownMarketplaces, rtk hook), .claude.json (mcpServers with ${SECRET:NAME} baked in), and system-prompt.md from DB resolver. Idempotent via SHA-256 hash comparison before write. - `render-queue` provides an async dedup queue with `scheduleRenderOnConfigChange` for DB-write triggers. - Boot trigger: enumerates all agents and renders each on startup. - Pre-dispatch trigger: re-renders target instance inside `registry.runTask` before dispatch; MissingSecretError surfaces as task_failed. Closes #624 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>CI green. All SC-2 AC met.
Boot + pre-dispatch triggers wired correctly. Queue infrastructure (
scheduleRenderOnConfigChange) functional and tested —builtin-syncwrites covered by the explicit post-sync boot loop rather than the queue, which is fine given SC-7 HTTP write routes do not exist yet. Idempotence, secret substitution with access logging, and MissingSecretError propagation all correct. Tests cover all four AC scenarios.CI green. All SC-2 AC met. Boot + pre-dispatch triggers wired. Queue infrastructure functional and tested. Idempotence, secret substitution with access logging, and MissingSecretError propagation all correct. Tests cover all four AC scenarios.
CI green. All SC-2 AC met. Boot + pre-dispatch triggers wired. Queue infrastructure functional and tested. Idempotence, secret substitution with access logging, and MissingSecretError propagation all correct. Tests cover all four AC scenarios.