wf: faster list, IDs-only output, and quieter port-forward teardown#1643
Open
JoshVanL wants to merge 2 commits into
Open
wf: faster list, IDs-only output, and quieter port-forward teardown#1643JoshVanL wants to merge 2 commits into
JoshVanL wants to merge 2 commits into
Conversation
- workflow list: fetch per-instance metadata concurrently via errgroup (cap 32 in-flight) instead of serially, which was the bottleneck for apps with many instances. - workflow list: add `-o ids` output, which skips the metadata fetch entirely and prints one instance ID per line. Errors out if combined with filters since those require metadata. - portforward: filter out the noisy klog "Unhandled Error" lines emitted by client-go during teardown for benign "broken pipe", "connection reset by peer", and "use of closed network connection" cases, while letting all other errors fall through to the default handlers. Signed-off-by: joshvanl <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR improves workflow instance listing performance and ergonomics, and reduces noisy Kubernetes port-forward teardown logs in the CLI.
Changes:
- Speed up
workflow listby fetching per-instance workflow metadata concurrently (errgroup with a concurrency cap). - Add
workflow list -o idsto print instance IDs only (skipping metadata fetch) and reject filters that require metadata. - Filter out known-benign “Unhandled Error” klog lines emitted by client-go during port-forward teardown, while preserving default handling for other errors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/list.go | Adds ListIDs, introduces concurrent metadata fetch with an errgroup limit, and keeps output sorted. |
| pkg/kubernetes/portforward.go | Wraps apimachinery global error handlers to suppress known-benign teardown error strings. |
| cmd/workflow/workflow.go | Extends --output validation/usage to support additional formats (including ids). |
| cmd/workflow/list.go | Implements -o ids output path and blocks combining it with metadata-dependent filters. |
| go.mod | Promotes golang.org/x/sync to a direct dependency for errgroup usage. |
Comments suppressed due to low confidence (1)
pkg/workflow/list.go:234
- Because
listOutputis built concurrently, its initial order is nondeterministic. The subsequentsort.SliceStableonly comparesCreated, so workflows with identicalCreatedtimestamps will appear in a random order run-to-run. Add a deterministic tie-breaker (e.g., compareInstanceIDwhenCreatedis equal) or preserve the original index when collecting results.
sort.SliceStable(listOutput, func(i, j int) bool {
if listOutput[i].Created.IsZero() {
return false
}
if listOutput[j].Created.IsZero() {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: joshvanl <[email protected]>
acroca
reviewed
May 14, 2026
| return nil, err | ||
| } | ||
|
|
||
| sort.Strings(ids) |
Member
There was a problem hiding this comment.
Is it the default order by creation time? I think I'd keep it in whatever order we receive, the user can always sort if they need it sorted for any reason.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-o idsoutput, which skips the metadata fetch entirely and prints one instance ID per line. Errors out if combined with filters since those require metadata.by client-go during teardown for benign "broken pipe", "connection reset by peer", and "use of closed network connection" cases, while letting all other errors fall through to the default handlers.