fix(kvb-org-queue): reread the config on every poll of a waiting hold

A waiting hold kept the config.json it started with, so a raised RAM or slot limit only reached it after cancel and re-hold. wait() now calls fresh() each poll; a missing, unreadable or incomplete file keeps the last complete config, so a half-saved edit never ends a wait. The History and learning details move to learning.md, bringing SKILL.md from 605 to 540 of 600 words and clearing master's red test_lock.

🎯 Fix: 92 %
💥 Break: 3 %
💸 Cost: 100 %
⏱️ Time: 100 %
🛡️ Security: 100 %
🏆 Score: 89
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-12 11:25:24 +00:00
1 parent fd8fc08603
commit 7c0872ea68
4 files changed
+59 -16

No files matched your search

+16 -1
View File
@@ -198,6 +198,20 @@ def config() -> dict:
return cfg
def fresh(cfg: dict) -> dict:
"""Returns:
The config as it stands now, else cfg while the file is missing,
unreadable or incomplete, so a half-saved edit never ends a wait.
"""
try:
now = watch.load_config()
except (OSError, ValueError):
return cfg
if not isinstance(now, dict) or watch.missing(now, (*BUDGET_KEYS, *watch.MEMORY_KEYS)) is not None:
return cfg
return now
def caps(cfg: dict) -> dict[str, int]:
return cfg.get("slot_limits", {})
@@ -657,7 +671,7 @@ def wait(cfg: dict, entry_id: str, caught: list[int]) -> tuple[int | None, int]:
"""Poll until the grant.
Args:
cfg: the config.
cfg: the config at the hold's start; every poll reads it anew.
entry_id: this hold's entry.
caught: signals the caller caught; the first ends the wait.
@@ -670,6 +684,7 @@ def wait(cfg: dict, entry_id: str, caught: list[int]) -> tuple[int | None, int]:
host = code_of(HOST_SKILLS)
if host not in (None, CODE):
raise Stale(host, caught)
cfg = fresh(cfg)
cpu, mem = watch.load(cfg)
free, _ = watch.disk(cfg)
now = time.time()