mirror of
https://github.com/open-webui/terminals.git
synced 2026-11-05 01:37:21 +00:00
[PR #16] [MERGED] fix: auto-recover errored terminal CRs in operator backend #49
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/terminals#49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/terminals/pull/16
Author: @james-westbrook
Created: 3/31/2026
Status: ✅ Merged
Merged: 4/1/2026
Merged by: @tjbck
Base:
main← Head:fix-k8s-errored-terminals📝 Commits (1)
22bddc0fix: auto-recover errored terminal CRs in operator backend📊 Changes
1 file changed (+6 additions, -1 deletions)
View changed files
📝
terminals/backends/kubernetes_operator.py(+6 -1)📄 Description
Description
Problem
When the operator backend encounters an existing Terminal CR stuck in
phase: Error, it falls through to the "still provisioning" wait path, which polls for up to 120 seconds waiting for the CR to reachRunning. Since the operator will never recover an Error-phase CR on its own, this always times out and returns a 502 to the user.This was discovered during EKS E2E testing. A transient pod failure (e.g. EBS volume attachment timeout, readiness probe deadline exceeded) caused a Terminal CR to enter
phase: Errorwithreason: PodNotReady. On subsequent requests for the same user, the orchestrator found the existing Error CR via a 409 conflict on create, returned it, and then waited indefinitely for it to becomeRunning— which never happened.The only recovery path was manual deletion of the stale CR (
kubectl delete terminals.openwebui.com <name>).Fix
In
ensure_terminal(), theIdlephase already triggers a delete-and-reprovision cycle. This PR extends that same handling to theErrorphase:When a user requests a terminal and the existing CR is in
Error, the orchestrator now:RunningTesting
Verified on both Kind (local) and EKS (us-west-2) clusters, with both the Kubernetes backend and Kubernetes Operator backend performing as expected after this change.
The bug was originally caught when a first test run left Alice's Terminal CR in
Errorphase. A subsequent test run failed (all Alice-related: provision timeout, execute timeout, file ops timeout) because the stale CR was never cleaned up. After applying this fix, the orchestrator auto-recovers and all manual tests pass.Changed files
terminals/backends/kubernetes_operator.py— extendIdle-phase delete-and-reprovision to also coverErrorphaseContributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.