Skip to content

Timeout change breaks existing job configuration and prevents changing these jobs #299

Description

@nikgoodley-ibboost

Jenkins and plugins versions report

Environment
Jenkins: 2.568.2
OS: Linux - 5.14.0-687.31.1.el9_8.x86_64
Java: 25.0.3 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
PrioritySorter:936.937.v5581d0b_2ccb_a_
adoptopenjdk:167.vf71ff2140e23
...
ssh:158.ve2a_e90fb_7319
ssh-agent:416.v4d76015a_5d68
ssh-credentials:372.va_250881b_08cd
ssh-slaves:3.1097.v868116049892
ssh-steps:2.0.92.vb_a_0583935f9b_
ssh2easy:1.6
sshd:3.384.vc89b_5e138cf9
structs:362.va_b_695ef4fdf9
...

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux. Controller

Reproduction steps

The latest 416 plugin version breaks existing SSH agent utilising jobs. After updates we saw failures like these

14:12:00 [ssh-agent] Looking for ssh-agent implementation...
14:12:00 $ ssh-agent
14:12:00 SSH_AUTH_SOCK=/tmp/ssh-XXXXXXsKIKq1/agent.2862
14:12:00 SSH_AGENT_PID=2865
14:12:00 [ssh-agent] Started.
14:12:00 Running ssh-add (command line suppressed)
14:12:00 ERROR: Timeout after 0 minutes
14:12:00 $ ssh-agent -k
14:12:00 unset SSH_AUTH_SOCK;
14:12:00 unset SSH_AGENT_PID;
14:12:00 echo Agent pid 2865 killed;
14:12:00 ERROR: Timeout after 0 minutes
14:12:00 [ssh-agent] Stopped.

Found it was due to this plugin update, but wondered why it still worked on another instance and that was because I'd regenerated jobs with the DSL. However I am unable to do that in all cases and worse I cannot even manually make this change because after the prompt to add a comment from my save the UI console does not change at all, and that is because of the config for the job being invalid. This is shown in the controller log as

2026-08-08T13:48:02.464647047Z [2026-08-08 13:48:02][WARNING][org.kohsuke.stapler.framework.adjunct.AdjunctsInPage findNeeded] No such adjunct found: lib.form.hetero-list.hetero-list
2026-08-08T13:48:02.464647047Z org.kohsuke.stapler.framework.adjunct.NoSuchAdjunctException: Neither lib.form.hetero-list.hetero-list.css, .js, .html, nor .jelly were found
2026-08-08T13:48:02.464647047Z  at org.kohsuke.stapler.framework.adjunct.Adjunct.<init>(Adjunct.java:127)
2026-08-08T13:48:02.464647047Z  at org.kohsuke.stapler.framework.adjunct.AdjunctManager.get(AdjunctManager.java:154)
2026-08-08T13:48:02.464647047Z  at org.kohsuke.stapler.framework.adjunct.AdjunctsInPage.findNeeded(AdjunctsInPage.java:169)
2026-08-08T13:48:02.464647047Z  at org.kohsuke.stapler.framework.adjunct.AdjunctsInPage.assumeIncluded(AdjunctsInPage.java:135)
2026-08-08T13:48:02.464647047Z  at org.kohsuke.stapler.framework.adjunct.AdjunctsInPage.assumeIncluded(AdjunctsInPage.java:129)
2026-08-08T13:48:02.464647047Z  at hudson.widgets.RenderOnDemandClosure$1$1.createContext(RenderOnDemandClosure.java:116)
2026-08-08T13:48:02.464647047Z  at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:64)
...

Expected Results

I can edit my jobs and run my previously working jobs with failure.

Actual Results

I can neither manually edit my jobs nor will they run successfully as the timeout of 0 seconds is used.

Anything else?

I believe this issue comes from aaa827a

It seems it improperly instantiates new jobs that use the plugin but have not been saved or generated with this updated plugin in place with an initial value of 0 and this is unsupported (presumably enforced by the attribute on the .jelly defining a min of 1?)

If I look at the config.xml on disk it shows this (on an older job, but any job created before this new plugin was in place that uses SSH agent plugin has the issue)

$ tail config.xml.bkp
      <colorMapName>xterm</colorMapName>
    </hudson.plugins.ansicolor.AnsiColorBuildWrapper>
    <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper plugin="[email protected]">
      <credentialIds>
        <string>UH-UH</string>
      </credentialIds>
      <ignoreMissing>false</ignoreMissing>
    </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
  </buildWrappers>
</project>

Then when I open (only!) the job configuration in the UI it changes to this

$ tail config.xml
    </hudson.plugins.ansicolor.AnsiColorBuildWrapper>
    <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper plugin="[email protected]_5d68">
      <credentialIds>
        <string>HMMMM</string>
      </credentialIds>
      <ignoreMissing>false</ignoreMissing>
      <timeout>0</timeout>
    </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
  </buildWrappers>
</project

(Quite why the act of observing mutates the job is a different discussion but it's always been that way to my knowledge; the fact is it does seem to persist when you do this. However jobs that have never been viewed also fail with the timeout=0 message.)

Then this job can no longer be saved.

I then manually modify the file on disk to have a value of 1 and not 0 then run this in script console

import javax.xml.transform.stream.StreamSource
import java.io.FileInputStream
import java.io.File

def jobName = "<MY JOB>"
def job = Jenkins.instance.getItemByFullName(jobName)

if (job != null) {
    def configFile = new File(job.getRootDir(), "config.xml")
    
    // Force Jenkins to read this specific file and update the job in memory
    job.updateByXml(new StreamSource(new FileInputStream(configFile)))
    job.save()
    
    println "Success! Forcefully updated job from disk."
} else {
    println "Error: Job not found."
}

then I can save it through the UI.

This value matches what I would see in a non-ssh-agent-using job that I then add the configuration too.

So it seems to me improper initialisation of defaults somehow.

Are you interested in contributing a fix?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions