Closed
Conversation
Reviewer's GuideThis PR adjusts PodShell’s executeWithRetry and WebSocket failure handling to restore previous shell execution behavior: it now retries until any stdout/stderr is produced, returns the last successful result instead of throwing after retries, and ignores onFailure events during pod startup to avoid fail-fast behavior. Sequence diagram for updated executeWithRetry shell execution behaviorsequenceDiagram
actor Caller
participant PodShell
participant PodShellOutput
Caller->>PodShell: executeWithRetry(retryCount, retryDelay, commands)
loop attempts 1..retryCount
PodShell->>PodShell: execute(commands)
alt execute succeeds
PodShell-->>PodShellOutput: PodShellOutput pso
PodShell->>PodShell: lastSuccessfulResult = pso
alt stdout or stderr present
PodShell-->>Caller: return pso
note over Caller,PodShell: break
else no stdout and no stderr
alt attempt < retryCount
PodShell->>PodShell: Thread.sleep(retryDelay)
else attempt == retryCount
PodShell-->>Caller: return lastSuccessfulResult
note over Caller,PodShell: break
end
end
else execute throws WaiterException
PodShell-->>PodShell: catch WaiterException e
alt attempt >= retryCount
PodShell-->>Caller: throw WaiterException
note over Caller,PodShell: break
else attempt < retryCount
PodShell->>PodShell: Thread.sleep(retryDelay)
end
end
end
Updated class diagram for PodShell retry and failure handlingclassDiagram
class PodShell {
- String podName
+ PodShellOutput execute(String commands)
+ PodShellOutput executeWithRetry(int retryCount, int retryDelay, String commands)
}
class PodShellOutput {
+ String getOutput()
+ String getError()
+ List getOutputAsList()
}
class WaiterException {
}
class PodExecWebSocketListener {
+ void onOpen()
+ void onFailure(Throwable throwable, Response response)
}
PodShell --> PodShellOutput : uses
PodShell --> WaiterException : throws
PodExecWebSocketListener --> PodShell : notifies
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
executeWithRetry, consider defensively handling the case wherelastSuccessfulResultis still null before returning (e.g., throw a clear exception) so the method remains robust against future changes that might alter the retry loop behavior. - In
onFailure, completely suppressing bothexecutionDone.set(true)and logging may make failures hard to diagnose; consider at least a low-level (debug/trace) log or a comment explicitly stating under what conditions it is safe to ignore failures here.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `executeWithRetry`, consider defensively handling the case where `lastSuccessfulResult` is still null before returning (e.g., throw a clear exception) so the method remains robust against future changes that might alter the retry loop behavior.
- In `onFailure`, completely suppressing both `executionDone.set(true)` and logging may make failures hard to diagnose; consider at least a low-level (debug/trace) log or a comment explicitly stating under what conditions it is safe to ignore failures here.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Author
|
I'm currently unable to replicate this problem on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport for #637
Summary by Sourcery
Restore previous pod shell execution retry semantics to avoid failing fast on pod startup and preserve the last successful command result.
Bug Fixes:
Enhancements: