You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(automation): ADR-0096 runtime re-materialization of declarative connectors (#2977)
Provider-bound declarative `connectors:` instances materialized only at boot, so
a connector published from Studio (or a dev reload) did not become dispatchable
until a restart. `materializeDeclaredConnectors` is now a reconcile against the
declared set, run at boot (fatal) and on `metadata:reloaded` (soft):
- Adds newly-declared instances, tears down removed / newly-`enabled:false` ones
(calling their `close`, e.g. an MCP connection), and re-materializes only those
whose signature — a stable hash of provider + providerConfig + auth + identity —
changed. An unchanged instance is left untouched (no needless MCP reconnect on
an unrelated metadata reload).
- Boot keeps the "fail loudly" contract (throws → fatal bootstrap). Reload is
soft: unknown provider / unresolvable credentialRef / factory failure / name
conflict is logged and the entry skipped, never crashing the live server; a
changed instance's old connector keeps serving until its replacement
materializes successfully.
Tracking (`materializedConnectorClosers` array → `materializedConnectors` Map)
carries the signature + close per name. 6 new reload tests (add/remove/disable/
unchanged/changed/soft-failure); service-automation suite green (285 tests).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pbmw3pMqNJfPbkvwh9Fkjs
Copy file name to clipboardExpand all lines: docs/adr/0096-declarative-connector-instances.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,8 +118,22 @@ If a provider-bound instance and a plugin-registered connector share a `name`, b
118
118
-**Open source:** the `rest` / `openapi` / `mcp` provider factories; **static** auth (`none` / `api-key` / `basic` / `bearer`); `credentialRef` resolved from **environment variables** (`defaultEnvCredentialResolver`) — the degraded-but-honest story for environments with no managed secrets service.
119
119
-**Enterprise:** managed credential **vaulting** and OAuth2 authorization-code/refresh lifecycle (inject a vault-backed `CredentialResolver` via `AutomationServicePluginOptions.credentialResolver` — no change to the materialization path), plus per-tenant connection lifecycle. The open tier deliberately omits OAuth2 from `ConnectorInstanceAuthSchema`.
120
120
121
+
### Runtime reconcile (follow-up, landed)
122
+
123
+
Materialization is no longer boot-only. `materializeDeclaredConnectors` is a
124
+
**reconcile** against the declared set, run both at boot (`fatal: true`) and on
125
+
`metadata:reloaded` (`fatal: false` — a Studio publish / dev reload). The reconcile
126
+
adds newly-declared instances, tears down removed / newly-`enabled:false` ones
127
+
(calling their `close`), and re-materializes only those whose signature (a stable
128
+
hash of `provider` + `providerConfig` + `auth` + identity) changed — an unchanged
129
+
MCP instance is never needlessly reconnected. On reload a bad entry (unknown
130
+
provider, unresolvable credentialRef, factory failure, name conflict) is **logged
131
+
and skipped**, never crashing the live server; a changed instance's old connector
132
+
keeps serving until its replacement materializes successfully. Boot keeps the
133
+
"fail loudly" contract.
134
+
121
135
### Deliberate scope boundaries
122
136
123
-
-**Boot-time only.** Materialization runs once at boot. Re-materializing a provider-bound instance published at runtime (Studio) is a follow-up; the descriptor audit still re-runs on `metadata:reloaded`.
124
137
-**`providerConfig.spec` (openapi)** accepts an inline document or an http(s) URL; resolving a `./file.json` ref relative to the stack is the stack loader's job, not the connector's.
125
138
-**MCP credentials** ride the transport (ADR-0024); for an http transport a resolved `auth` is folded into the request headers.
139
+
-**MCP at boot** connects during materialization, so an unreachable server fails boot; a fail-soft "optional" marker for boot-time materialization is a possible future refinement (runtime reloads are already soft).
0 commit comments