Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
27400b6
feat(cli): list, inspect, signal and end workflows from workflow-cli
hasithaa Nov 4, 2026
66fac08
test: drive the workflow and task queue commands on real engines
hasithaa Nov 4, 2026
092ca07
test: wait for a new search attribute before tagging workflows
hasithaa Nov 4, 2026
6e86c29
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
54501ad
fix(cli): confirm workflow changes on stderr in json mode
hasithaa Nov 5, 2026
cd29918
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
b1fd68b
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
7960237
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
a0a8cfb
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
cda18cc
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
ee63701
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 5, 2026
ae03df9
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 6, 2026
e1c8cae
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 6, 2026
a1332e1
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 6, 2026
906b5d0
fix(cli): accept engine responses up to 128 MiB
hasithaa Nov 15, 2026
a42df07
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 18, 2026
9705737
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 18, 2026
daaa9de
fix(cli): ask the engine only for the workflows --limit needs
hasithaa Nov 19, 2026
45d7402
Merge remote-tracking branch 'upstream/runtime/workflow-cli' into run…
hasithaa Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli/internal/command/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type fakeEngine struct {
notYetSeen int // AddSearchAttributes answers NotFound this many times, as for a namespace not yet cached
adminDenied bool
health *health.Server
workflows *workflowState
}

// One type per service: the generated Unimplemented servers share method names.
Expand All @@ -81,6 +82,7 @@ func newFakeEngine() *fakeEngine {
namespaces: map[string]*workflowservice.DescribeNamespaceResponse{},
attributes: map[string]map[string]enumspb.IndexedValueType{},
health: health.NewServer(),
workflows: newWorkflowState(),
}
f.health.SetServingStatus(healthServices["frontend"], healthpb.HealthCheckResponse_SERVING)
f.health.SetServingStatus(healthServices["history"], healthpb.HealthCheckResponse_NOT_SERVING)
Expand Down
7 changes: 6 additions & 1 deletion cli/internal/command/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func dial(s clientconfig.Settings) (*grpc.ClientConn, error) {
return grpc.NewClient(s.Address, opts...)
}

// maxResponseSize matches the Temporal Go SDK: a history page holds up to 256 events of up to 2 MiB each, far above
// gRPC's default 4 MiB.
const maxResponseSize = 128 << 20

func dialOptions(s clientconfig.Settings) ([]grpc.DialOption, error) {
if _, _, err := net.SplitHostPort(s.Address); err != nil {
return nil, fmt.Errorf("address %q must be host:port", s.Address)
Expand All @@ -55,7 +59,8 @@ func dialOptions(s clientconfig.Settings) ([]grpc.DialOption, error) {
}
transport = credentials.NewTLS(cfg)
}
opts := []grpc.DialOption{grpc.WithTransportCredentials(transport)}
opts := []grpc.DialOption{grpc.WithTransportCredentials(transport),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxResponseSize))}

key, err := apiKey(s)
if err != nil {
Expand Down
7 changes: 1 addition & 6 deletions cli/internal/command/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -240,9 +239,5 @@ func (c *cli) namespaceUpdateCommand() *cobra.Command {

// namespaceState shows NAMESPACE_STATE_REGISTERED as Registered.
func namespaceState(info *namespacepb.NamespaceInfo) string {
s := strings.TrimPrefix(info.GetState().String(), "NAMESPACE_STATE_")
if s == "" {
return ""
}
return s[:1] + strings.ToLower(s[1:])
return enumName(info.GetState().String(), "NAMESPACE_STATE_")
}
9 changes: 5 additions & 4 deletions cli/internal/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ func (e exitError) Error() string { return fmt.Sprintf("exit status %d", int(e))

func (c *cli) root() *cobra.Command {
root := &cobra.Command{
Use: "workflow-cli",
Short: "Operate a WSO2 Workflow Runtime engine",
Long: "workflow-cli manages a Workflow Runtime engine: its cluster, namespaces and search attributes.",
Use: "workflow-cli",
Short: "Operate a WSO2 Workflow Runtime engine",
Long: "workflow-cli manages a Workflow Runtime engine: its cluster, namespaces and search attributes, the\n" +
"workflows integrations run, and the task queues their workers poll.",
SilenceUsage: true,
SilenceErrors: true,
}
Expand All @@ -103,7 +104,7 @@ func (c *cli) root() *cobra.Command {
f.StringVarP(&c.output, "output", "o", outputText, "output format: text or json")
f.DurationVar(&c.timeout, "command-timeout", 30*time.Second, "limit for each command")

root.AddCommand(c.versionCommand(), c.operatorCommand(), c.configCommand())
root.AddCommand(c.versionCommand(), c.operatorCommand(), c.workflowCommand(), c.taskQueueCommand(), c.configCommand())
return root
}

Expand Down
85 changes: 85 additions & 0 deletions cli/internal/command/taskqueue.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package command

import (
"fmt"
"strconv"

"github.com/spf13/cobra"
enumspb "go.temporal.io/api/enums/v1"
taskqueuepb "go.temporal.io/api/taskqueue/v1"
"go.temporal.io/api/workflowservice/v1"
"google.golang.org/protobuf/proto"
)

func (c *cli) taskQueueCommand() *cobra.Command {
tq := &cobra.Command{Use: "task-queue", Short: "See which workers poll a task queue"}
tq.AddCommand(c.taskQueueDescribeCommand())
return tq
}

func (c *cli) taskQueueDescribeCommand() *cobra.Command {
var name string
cmd := &cobra.Command{
Use: "describe",
Short: "List the workers polling a task queue for workflow and activity tasks",
Long: "Lists the workers that polled --task-queue in the last five minutes. An integration's workers poll the\n" +
"task queue named in its Config.toml; an empty list means none polled recently, not that none runs.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
conn, s, ctx, cancel, err := c.connect(cmd)
if err != nil {
return err
}
defer cancel()
defer func() { _ = conn.Close() }()
client := workflowservice.NewWorkflowServiceClient(conn)
kinds := []struct {
name string
typ enumspb.TaskQueueType
}{{"workflow", enumspb.TASK_QUEUE_TYPE_WORKFLOW}, {"activity", enumspb.TASK_QUEUE_TYPE_ACTIVITY}}
var responses []proto.Message
rows := [][]string{{"TYPE", "WORKER", "LAST POLL", "RATE PER SECOND"}}
for _, k := range kinds {
res, err := client.DescribeTaskQueue(ctx, &workflowservice.DescribeTaskQueueRequest{
Namespace: s.Namespace, TaskQueue: &taskqueuepb.TaskQueue{Name: name}, TaskQueueType: k.typ,
})
if err != nil {
return fmt.Errorf("unable to describe task queue %s: %w", name, err)
}
responses = append(responses, res)
for _, p := range res.GetPollers() {
rows = append(rows, []string{k.name, p.GetIdentity(), timestamp(p.GetLastAccessTime()),
strconv.FormatFloat(p.GetRatePerSecond(), 'f', -1, 64)})
}
}
out := cmd.OutOrStdout()
if c.output == outputJSON {
return writeJSON(out, true, responses...)
}
if len(rows) == 1 {
_, err := fmt.Fprintf(out, "No worker has polled task queue %s recently.\n", name)
return err
}
return table(out, rows)
},
}
cmd.Flags().StringVarP(&name, "task-queue", "t", "", "the task queue (required)")
_ = cmd.MarkFlagRequired("task-queue")
return cmd
}
Loading
Loading