Repository navigation
Description
[Bug] External NATS JetStream: OpenCloud downgrades main-queue replication from R3 to R1
Describe the bug
When OpenCloud is connected to an external 3-node NATS JetStream cluster, the main-queue stream is automatically downgraded from 3 replicas (R3) to 1 replica (R1).
Even when main-queue is manually configured with num_replicas: 3, an OpenCloud service initialization or restart can change its configuration back to num_replicas: 1.
This defeats the high-availability setup of the external NATS cluster. If the NATS node hosting the stream becomes unavailable, the stream may no longer be available.
Environment
- OpenCloud: 9.x (external NATS configuration)
- NATS Server: 2.15.0
- NATS Go client: 1.54.0
- NATS topology: 3-node cluster with JetStream enabled
- OpenCloud deployment: multiple services / instances
- Event stream:
main-queue
OpenCloud is configured to use an external NATS cluster rather than its embedded NATS server.
Steps to reproduce
-
Set up a 3-node NATS cluster with JetStream enabled.
-
Configure OpenCloud to use this external NATS cluster.
-
Start OpenCloud and allow it to initialize its NATS streams.
-
Manually change the
main-queuestream replication factor to 3:nats stream edit main-queue --replicas 3
-
Verify the stream configuration:
nats stream info main-queue
The stream should report
num_replicas: 3. -
Restart an OpenCloud service, or wait for the service initialization/reconnection that triggers the issue.
-
Check the stream configuration again.
Actual behavior
The main-queue stream is changed back to num_replicas: 1.
JetStream API audit logs identify the OpenCloud storage-users:bus client as the source of the operation.
The following sequence was captured on the NATS cluster:
1. The OpenCloud client attempts to create the stream
API subject:
$JS.API.STREAM.CREATE.main-queue
Client:
name: storage-users:bus
user: opencloud
The request contains:
{
"name": "main-queue",
"retention": "limits",
"storage": "file",
"num_replicas": 0
}NATS returns:
{
"error": {
"code": 400,
"err_code": 10058,
"description": "stream name already in use with a different configuration"
}
}2. Immediately afterwards, the same OpenCloud client updates the existing stream
API subject:
$JS.API.STREAM.UPDATE.main-queue
The API audit response confirms that the resulting stream configuration is:
{
"config": {
"name": "main-queue",
"num_replicas": 1
}
}This sequence was captured on October 30, 2026, at 14:48:19 UTC.
The API audit identifies the client as storage-users:bus, rather than an external NATS administrator or another NATS client.
Expected behavior
OpenCloud should not silently downgrade the replication factor of an existing JetStream stream.
Ideally:
- The replication factor of JetStream streams managed by OpenCloud should be configurable.
- An administrator should be able to specify
num_replicas: 3for a 3-node NATS cluster. - Existing streams configured with a higher replication factor should not be silently downgraded during service initialization or reconnection.
- The configured replication factor should be consistently applied when streams are created or updated.
For example, an environment variable such as OC_EVENTS_REPLICAS=3 could be provided, or an equivalent configuration option.
It would also be useful to have the same configuration capability for other OpenCloud-managed JetStream streams and KV buckets.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Don't reset main-queue settings on startup
micbar commentedon Nov 11, 2026
Needs review.