Repository navigation
fix(service-automation): end the backoff retry of a degraded connector on a configuration fault - #28014
Conversation
…r on a configuration fault A degraded declarative instance whose retry meets a configuration fault (an mcp or openapi include naming what the upstream does not offer) was logged and skipped while staying in the retry set, so the stale "could not reach" reason stayed and the timer kept reconnecting. It is now held with the configuration reason: no timer retry, no re-attempt on an unchanged reload; an edit of the declaration or a restart re-attempts it. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czEP1ZwBWHusgCZugF
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin cdc2ebcafcc9d6ce63cfc059f76818392ba42128 && git checkout cdc2ebcafcc9d6ce63cfc059f76818392ba42128
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e199adfb79ba2eddb79ad7d5fb0e827c6fb653c1 fbe1de197eabf684e6437116d4ba555af2de1413 && git checkout -B drift-repro e199adfb79ba2eddb79ad7d5fb0e827c6fb653c1 && git merge --no-ff fbe1de197eabf684e6437116d4ba555af2de1413
node scripts/docs-audit/affected-docs.mjs --json e199adfb79ba2eddb79ad7d5fb0e827c6fb653c1
|
|
domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia Seat ACCEPT · PR #28014 · head
|
Requested by Elon · project thread
Fixes #27992
Clause-②: no
Metadata-protocol: none
Skills-docs: follow-up owed — content/docs/automation/connectors.mdx (its fault table has no row for a configuration fault met on a degraded instance's retry;
git grep -n -i degraded -- skillsfinds no retry wording;docs/adr/0097-declarative-connector-instances.md§degrade is governed and left as is)维护者速读
include写了上游没有的工具),现在会停止重试,并把原因换成配置错误的原文。plugin.ts。packages/services/service-automation/src/plugin.ts(工厂 catch 里新加的分支,与新方法failDegradedConnectorInstance);connector-retry-configuration-fault.test.ts。pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/connector-retry-configuration-fault.test.ts,预期 6/6 通过。What changes
reconcileDeclaredConnectorsroutes a provider factory's throw three ways: a credential rejection holds, an upstream-unavailable fault degrades and retries on the backoff, and anything else is a configuration fault thatfail()s (fatal at boot, logged and skipped on a reload). The skip left an instance that was already degraded indegradedInstances, with its husk still carrying the stale "could not reach" reason, so the backoff timer kept reconnecting against a fault no retry can clear.Now, on a soft run, a configuration fault met by an instance in
degradedInstancesgoes to a newfailDegradedConnectorInstance:heldflag the credential path uses):scheduleDeclarativeRetryskips it, and a reconcile with the same signature skips it. A change of its declaration or a restart re-attempts it.degradedReason, soGET /api/v1/automation/connectorsand theconnector_actionrefusal name the configuration fault.errorrecord says the instance is no longer retried; the provider's message ridesmeta(finding(service-automation): connector 物化失败的fail()也是${err.message}单行插值,同 #5048 的类别、另一个接缝 #5575).Untouched: the boot path (still fatal), a configuration fault on an instance that was not degraded (still logged and skipped), the credential hold path, and the unavailable degrade path.
Reading chosen for "the failed state":
ConnectorState(packages/spec/src/integration/connector-descriptor.ts) has onlyreadyanddegraded, so the descriptor keepsstate: 'degraded'and the failure is carried by the replaced reason plus the ended retry. Adding afailedstate would widen a published spec type and is outside this card.Tests
New
packages/services/service-automation/src/connector-retry-configuration-fault.test.ts, under fake timers, with fakemcpandopenapiprovider factories shaped like the real ones (unavailable marker while down, a plainErrornamingproviderConfig.includeonce up). Theopenapipin needed no provider-package edit: the path is provider-agnostic inplugin.ts.mcp/openapi: degraded at boot, the backoff retry meets the include fault, the descriptor'sdegradedReasonis the configuration message and no longer "could not reach", and 64 × the base delay later the factory has not been called again.ready.Acceptance notes
connector_actionrefusal (builtin/connector-nodes.ts) still ends with "the platform retries automatically" for every degraded husk, a held one included (a refused credential today, a configuration fault after this PR); the engine'sConnector registered DEGRADEDwarn likewise says "the materializer retries with backoff". Both are outside this card's file surface, so the reason text names the fault but the sentence after it still promises a retry.fail()arms inreconcileDeclaredConnectors(no provider factory, unparseableretryConfig, host credential resolver throwing) can also be met by an instance that is already degraded, after an edit; they keep the old skip-and-retry behaviour. This PR routes only the factory's configuration fault, which is the card's mechanism.includeon a hot reload of a live connector still keeps the wider set serving.Verification
All readings at head
fbe1de19.Reproduction on main (red), fix (green), ablation, restore
main(46943657'splugin.ts, with the new test file):Tests 4 failed | 2 passed (6). Themcpandopenapicases fail on the reason (expected 'connector-mcp provider: connector …' to match /providerConfig\.include names 'nope'/, the stale "could not reach" text), and the changed-entry case fails withexpected 67 to be 3: 67 factory calls in 64 base delays. The two controls pass.Tests 6 passed (6).scripts/ablation-replace.mjs, anchorif (!opts.fatal && this.degradedInstances.has(name)) {replaced byif (false /* ABLATION */ && this.degradedInstances.has(name)) {: anchor 1 to 0, blob 95e8c37606da to 577056522a42; runTests 4 failed | 2 passed (6)(the same four; both controls stay green); restore: blob after restore equals the blob at HEAD (95e8c37606da),git diff HEADempty; re-runTests 6 passed (6). The test imports./plugin.jsfrom source, so nodist/leg applies.Package suite and typecheck
pnpm --filter @objectstack/service-automation test:Test Files 222 passed (222),Tests 2836 passed (2836).pnpm --filter @objectstack/service-automation typecheck: exit 0 (check:test-typecheck: OK).dispatch-gates families (60 derived, 60 run, 0 NOT-MEASURED) and pnpm lint
Run after a whole-tree
turbo run build(exit 0).dispatch-gates --ran: 60 derived families accounted for, 60 run, 0 NOT-MEASURED.Generated by Claude Code