Skip to content

Conversation

@6543
Copy link
Member

@6543 6543 commented Jan 25, 2026

currently if we cancel we get the grpc client on Wait() returns an err witch marks the pipeline failed:
image
with this patch we propper ignore that ... but now it shows success:
image
wat i expect is:
image

this state is initially as souch but after some time it gets updated to success ... i think it's related to the issue we sometimes see pipelines marked as success but they failed etc...

read more at #2875


close #833
close

wip: #3848, #2062, #6024

@6543 6543 added the wip label Jan 25, 2026
@6543
Copy link
Member Author

6543 commented Jan 25, 2026

also when Wait() does not return err the step does not get cancled in the background either till it finished ?!?
-> we need special case where wait err is nil but ctx is cancled handled propperly

@6543
Copy link
Member Author

6543 commented Jan 25, 2026

related work #3850

@codecov

This comment was marked as off-topic.

@qwerty287
Copy link
Contributor

That's nothing new…

There's a summary issue for the whole pipeline canceling: #2875

@6543
Copy link
Member Author

6543 commented Jan 25, 2026

https://github.com/6543-forks/woodpecker/blob/1b74c2baa6dd8b67577510d3dd85246ffd24d60c/agent/runner.go#L102-L113

@qwerty287 I'll work on that now ... will take some time i guess to get through all of it :)

@6543 6543 mentioned this pull request Jan 25, 2026
…hed and refactored by us a lot and now is mosty ours
@6543 6543 changed the title Blocked: Rework step status signaling WIP: Rework step status signaling Jan 27, 2026
@6543

This comment was marked as resolved.

return err
switch {
case strings.Contains(err.Error(), "desc = queue: task canceled"):
return pipeline.ErrCancel
Copy link
Member Author

Choose a reason for hiding this comment

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

we should make that signal explicit and not relay on an queue error msg

int64 finished = 2;
string error = 3;
bool canceled = 4;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

needs more thought: should we have enum so we can signal who has canceled ... if the server canceled it or the agent e.g. because of an agent shouldown

Copy link
Member Author

Choose a reason for hiding this comment

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

similar to #6024 ... or handled by it ...

)

// Peer defines a peer-to-peer connection.
// TODO: suffix Next, Wait, Init, Done and Extend with "Workflow" for docu purpose
Copy link
Member Author

Choose a reason for hiding this comment

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

this needs more docu!

Copy link
Contributor

Choose a reason for hiding this comment

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

// Peer defines the RPC interface between an agent and the Woodpecker server.
//
// It is responsible for coordinating workflow execution, including:
//   - Fetching workflows from the queue
//   - Reporting workflow and step state transitions
//   - Handling workflow completion and cancellation
//
// Method naming intentionally omits explicit "Workflow" suffixes to keep the API concise.
// The workflow or step context is defined by the parameters of each method.

Copy link
Member Author

Choose a reason for hiding this comment

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

// - Handling workflow completion and cancellation

duplicate to aboth

we should instead mention how Wait blocks and how ... but tjat is subject to change

also we should prefux the interface

var workflowsToCancel []string
for _, w := range workflows {
if w.State == model.StatusRunning || w.State == model.StatusPending {
workflowsToCancel = append(workflowsToCancel, fmt.Sprint(w.ID))
Copy link
Member Author

Choose a reason for hiding this comment

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

in case the agent just crashed hard... and you cancle it the steps always stay at state "running" ... we should do a cleanup here too...

@6543
Copy link
Member Author

6543 commented Jan 28, 2026

TODOs:

services dont report back when they are finished:
image

similar issue for detached steps:
image

because both are just droped into the background:

// nothing else to do, this is a detached process.
if step.Detached {
return nil, nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent bug Something isn't working server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancle a Running Pipeline update status as failed

4 participants