mirror of
https://github.com/open-webui/terminals.git
synced 2026-11-05 01:37:21 +00:00
[PR #47] [CLOSED] fix: apply policy idle_timeout_minutes to containers adopted via reconcile() #61
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#61
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/47
Author: @Classic298
Created: 7/20/2026
Status: ❌ Closed
Base:
main← Head:claude/idle-reaper-timeout-policy-6tlabg📝 Commits (1)
3f8a3aefix: apply policy idle_timeout_minutes to containers adopted via reconcile()📊 Changes
3 files changed (+52 additions, -5 deletions)
View changed files
📝
terminals/backends/base.py(+40 -0)📝
terminals/backends/docker.py(+5 -3)📝
terminals/backends/kubernetes.py(+7 -2)📄 Description
After an orchestrator restart, reconcile() rebuilt _instances and _activity but never populated _specs, so re-adopted containers resolved their idle timeout via the settings.idle_timeout_minutes fallback (default 0 = disabled) and were skipped by the idle reaper forever. They leaked until the Docker bridge hit its 1024-port cap and provisioning broke.
Resolve the merged policy spec from the openwebui.com/policy label during reconciliation (one cached lookup per distinct policy) and store it in _specs, in both the Docker and Kubernetes backends. A policy that can't be resolved — e.g. the implicit "default" policy — degrades to an empty spec, matching a provision without a policy spec.
Also record wall-clock activity alongside the monotonic timestamp when adopting, so GET /api/v1/terminals no longer reports a null last_active_at for adopted containers. The idle clock still restarts at adoption time since last activity isn't persisted anywhere; adopted idle containers are now reaped after at most one full timeout window.
Fixes #45
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.