Skip to content

fix(service-automation): converge a connector definition change on every replica - #28028

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-hgv6vk
Oct 30, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-hgv6vk

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Fixes #28002

Clause-②: no
Metadata-protocol: none
Skills-docs: none in skills (git grep -n -i -E "replica|cluster|metadata\.mutated|peer" -- skills/ | grep -i connector finds 0 lines); docs follow-up owed and outside this card's file surface: content/docs/kernel/cluster.mdx §6.2 (the lane 2 row's "Converges" column and the "Lane 2" subsection name only ObjectQL's object registry, while the automation service's flows and, after this PR, its materialized connectors converge on lane 2 as well) and content/docs/automation/connectors.mdx (the fault table's "runtime reload (Studio publish / dev reload)" row now also covers a direct active save and a change made on another replica)

维护者速读

  • 改了什么:在一个副本上保存、发布或删除连接器定义后,其它副本现在也会重新物化该连接器;直接 PUT /api/v1/meta/connector/:name(不走发布门)也会让写入的那个副本自己生效。
  • 为什么改:之前只有发布的那台副本通过本机的 metadata:reloaded 重建实例,其它副本虽然经 lane 2 收到了变更,但自动化插件的监听器只处理 flow,于是一直用旧定义直到重载或重启。
  • 风险与回滚:只是让已有监听器对 connector 变更多排一次「软」对账(与 reload 同一路径),不新增集群通道;发布方会对账两次,第二次签名不变、不重建(已测)。回滚即还原本 PR 的 plugin.ts。
  • 先看:packages/services/service-automation/src/plugin.ts(subscribeFlowMutations 里新加的 connector 分支与新方法 queueConnectorMutationReconcile);connector-definition-cluster.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/connector-definition-cluster.test.ts,预期 7/7 通过。
  • 需要你做的:无,席位落地。

What changes

AutomationServicePlugin subscribes to the metadata protocol's post-persistence signal (onMetadataMutation, #21725), and its listener returned for every type but flow. A connector definition change therefore re-materialized only where metadata:reloaded fired: on the replica that published it (ObjectQLPlugin.announcePerItemPublish). That hook is kernel-local. Lane 2 (metadata.mutated) did deliver connector/NAME into a peer's mutation listeners, as #27977 measured, and nothing there acted on it.

Now the listener also handles a connector mutation whose state is not draft (active or deleted) by queuing queueConnectorMutationReconcile: the soft reconcile metadata:reloaded runs (reconcileDeclaredConnectors(ctx, { fatal: false })), on the existing reconcile queue, so it never interleaves with a credential write or another reconcile. The reconcile re-reads the declaration from this replica's own protocol view, the same read the reload path makes. No new lane, channel or payload: a peer converges on the lane 2 replay it already receives (triage 6517791280, §6.2's single-signal rule).

Tests

packages/services/service-automation/src/connector-definition-cluster.test.ts (the #27977 two-kernel harness: real ObjectKernel, ObjectQLPlugin, driver-sql on one shared better-sqlite3 file, lanes 2 and 4 attached as the cluster bridge attaches them):

  • The automation (cluster): measure whether a published connector definition change materialises on every replica or only on the publishing one #27977 it.fails pin is now a plain it: the peer follows a published definition with no reload on the peer.
  • New: the publishing replica reconciles from both of its signals. For two publishes it runs 4 reconciles (its own metadata:reloaded plus its own mutation listener; lane 2's loopback guard drops the bus echo), and the provider is called exactly [V1, V2], so the second run is a no-op.
  • New, the card's side finding: a direct active save (saveMetaItem with no mode, the call behind PUT /api/v1/meta/connector/:name) re-materializes the writing replica and converges the peer. The same listener covers it, so it is pinned here and not widened elsewhere.
  • New: a deleted connector is torn down on both replicas.
  • New control: a draft connector save and a flow save run no connector reconcile on either replica (counted through a spy on reconcileDeclaredConnectors, attributed per plugin instance), the provider is not called again, and the flow save still arms the flow on both replicas.
  • The existing reload control now runs the peer with lane 2 off, so a metadata:reloaded is again its only trigger: the peer holds nothing before the reload and converges from its own read after it.

Acceptance notes

  • The reconcile reads the protocol's execution view with no organization, as the reload reconcile does, so an org-scoped connector mutation converges exactly as far as a reload would.
  • A held instance (a refused credential, or since fix(service-automation): end the backoff retry of a degraded connector on a configuration fault #28014 a configuration fault met on a retry) is skipped by an unchanged-signature reconcile, as on a reload. An edit of its declaration re-attempts it, now on every replica.
  • The descriptor audit (auditDeclaredConnectors, the inert-descriptor warning) still runs at kernel:ready and on metadata:reloaded only. This PR adds convergence, not another warning per save.

Verification

All readings at head 89267c8b (branched off main at 066ff51e, after #28014 merged).

Package tests and typecheck
  • pnpm --filter @objectstack/service-automation typecheck (under scripts/pm/os-verify-lock.sh): exit 0, check:test-typecheck: OK … 0 file(s) / 0 error(s). The test layer compiles under tsconfig.test.json, which includes src/**/*.test.ts.
  • pnpm --filter @objectstack/service-automation test: Test Files 223 passed (223), Tests 2846 passed (2846), lock VERDICT command-exit 0.
  • vitest run src/connector-definition-cluster.test.ts: Tests 7 passed (7).
Ablation and restore

Through scripts/ablation-replace.mjs on plugin.ts: the anchor this.queueConnectorMutationReconcile(ctx); plus the return; line after it, replaced by /* ABLATION-28002 */ return; (a connector mutation is then dropped, as on main). Anchor x1 to x0, marker x0 to x1, blob 154b06fea8a2 to 9852d936898e. The suite imports ./plugin.js from source, so no rebuild is in the path.

  • Mutated run: Tests 5 failed | 2 passed (7). Red: the flipped peer pin, the publishing-replica count, the direct save, the delete, and the draft/flow control (on its setup line, expected undefined to be 'https://v1.billing.example.test': the peer never converges, so the control's precondition cannot hold). Green: the lane 2 reach row and the lane-2-off reload control, which do not depend on the listener.
  • Restore: blob after restore equals the blob at HEAD (154b06fea8a2), and git diff HEAD is empty.
Derived gate families and lint

node scripts/pm/dispatch-gates.mjs --commands derived 60 families at 89267c8b. All were run, plus pnpm lint (exit 0). --ran: 60 derived famil(ies) accounted for — 59 run, 1 NOT-MEASURED.

  • NOT MEASURED: pnpm check:dual-build-cjs-loads, exit 3, PREREQUISITE NOT MET (it needs every package's dist; only the @objectstack/service-automation^... closure was built). CI runs it.
  • Every other derived family: exit 0.

Generated by Claude Code

…ery replica

The automation plugin's metadata-mutation listener took flow mutations
only, and metadata:reloaded is a kernel-local hook, so a connector
definition published on one replica re-materialized there alone. Queue
the soft connector reconcile the reload hook runs for a non-draft
connector mutation: lane 2's replay reaches a peer's listener, and a
direct active save, which raises no reload, now re-materializes the
writing replica too. The measurement's it.fails pin becomes a plain it.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cxbvGGSLgjTAqnkkMK
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-automation, touching 5 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/flows.mdx (via AutomationServicePlugin (symbol, a top-level class))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via AutomationServicePlugin (symbol, a top-level class), /api/v1/meta/connector/:name (route, a path literal in a comment in AutomationServicePlugin))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 58 of 210 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 7a378234c8b44f98537900941f6ab06d6f1edbd2 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from df6e7936bf02bc5d4db63a0dcabbf3a79b968d4a — the merge of head 89267c8b3ec2277857b466333136781016b023ba into base 7a378234c8b44f98537900941f6ab06d6f1edbd2, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin df6e7936bf02bc5d4db63a0dcabbf3a79b968d4a && git checkout df6e7936bf02bc5d4db63a0dcabbf3a79b968d4a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7a378234c8b44f98537900941f6ab06d6f1edbd2 89267c8b3ec2277857b466333136781016b023ba && git checkout -B drift-repro 7a378234c8b44f98537900941f6ab06d6f1edbd2 && git merge --no-ff 89267c8b3ec2277857b466333136781016b023ba

node scripts/docs-audit/affected-docs.mjs --json 7a378234c8b44f98537900941f6ab06d6f1edbd2

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 7a378234c8b44f98537900941f6ab06d6f1edbd2 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-elon-musk · session_016WV4czuTWNgKR22fKv7jia

Seat ACCEPT · PR #28028 · head 89267c8b3ec2277857b466333136781016b023ba · 2026-10-30T09:30Z

维护者速读

When one replica publishes, saves active, or deletes a connector definition, every replica now picks it up. Before, only the publishing replica rebuilt the instance, and peers kept the old one until a reload or a restart (measured on #27977). The automation plugin already received the change on every replica through lane 2 (metadata.mutated) but acted only on flows. It now queues the same connector reconcile a reload runs. No new cluster channel is added. A direct active PUT /meta/connector/:name, which raised no reload at all before, now also re-materialises the replica that wrote it.

席位核对

ACCEPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

automation (cluster): a published connector definition change re-materialises only on the publishing replica; peers keep the old instance until reload

1 participant