Align publish flows with KA lifecycle#1275
Conversation
1f13a36 to
8c9bec6
Compare
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Verification reviewer failed: 2026-06-21T21:19:13.063828Z ERROR rmcp::transport::worker: worker quit with fatal: Transport channel closed, when UnexpectedServerResponse("HTTP 401: {\n "error": {\n "message": "Your authentication token has been invalidated. Please try signing in again.",\n "type": "invalid_request_error",\n "code": "token_invalidated",\n "param": null\n },\n "status": 401\n}")
Details omitted because the failure output was 1469 characters. Check the local Review Agent logs for the reviewer event and output files.
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: 2026-06-21T21:19:37.183386Z ERROR rmcp::transport::worker: worker quit with fatal: Transport channel closed, when UnexpectedServerResponse("HTTP 401: {\n "error": {\n "message": "Your authentication token has been invalidated. Please try signing in again.",\n "type": "invalid_request_error",\n "code": "token_invalidated",\n "param": null\n },\n "status": 401\n}")
Details omitted because the failure output was 1471 characters. Check the local Review Agent logs for the reviewer event and output files.
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Verification reviewer failed: retry_exhausted
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: retry_exhausted
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: retry_exhausted
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: retry_exhausted
b6fc66e to
52cedc1
Compare
939a8af to
cedf002
Compare
cedf002 to
28d2f74
Compare
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: retry_exhausted
| // let `resolveKaUal` throw (failing the update) — which is the | ||
| // correct behavior when chain-truth is required but unavailable. | ||
| const labelMeta = this.graphManager.metaGraphUri(contextGraphId); | ||
| const labelMeta = contextGraphMetaUri(contextGraphId, options.subGraphName); |
There was a problem hiding this comment.
🔴 Bug: Sub-graph updates now pass options.subGraphName into contextGraphMetaUri, but that helper's second argument is a context/on-chain partition id and builds <cg>/context/<value>/_meta, not the KA label metadata graph used by publish/history. As a result, a queued sub-graph update can write the refreshed UAL/root/merkle metadata into an unqueried graph while the existing root _meta metadata remains stale; the prior-root lookup above has the same issue. Keep the label metadata graph aligned with publish, for example this.graphManager.metaGraphUri(contextGraphId) or an explicit target meta graph, and use subGraphName only for the data graph.
| sealMerkleRoot: `0x${'12'.repeat(32)}`, | ||
| intentKey: `sha256:${'ab'.repeat(32)}`, | ||
| }), | ||
| preflightKnowledgeAssetVmPublishSnapshot: async () => { |
There was a problem hiding this comment.
🔴 Bug: This is the only negative coverage for stale/missing async VM publish snapshots, but it stubs preflightKnowledgeAssetVmPublishSnapshot to throw, so a regression in the real snapshot preflight would still pass. Add a test that uses the real store/snapshot path with a missing or stale shareOperationId and asserts /vm/publish-async returns 409 without enqueuing.
| } | ||
|
|
||
| export interface LiftRequest { | ||
| readonly jobType?: 'lift' | 'knowledge-asset-vm-publish'; |
There was a problem hiding this comment.
🟡 Issue: LiftRequest is being widened with an optional jobType plus an optional knowledgeAssetVmPublish payload, which creates an invalid intermediate state (jobType: 'knowledge-asset-vm-publish' with no payload, or a payload on a normal lift). The implementation already compensates with scattered jobType branches and knowledgeAssetVmPublish null checks across the async publisher. This should be modeled as a discriminated union, e.g. RawLiftRequest | KnowledgeAssetVmPublishLiftRequest, with the KA payload required in the KA branch and per-job handling dispatched from that type. That would make the boundary explicit and remove several of the special-case checks this PR adds.
| .option('--transition-type <value>', 'Transition type (CREATE|MUTATE|REVOKE)', 'CREATE') | ||
| .option('--authority-type <value>', 'Authority type (owner|multisig|quorum|capability)', 'owner') | ||
| .option('--prior-version <value>', 'Prior version reference for MUTATE/REVOKE flows') | ||
| .command('publish-async <context-graph> <name>') |
There was a problem hiding this comment.
🟡 Issue: This new user-facing replacement for publisher enqueue has no CLI invocation coverage; the tests only check the suggested text and the lower-level API client/route. Add a CLI smoke or command test that runs dkg publisher publish-async <cg> <name> with options like --sub-graph/--publish-epochs and verifies it calls the expected endpoint and prints the accepted job.
Summary
POST /api/knowledge-assets/:name/vm/publish-asyncas the async VM publish entrypoint.Related
feat/api-agent-tooling-cleanup.Files changed
packages/cli/src/daemon/routes/knowledge-assets.tsvm/publish-asyncand lifecycle-shaped batch rejection route.packages/cli/src/daemon/routes/memory.tspackages/cli/src/daemon/routes/publisher.tspackages/agent/src/dkg-agent-publish.ts/packages/agent/src/dkg-agent.tspackages/publisher/src/*packages/cli/src/api-client.ts, source-worker runners, OpenClaw adapter, node-ui, network sim, benchmarksscripts/*.shand devnet helperspackages/*/test/*README.md,ARCHITECTURE.md,docs/**,agent-docs/**Test plan
pnpm --filter @origintrail-official/dkg-publisher run buildpnpm --filter @origintrail-official/dkg-agent run buildpnpm --filter @origintrail-official/dkg run buildpnpm --filter @origintrail-official/dkg-node-ui run buildpnpm --filter @origintrail-official/dkg-publisher test -- test/async-lift-publisher.test.ts test/metadata.test.ts --reporter verbosepnpm --filter @origintrail-official/dkg test -- test/api-client.test.ts test/source-worker-daemon-client.test.ts test/source-worker-runner.test.ts --reporter verbosepnpm --filter @origintrail-official/dkg test -- test/daemon-http-behavior-extra.test.ts --reporter verbosepnpm --filter @origintrail-official/dkg test -- test/daemon-http-behavior-extra.test.ts test/issue-306-787-write-quad-validation.test.ts test/assertion-cli-smoke.test.ts test/memory-graph-events.test.ts --reporter verbosepnpm --filter @origintrail-official/dkg-agent test -- test/e2e-memory-layers.test.ts -t 'skipSeal share stays unsealed' --reporter verbosepnpm --filter @origintrail-official/dkg-node-ui test -- test/chat-memory.test.ts test/chat-memory-persistence-regression.test.ts --reporter verbosebash -n scripts/*.shnode --check scripts/testnet-publish-stress/publish-loop.mjs; node --check scripts/dkg-v10-implementation-time-accounting.mjs; node --check scripts/dkg-v10-decisions.mjs; node --check scripts/dkg-v10-decision-time-accounting.mjsgit diff --checkpnpm --filter @origintrail-official/dkg run buildpnpm --filter @origintrail-official/dkg-publisher test -- test/async-lift-publisher.test.ts test/metadata.test.ts --reporter verbosepnpm --filter @origintrail-official/dkg test -- test/api-client.test.ts test/daemon-http-behavior-extra.test.ts --reporter verbose/api/shared-memory/*write/publish and raw/api/publisher/enqueuecallers.