Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-luna· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Woodpecker services appear to be running on UI & API after pipeline…

  1. User

    ISSUE DESCRIPTION

    Woodpecker services appear to be running on UI & API after pipeline completes

    Component

    server

    Describe the bug

    Some regression with newer releases (3.14.x) With kubernetes backend and pipelines defining services, the services are not cleaned properly. The pods from kubernetes backend are destroyed properly, but the woodpecker API still show these steps as state=running.

    These are only cleaned after the pipeline times out. This prevents timely deploys as pipeline executions are not getting green status (although, as a mitigation, the pipeline waiting services can be cancelled, after which the deploy can be made).

    Steps to reproduce

    • Install woodpecker next-d05c597374
    • Use kubernetes backend
    • Define pipeline with services running infinitely, like running postgres
    services:
      - name: postgres
        image: public.ecr.aws/docker/library/postgres:16-alpine3.21
        ports:
          - 5432
        environment:
          POSTGRES_PASSWORD: somepass
          POSTGRES_USER: someuser
          POSTGRES_DB: somedb
    steps:
      - name: wait-for-postgres
        image: public.ecr.aws/docker/library/postgres:16-alpine3.21
        environment:
          DB_HOST: postgres
          DB_PORT: 5432
          MAX_WAIT: 60
        commands:
          - ./scripts/wait-for-postgres.sh
    
    • Run the pipeline, observe pods start for the service and the step
    • once wait-for-postgres step completes, the pods are destroyed, but API still shows the service as running, also visible on Web UI.
    pr-build > clone (#2):
    Step: clone
    Started: 1779195580
    Stopped: 1779195594
    Type: clone
    State: success
    
    pr-build > postgres (#3):
    Step: postgres
    Started: 1779195594
    Stopped: 0
    Type: service
    State: running
    
    pr-build > wait-for-postgres (#4):
    Step: wait-for-postgres
    Started: 1779195596
    Stopped: 1779195602
    Type: commands
    State: success
    

    Expected behavior

    Pipeline services are stopped once the pipeline steps complete, the pipeline completes.

    System Info

    next-d05c597374
    kubernetes backend, bitbucket datacenter forge
    

    Additional context

    No response

    Validations

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /woodpecker, current file: none) bash-$

  2. Assistant

    I’ll trace pipeline/service lifecycle handling in the server, identify where service steps are finalized relative to backend cleanup, then patch the smallest appropriate area. I’ll inspect repository structure and recent history first, search for service state transitions and timeout handling, run focused tests, and use a temporary reproduction if practical.

  3. Assistant

    The initial search shows the repository is Go-based and the lifecycle is likely split between agent execution and server queue/API persistence. I’ll now locate the task execution and step update paths, especially code that treats services as non-terminal or waits for service completion.

  4. Assistant

    The failure mechanism is now clear: Kubernetes DestroyWorkflow deletes the service pod, but WaitStep only observes terminal pod-phase updates. A detached service’s background goroutine remains blocked until the workflow context times out, so its terminal trace is never sent before the agent calls Done. I’ll make runtime teardown cancel the workflow execution context before backend destruction, and make canceled waits produce an exited terminal state, allowing detached service goroutines to destroy/trace promptly.

  5. Assistant

    The patch is in place. It preserves caller cancellation semantics by wrapping the supplied context, cancels only once at workflow teardown, and marks cancellation-derived waits as exited so the RPC tracer sends Exited=true and the server can finalize the step. The focused test command is currently blocked by the environment because neither GOMODCACHE nor GOPATH is configured; I’ll check available cache/tooling and run what is possible, then inspect for compile/test edge cases.

  6. Assistant

    With the repository’s cache paths explicitly configured, the affected Kubernetes backend, RPC, and pipeline packages pass. Runtime tests are gated behind the test build tag, so I’ll run those as well, including the existing unbounded-service regression coverage.

  7. Assistant

    The runtime test suite exposed one compatibility issue in my first implementation: an existing test (and likely callers) expects Runtime.ctx to remain the exact context passed to WithContext. I corrected this by keeping that field unchanged and using a separate cleanup context solely to interrupt WaitStep; all runtime tests now pass, including the unbounded detached/service cases. I’ll do a final focused package run and review the diff.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.