Skip to content

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

Closed
rigel-mintaka wants to merge 1 commit into
rigel-releasefrom
ci-pipelines/rig-11161-stop-a-blocked-step-wait-at-the-workflow
Closed

rigel-mintaka wants to merge 1 commit into
rigel-releasefrom
ci-pipelines/rig-11161-stop-a-blocked-step-wait-at-the-workflow

Conversation

@rigel-mintaka

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

Copy link
Copy Markdown

What does this do

Makes waitForLogs in 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.

The overrun this targets was not proven to come from the log drain: no agent logs survive for that window. The fix closes the one unbounded wait on the step path. Runs that were still writing output were killed on time, so the deadline already works when the log stream is flowing.

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

  • go test -race -tags test -count=20 ./pipeline/runtime/: ok.
  • Fresh clone on rigel-release, cgo via nix gcc: go test -race -tags test -count=3 ./pipeline/runtime/: ok.
  • Both new deadline tests fail on the old step.go with "workflow hung past its deadline".
  • -race -count=50 -cpu=1,2 on the deadline and step tests: ok.

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.

Spec impact

Spec-impact: none.

Checks skipped: p0:RIG-9887

Refs RIG-11161

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

…161)

waitForLogs drained the step log stream with an unbounded wait, so a stalled stream or a blocked log send held the step past the workflow deadline. The wait now also returns when the workflow context is done. WaitStep and the stage already honor the context.

Co-Authored-By: Matt Wilkinson <matt@rigel.build>

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

linear-code Bot commented Nov 20, 2026

Copy link
Copy Markdown

RIG-11161

@rigel-mintaka

Copy link
Copy Markdown
Author

Moved to RigelBuild/nebula#190 (RIG-10145 fork archive).

rigel-nemo Bot pushed a commit to RigelBuild/nebula that referenced this pull request Nov 22, 2026
…161) (#190)

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>
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