Routines API: partial update containing job_config replaces the whole job_config (drops events/prompt, model, sources)
Environment
Claude Code routines (research preview), /v1/code/triggers API. Observed 2026-08-04.
Summary
POST /v1/code/triggers/{trigger_id} is documented/behaves as a partial update at the top level (e.g. sending only {"enabled": false} works as expected). But sending a body containing job_config — even one carrying only job_config.ccr.environment_id — replaces the ENTIRE stored job_config: the response comes back with events (the prompt), session_context.model, and session_context.sources gone. A routine silently loses its prompt this way; the next scheduled fire would run an empty/undefined task.
Reproduction
- Create a routine with a full
job_config.ccr(environment_id, session_context{model, sources}, events[prompt]). POST /v1/code/triggers/{id}with body{"job_config": {"ccr": {"environment_id": "env_..."}}}intending to switch environments.- Response
job_config.ccrnow contains onlyenvironment_idplus a server-filledsession_context.allowed_tools—events,model, andsourcesare gone. (Recovered by re-sending the complete job_config.)
Expected
Either deep-merge semantics for job_config consistent with the top-level partial-update behavior, or a validation error when a partial job_config would drop events — silently discarding the prompt is the worst outcome. A note in the API reference about replace-vs-merge semantics per field would also prevent this.
Related docs gap
The trigger objects returned by the API include a persist_session field that appears in no documentation (routines page, cloud-environments page, routines-fire API reference); documenting its semantics would help API consumers.