Skip to content

fix(server): wait one tick before the first queued-workflow reaper pass (RIG-11227) - #192

Merged
rigel-nemo[bot] merged 1 commit into
mainfrom
ci-pipelines/rig-11227-wait-one-tick-before-the-first-queued
Nov 21, 2026
Merged

rigel-nemo[bot] merged 1 commit into
mainfrom
ci-pipelines/rig-11227-wait-one-tick-before-the-first-queued

Conversation

@rigel-mintaka

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

Copy link
Copy Markdown
Contributor

What does this do

The queued-workflow reaper in forks/woodpecker/cmd/server/server.go now waits one full tick before its first pass, so it no longer runs at server startup. The finalized queued workflow log line now names the dependency that blocked the workflow (dependency_workflow_id).

Why do we need it

When the server restarts, agents have not reconnected yet. A reaper pass at that moment can finalize workflows that are still alive. When the reaper does finalize a workflow, the log line did not say which dependency caused it, which made stalls hard to trace.

This is a port of RigelBuild/woodpecker#181 (RIG-11227) 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

  • cmd/server/server.go: the inline loop becomes runOrphanReaper(ctx, ticks, reap). Nothing runs before the first tick. The interval is unchanged.
  • server/pipeline/pending_timeout.go: the new failedDependency helper returns the first dependency whose status alone makes ShouldRun() false, and the finalize log carries it.
  • New tests: TestRunOrphanReaperWaitsOneTickBeforeFirstPass (synctest, injected tick channel) and TestFinalizeDeadWorkflowsLogsFailedDependency (3-case table, including a failure-only dependent).

Verification

  • CGO_ENABLED=0 go test -tags test -count=1 ./cmd/server/ in forks/woodpecker: ok.
  • CGO_ENABLED=1 nix shell nixpkgs#gcc -c go test -tags test -count=1 ./server/pipeline/: ok.
  • CGO_ENABLED=0 on ./server/pipeline/ fails with sql: unknown driver "sqlite3". Those tests use the sqlite test store, so they need cgo; the failure is not from this change.
  • gofmt -l on the touched directories: clean.

Risks

After a restart, a truly orphaned workflow is finalized up to one interval later (5m by default). Rollback: revert this commit.

Spec impact

Spec-impact: none.

Checks skipped: nebula fork port; no local hook runner

Refs RIG-11227

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

…ss (RIG-11227)

The orphan reaper ran once at server startup, before agents had reconnected, and could finalize workflows that were still alive. The inline loop becomes runOrphanReaper, which waits one tick before its first pass. The interval is unchanged.

The finalized queued workflow log line now carries dependency_workflow_id, the dependency that blocked the workflow.

Ported from RigelBuild/woodpecker#181.

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

linear-code Bot commented Nov 21, 2026

Copy link
Copy Markdown

RIG-11227

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at 579c972

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

@rigel-nemo

rigel-nemo Bot commented Nov 21, 2026

Copy link
Copy Markdown

Checks read:

@rigel-nemo
rigel-nemo Bot merged commit 433584d into main Nov 21, 2026
6 of 10 checks passed
@rigel-nemo
rigel-nemo Bot deleted the ci-pipelines/rig-11227-wait-one-tick-before-the-first-queued branch November 21, 2026 14:56

This branch had an error being deployed

1 failed deployment
ci — 579c972e Deployed Nov 21, 2026 by rigel-mintaka via CI (aarch64-darwin) #898
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