Skip to content

Conversation

@pratap0007
Copy link
Contributor

When streaming pipelineRun or taskRun logs, closing the stop channel to terminate the informer was causing "Failed to watch" error messages to be logged with "context canceled". This was noisy and confusing
for users even though it was expected behavior during intentional
shutdown.

This patch add custom watchErrorHandler function that filter out context.Canceled errors while passing other errors to the default handler. This prevents the error log messages when the CLI intentionally stops watching after a run completes.

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

Fix `fialed to watch` context canceled error when streaming logs

@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 9, 2025
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 9, 2025
@pratap0007 pratap0007 force-pushed the fix-pr-log-err branch 2 times, most recently from 40e0002 to 5a77d7b Compare December 9, 2025 16:34
@pratap0007
Copy link
Contributor Author

/retest

@pratap0007
Copy link
Contributor Author

cc: @divyansh42

Copy link
Member

@divyansh42 divyansh42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this.
Changes looks good to me, I just added a minor comment.

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/client-go/tools/cache"
k8scache "k8s.io/client-go/tools/cache"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor] Any specific reason for this rename?
I can see in other files we are using cache so this will be a bit unconsistent.

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: divyansh42
To complete the pull request process, please ask for approval from pratap0007 after the PR has been reviewed.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

When streaming pipelineRun or taskRun logs, closing the stop channel
to terminate the informer was causing "Failed to watch" error messages
to be logged with "context canceled".

This patch add custom watchErrorHandler function that filter out context.Canceled
errors while passing other errors to the default handler. This prevents the error
log messages when the CLI intentionally stops watching after a run completes.

Signed-off-by: Shiv Verma <shverma@redhat.com>
@divyansh42
Copy link
Member

/lgtm
/cc @vdemeester

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants