[PR #47] [CLOSED] fix: apply policy idle_timeout_minutes to containers adopted via reconcile() #61

Closed
opened 2026-10-18 21:13:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 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)

  • 3f8a3ae fix: 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

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/terminals/pull/47 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 7/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `claude/idle-reaper-timeout-policy-6tlabg` --- ### 📝 Commits (1) - [`3f8a3ae`](https://github.com/open-webui/terminals/commit/3f8a3ae44d0ca2d51130927733df34fae1383b6d) fix: apply policy idle_timeout_minutes to containers adopted via reconcile() ### 📊 Changes **3 files changed** (+52 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `terminals/backends/base.py` (+40 -0) 📝 `terminals/backends/docker.py` (+5 -3) 📝 `terminals/backends/kubernetes.py` (+7 -2) </details> ### 📄 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 <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. Your PR will NOT be reviewed or merged until you check the box below confirming that you have read and agree to the terms of the CLA. --> - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](./CLA.md), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:13:54 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/terminals#61
No description provided.