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
{{ message }}
Repository navigation
Commit 71597f1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(service-automation): a connector instance whose upstream no longer matches its pin is degraded in its own words
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
A provider factory that throws `CONNECTOR_UPSTREAM_CHANGED` (the `mcp` provider does when an instance's `providerConfig.toolsSnapshot` does not match what the server serves) degrades the instance on the same 5 s → 5 min backoff as an unreachable upstream, but its log records now say what happened. The materializer's ERROR reads "… serves a tool definition that differs from its toolsSnapshot — instance registered degraded (no actions); re-checking with backoff, attempt N." instead of "upstream unavailable … retrying with backoff", and the engine's degrade WARN says the instance has no actions "until its upstream serves the definitions its pin names again" instead of "until its upstream is reachable". The instance's reason (`GET /api/v1/automation/connectors`, the `connector_action` refusal) is the factory's message, naming each changed tool, as before.
feat(spec): `ConnectorUpstreamChangedError`, the marker for an upstream that no longer matches the instance's pin
6
+
7
+
Clause-②: yes (widening)
8
+
Metadata-protocol: none
9
+
10
+
`@objectstack/spec/integration` exports `CONNECTOR_UPSTREAM_CHANGED`, `ConnectorUpstreamChangedError` and the structural check `isConnectorUpstreamChanged`, beside the upstream-unavailable and credential-rejected markers. A connector provider factory throws it when the upstream it contacted serves a definition that differs from a pin the instance declares. Today that is the `mcp` provider's `providerConfig.toolsSnapshot`: a pinned tool whose description or `inputSchema` changed, or a pinned tool the server no longer serves. The automation materializer degrades the instance with the factory's message as its reason and re-checks it on the same backoff as an outage, so a server that restores the pinned definition recovers it. `CONNECTOR_UPSTREAM_UNAVAILABLE` keeps its meaning: the upstream could not be reached. The code is registered in the error-code ledger under `@objectstack/spec`; no HTTP door answers with it.
feat(connector-mcp): `providerConfig.toolsSnapshot` pins each tool of an `mcp` instance by name
6
+
7
+
Clause-②: yes (widening)
8
+
Metadata-protocol: added
9
+
10
+
An `mcp` instance's `include` decides which tools it exposes. Until now nothing noticed when the server rewrote one of them, for example a new description that steers an agent or an `inputSchema` that asks for more than it did. `providerConfig.toolsSnapshot` is a record of tool name → the sha256 of that tool's definition. It is keyed by tool name, like `include`, and the two compose.
11
+
12
+
-**The digest.** sha256, lowercase hex, of the UTF-8 canonical JSON of `{ name, description, inputSchema }` from the tool's `tools/list` entry. A member the server does not send is left out. Canonical JSON sorts object keys in UTF-16 code-unit order at every depth, keeps array order, writes primitives as `JSON.stringify` does and has no whitespace: the RFC 8785 (JCS) form for values read from JSON. `computeMcpToolsSnapshot(tools)` and `mcpToolDigest(tool)` are exported and are the functions the check uses.
13
+
- **The check.** On every materialization each pinned tool is hashed and compared on its own. A pinned tool served with a different description or `inputSchema`, or no longer served, degrades the instance: the provider throws `ConnectorUpstreamChangedError` (`CONNECTOR_UPSTREAM_CHANGED`), not the upstream-unavailable marker, so the logs say the pin did not match rather than that the server is down. Its reason names each such tool and the digest the server now serves, and none of the instance's tools are exposed. The instance is re-checked on the retry backoff and recovers once the server serves the pinned definitions again. An edited pin re-materializes it at once. A pinned tool that `include` also lists is reported by the pin when the server stops serving it, not as an `include` typo. When the instance's own credential reached the server (its `auth` over http), a pinned tool the server does not list takes the credential path instead (`ConnectorCredentialRejectedError`, 403, both causes named, a stored credential marked `rejected`), since the server may list only the tools that credential may use; a served pinned tool that hashes differently is still `CONNECTOR_UPSTREAM_CHANGED`.
14
+
-**Refused before connecting.** A `toolsSnapshot` that is not a record of tool name → 64 lowercase hex characters fails the boot, and so does a pin on a tool `include` leaves out, since that pin would never be checked.
15
+
- Without `toolsSnapshot`, an instance behaves exactly as before. A tool the pin does not name is not checked.
16
+
-`McpConnectorOptions.include` now also receives the tool's `tools/list` entry as a second argument. An existing one-argument predicate is unaffected.
fix(platform-objects): the Users identity source reads "Local Account" instead of "Env-Native"
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
-**Identity Source.** A user who signed up with email and password, or an app end-user, showed the identity source "Env-Native", a word from the provenance design. The `env_native` option is now labelled "Local Account", beside the federated "IdP-Provisioned": the identity is held by this environment's own sign-in rather than by an identity provider. zh-CN reads 本地账号, ja-JP ローカルアカウント, es-ES Cuenta local.
11
+
- The stored value is unchanged: rows, the sign-up hook and the cloud-managed gating keep reading `env_native`.
feat(metadata-protocol): an ensure door for a base's paired customization package (ADR-0146 D3)
9
+
10
+
Clause-②: yes (narrowing)
11
+
Metadata-protocol: added
12
+
13
+
The new route `POST /api/v1/packages/:id/ensure-customization`, with its request and response schemas (`EnsureCustomizationPackageRequestSchema`, `EnsureCustomizationPackageResponseSchema`), widens the surface, and `POST /api/v1/packages` and the duplicate door's target narrow theirs: a package id shaped like a pair (`<base>.custom`) is refused unless its manifest carries what the ensure door writes.
14
+
15
+
<!-- adr-0087: not-required (runtime-interface-only packages/metadata-protocol/src/protocol.ts#ObjectStackProtocolImplementation) The narrowing is a refusal added to the install primitive and the duplicate verb of this runtime class, and to the HTTP install door that fronts them: an install whose id is a paired customization package id must declare the explicit pair namespace and a dependency on the base. No Zod schema, spec contract or stored metadata shape changes, and no stored row is reread differently: a pair already in `sys_packages` replays at boot as stored. So `objectstack migrate meta` has nothing to rewrite. -->
16
+
17
+
**What it does.** The paired customization package of a read-only base holds the changes a customer makes to that base. `POST /api/v1/packages/:id/ensure-customization` answers that pair, `<base>.custom`, and creates it when it is absent. It is created through the same install primitive `POST /api/v1/packages` uses, with an explicit namespace (the base's namespace followed by `_custom`, so `crm` gives `crm_custom`), a dependency on the base at the major of the base's version (`^3` for `3.4.1`), version `0.1.0` and type `module`. The answer names the base, the pair, its namespace, its dependency range, whether this call created it (`201` when created, `200` when it was already there) and whether it is writable. Asking again changes nothing. Two calls at once leave one pair, and a call that arrives while another is creating the pair waits for it and answers from what it left.
18
+
19
+
**What it refuses, leaving nothing behind.** A base that is not installed (`404`). A base that is writable, because it is customized directly, a base that declares no namespace, a base whose namespace is too long to take the `_custom` suffix (nothing is truncated or hashed), and a base whose version is not SemVer (`409`). A base that is itself a pair (`400`). A pair namespace another package already owns (`422 NAMESPACE_CONFLICT`, the code the registry stamps for the same condition). An installed `<base>.custom` that lacks the namespace or the dependency (`409`): it is never adopted or rewritten. The caller is judged as at the install door: `manage_metadata` under `single`, and under `isolated` or `group` only the platform operator, so a tenant administrator gets `403`.
20
+
21
+
**The narrowing.**`POST /api/v1/packages`, the install primitive and the duplicate door now refuse, with `400`, a package whose id is a pair id but whose manifest lacks the explicit pair namespace or a dependency on the base. The refusal names the ensure door. An exported pair that declares both still installs, and the dependency check then judges its range against the base installed there.
What to do: nothing for an existing stack. A pair is created through the ensure door, or installed from an export that declares both its namespace and its dependency on the base.
A translation the file adapter could not serve as asked is now reported once through the plugin logger, instead of falling back in silence (#28109). What `t()` returns is unchanged.
9
+
10
+
- The requested locale lacks a key the fallback locale holds: one line per key and locale, naming both, so whoever owns the bundle can add the translation.
11
+
- The requested locale has no bundle at all: one line per locale, not one per key.
12
+
- Both are a `warn` for a locale the stack offers (the declared `i18n.supportedLocales`, else every loaded locale) and a `debug` line for any other locale, where the client asked for something the app never offered and the fallback is the designed answer.
13
+
- No bundle holds the key: one `debug` line per key and locale, because most callers probe optional addresses on purpose and read the echoed key as "not overridden".
14
+
- Reports stop after 1000 distinct misses (`FileI18nAdapter.MISSING_TRANSLATION_REPORT_LIMIT`), with one line saying so.
15
+
16
+
`FileI18nAdapter` takes an optional `logger`; without one it stays silent, as before.
A tool's digest is the sha256, in lowercase hex, of the UTF-8 **canonical
307
+
JSON** of `{ name, description, inputSchema }` taken from its `tools/list`
308
+
entry; a member the server does not send is left out (it is not hashed as
309
+
`null`), and no other member (`outputSchema`, annotations) is hashed.
310
+
Canonical JSON is: object members sorted by key in UTF-16 code-unit order
311
+
(JavaScript's default string sort), at every depth; array elements in their
312
+
order; strings, numbers, booleans and `null` written exactly as
313
+
`JSON.stringify` writes them; no whitespace. For values read from JSON that is
314
+
the RFC 8785 (JCS) form, so any JCS implementation reproduces it. In code,
315
+
`computeMcpToolsSnapshot(tools)` from `@objectstack/connector-mcp` builds the
316
+
record from a tool list with the same function the check uses.
317
+
318
+
On every materialization each pinned tool is hashed and compared on its own:
319
+
320
+
- Every pinned tool served with its pinned definition — the instance
321
+
materializes as usual.
322
+
- A pinned tool served with a different description or `inputSchema`, or no
323
+
longer served at all — the instance registers **degraded** and exposes none
324
+
of its tools. Its reason names each such tool, with the digest the server
325
+
now serves, and the logs say the pin did not match (the provider throws
326
+
`CONNECTOR_UPSTREAM_CHANGED`, not the unreachable-server marker). The
327
+
instance is re-checked on the retry backoff, so a server that
328
+
serves the pinned definitions again recovers it on its own; to accept the
329
+
change, review it and set the pin to the served digest (the edit
330
+
re-materializes the instance at once). This holds for a pinned tool
331
+
`include` also lists: once pinned, a tool the server stops serving is
332
+
reported by the pin, not as an `include` typo. When the instance's own
333
+
credential reached the server (its `auth` over http), a pinned tool the
334
+
server does not list may be one hidden from that credential, so it is
335
+
degraded as a credential the upstream refuses instead, naming both causes —
336
+
a served tool that hashes differently is still reported by the pin.
337
+
- A tool the pin does not name is not checked. Pin every tool you depend on,
338
+
and keep tools the server adds out with `include`.
339
+
340
+
A `toolsSnapshot` that is not a record of tool name → 64 lowercase hex
341
+
characters fails the boot before connecting, and so does a pinned tool that
342
+
`include` leaves out — the instance never exposes it, so its pin would never be
343
+
checked.
344
+
277
345
<Callouttype="warn">
278
346
**Declarative stdio transports are denied by default.** Materializing one
279
347
spawns a local process *from metadata* — which a runtime Studio publish can
@@ -795,6 +863,7 @@ retry):
795
863
| stdio transport without host opt-in |**Hard boot error** with the `declarativeStdio` fix inline — a security rejection is never retried |
796
864
| An entry of an **installed** package (`os package install`, `POST /api/v1/marketplace/install-local`) names a package-relative file — an `openapi``spec` path — or needs a location inside its package, as a stdio `mcp` transport's working directory does | Configuration fault, **never resolved against the host's directory**: an installed package has no directory on the runtime it was installed into, and the host's is not its own. The instance is not materialized, and the reconcile's error names the entry, its package and the ref. Rebuild the package with a current `os build`, which carries an `openapi` spec file into the artifact, or inline the document; reach an MCP server from an installed package over `http`. The host's own entries keep reading their files |
797
865
| MCP server unreachable / `tools/list` fails; remote spec URL unreachable or transiently failing (408/429/5xx) |**Not fatal**: the instance registers **degraded** (visible on `GET /api/v1/automation/connectors` with the reason), dispatches fail with that reason, and the platform retries on a 5s→5min backoff — recovery is automatic |
866
+
| An `mcp` instance's `toolsSnapshot` does not match what the server serves (a pinned tool's description or `inputSchema` changed, or a pinned tool is no longer listed) |**Not fatal**: the instance registers **degraded** with no actions, its reason naming each tool and the digest it now serves, and the logs say "serves a tool definition that differs from its toolsSnapshot" (`CONNECTOR_UPSTREAM_CHANGED`); it is re-checked on the same backoff and recovers once the server serves the pinned definitions again — or set the pin to the reviewed digest |
798
867
| A retry of a degraded instance reaches the upstream and meets a configuration fault (an `include` naming a tool or operation the upstream does not offer; on an `mcp` instance that sends a static credential, the credential row above applies instead) |**Not fatal**: the instance stays **degraded**, now with the configuration reason, and is **not retried** — dispatches fail saying to edit its declaration; an edit of the entry (or a restart) re-attempts it |
| An `openapi` operation's parameter declares a `style` OpenAPI 3.x does not define for its location (`deepObject` on a path parameter, `form` on a header) | Configuration fault — **hard boot error** naming the operation and the parameter; correct the document or leave the operation out of `include`|
Copy file name to clipboardExpand all lines: content/docs/references/api/automation-api.mdx
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -356,7 +356,7 @@ const result = AutomationApiErrorCode.parse(data);
356
356
357
357
| Property | Type | Required | Description |
358
358
| :--- | :--- | :--- | :--- |
359
-
|**code**|`Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| 'INVALID_FORMAT' \| 'VALUE_TOO_LONG' \| 'VALUE_TOO_SHORT' \| 'VALUE_OUT_OF_RANGE' \| … +355 more>`| ✅ | The inner refusal's code in its WIRE spelling - the ADR-0112 member a record save of the same write answers in `error.code` (e.g. `UNIQUE_VIOLATION`); the closed set `ApiErrorSchema.code` parses against |
359
+
|**code**|`Enum<'VALIDATION_ERROR' \| 'INVALID_FIELD' \| 'MISSING_REQUIRED_FIELD' \| 'INVALID_FORMAT' \| 'VALUE_TOO_LONG' \| 'VALUE_TOO_SHORT' \| 'VALUE_OUT_OF_RANGE' \| … +356 more>`| ✅ | The inner refusal's code in its WIRE spelling - the ADR-0112 member a record save of the same write answers in `error.code` (e.g. `UNIQUE_VIOLATION`); the closed set `ApiErrorSchema.code` parses against |
360
360
|**message**|`string`| ✅ | The inner refusal's own diagnostic text, verbatim, without the node and operation prefixes the run's failure text adds |
361
361
362
362
### Allowed Values: `FlowInnerRefusal.code`
@@ -456,6 +456,7 @@ const result = AutomationApiErrorCode.parse(data);
0 commit comments