Skip to content

fix(agent): stop a blocked step wait at the workflow deadline (RIG-11161) - #190

Merged
rigel-nemo[bot] merged 1 commit into
mainfrom
ci-pipelines/rig-11161-stop-a-blocked-step-wait-at-the-workflow
Nov 22, 2026
Merged

rigel-nemo[bot] merged 1 commit into
mainfrom
ci-pipelines/rig-11161-stop-a-blocked-step-wait-at-the-workflow

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this do

Makes waitForLogs in forks/woodpecker/pipeline/runtime/step.go return when the workflow context is done, not only when the log drain finishes.

Why do we need it

The step log drain was waited on with no bound. A stalled log stream, or a blocked log send, could hold a step, its stage and Run past the workflow deadline. WaitStep and the stage already honor the context; this wait was the gap.

This is a port of RigelBuild/woodpecker#179 (RIG-11161) into the nebula monorepo under forks/woodpecker/, as part of the RIG-10145 fork archive. The old PR is closed with a pointer to this one.

Summary

  • While the context is live, the wait behaves as before, so normal runs still deliver every log line.
  • After the deadline, the step returns. The drain finishes or fails in the background; the backends' destroy calls close its stream.
  • New pipeline/runtime/step_deadline_test.go covers a stalled stream and a blocked log send.

Verification

  • CGO_ENABLED=0 go test -tags test -count=1 ./pipeline/runtime/ in forks/woodpecker: ok.
  • Diff stat against the old PR: 166 insertions and 8 deletions, against 165 and 8 in the old PR. The extra line is a comment on the discarded rc.Close() error, per the no-error-swallow rule.
  • Not run: -race and the -count soak from the old PR. Not run on the nebula base.

Risks

A step stopped at the deadline may lose its last few log lines, because destroy can close the pipe before the drain reads them. The server still accepts late lines for five minutes. Rollback: revert this commit.

Spec impact

Spec-impact: none.

Checks skipped: nebula fork port; no local hook runner

Refs RIG-11161

Co-authored-by: Matt Wilkinson matt@rigel.build

…161)

Make waitForLogs in pipeline/runtime/step.go return when the workflow context is done, not only when the log drain finishes. The drain was waited on with no bound, so a stalled log stream or a blocked log send could hold a step past the workflow deadline.

Ported from RigelBuild/woodpecker#179. Adds step_deadline_test.go with the stalled-stream and blocked-send cases.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 21, 2026

Copy link
Copy Markdown

RIG-11161

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at 6184c78

Review round 1: 0 high, 0 medium, 0 low.

  • Fidelity: the diff matches fix(agent): stop a blocked step wait at the workflow deadline (RIG-11161) woodpecker#179 hunk for hunk, apart from the forks/woodpecker/ prefix. The only extra line is the one-line reason on the discarded rc.Close() error.
  • The old PR had no review findings to carry over.
  • Both detached and blocking steps go through completeStep, so both get the bounded wait.
  • step_deadline_test.go fails on the main version of step.go (both cases hang past the deadline) and passes at this head.
  • Run in forks/woodpecker: CGO_ENABLED=0 go test -tags test -count=1 ./pipeline/runtime/ ok. go test -race -count=5 -run TestWorkflowDeadline ok.
  • Body: no private-repo references.

@rigel-nemo

rigel-nemo Bot commented Nov 22, 2026

Copy link
Copy Markdown

Checks read:

@rigel-nemo
rigel-nemo Bot merged commit 3e9b611 into main Nov 22, 2026
6 of 10 checks passed
@rigel-nemo
rigel-nemo Bot deleted the ci-pipelines/rig-11161-stop-a-blocked-step-wait-at-the-workflow branch November 22, 2026 02:07

This branch had an error being deployed

1 failed deployment
ci — 6184c78c Deployed Nov 21, 2026 by rigel-mintaka via CI (aarch64-darwin) #894
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant