Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Fix subscription agent timeout cleanup
rcourtmanba90475e5965
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 637b64203d..11c250739d 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -467,7 +467,10 @@ minimum configured request allowance for local subscription turns. Because theCLI response is buffered and cannot expose intermediate chunks, a positiveprovider `StreamIdleTimeout` is an earlier complete-turn deadline for thistransport; the configured minimum must not override that caller-owned Patrol-stall budget. Patrol tool-call+stall budget. Command cleanup after cancellation or process exit is also+bounded: a subscription CLI descendant that inherits an output pipe must not+extend the caller-owned deadline until that descendant exits independently.+Patrol tool-callpreflight owns one route-aware outer deadline: API providers retain the30-second budget, while local subscription agents receive a bounded two-minutebudget for CLI startup and complete structured-output assembly, and Ollama or adiff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 678a055d70..4b1e269616 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -1455,7 +1455,9 @@ version. It follows stable `v6.2.1`, supersedes `v6.2.2-rc.2`, usescandidate retains the complete earlier packet and adds durable scoped Patrolobjectives, validated read-only observers, verified work receipts, agent actionpreflight with stable refusal codes, large-estate response improvements, and-monitoring correctness fixes. The changes since `v6.2.2-rc.2` do not require a+monitoring correctness fixes. Subscription-backed Patrol turns also bound+command cleanup after an idle deadline so descendant-held output pipes cannot+extend the caller-owned stall budget. The changes since `v6.2.2-rc.2` do not require aPulse Mobile client change and preserve the existing mobile, Relay, onboarding,and mobile-facing API contracts, so the server cut is classified`no-mobile-impact`; no companion upload or public mobile-store rollout is partdiff --git a/docs/releases/RELEASE_NOTES_v6.2.2-rc.3.md b/docs/releases/RELEASE_NOTES_v6.2.2-rc.3.mdindex fcd60d482a..24a3b61ef8 100644--- a/docs/releases/RELEASE_NOTES_v6.2.2-rc.3.md+++ b/docs/releases/RELEASE_NOTES_v6.2.2-rc.3.md@@ -44,6 +44,8 @@ correctness fixes.repeated large-estate scans.- OpenRouter, Ollama, and subscription-backed Patrol routes handle reasoninglimits, readiness checks, deadlines, and continuation latency more reliably.+- Subscription-backed turns now complete their idle timeout promptly even when+ a canceled CLI descendant still holds an inherited output pipe open.## Fixeddiff --git a/docs/releases/V6_CHANGELOG_v6.2.2-rc.3.md b/docs/releases/V6_CHANGELOG_v6.2.2-rc.3.mdindex af0836b757..fec52469db 100644--- a/docs/releases/V6_CHANGELOG_v6.2.2-rc.3.md+++ b/docs/releases/V6_CHANGELOG_v6.2.2-rc.3.md@@ -23,6 +23,8 @@ _This changelog describes the changes since `v6.2.2-rc.2`.large-estate polling and resource correlation use bounded or indexed paths.- Runtime version identity is bound to the packaged binary rather than a stalesource-tree value.+- Buffered subscription CLI turns cannot extend a caller-owned idle deadline+ while a canceled descendant keeps an inherited output pipe open.## Fixeddiff --git a/internal/ai/providers/subscription_agent.go b/internal/ai/providers/subscription_agent.goindex 404cbed54e..576eac2fe1 100644--- a/internal/ai/providers/subscription_agent.go+++ b/internal/ai/providers/subscription_agent.go@@ -31,6 +31,11 @@ const (// Caller cancellation still wins, and Patrol preflight applies its own// route-aware outer deadline.SubscriptionAgentMinimumRequestTimeout = 2 * time.Minute+ // subscriptionAgentCommandWaitDelay bounds cleanup after cancellation or+ // process exit. Subscription CLIs may spawn descendants that inherit output+ // pipes; without a wait delay those descendants can extend a completed+ // context deadline until they close the pipes themselves.+ subscriptionAgentCommandWaitDelay = 250 * time.MillisecondmaxSubscriptionAgentPromptBytes = 4 << 20maxSubscriptionAgentOutputBytes = 8 << 20@@ -424,6 +429,7 @@ func (c *SubscriptionAgentClient) run(ctx context.Context, name string, args []sstdout := cappedBuffer{maxBytes: maxSubscriptionAgentOutputBytes}stderr := cappedBuffer{maxBytes: maxSubscriptionAgentOutputBytes}cmd.Stdout, cmd.Stderr = &stdout, &stderr+ cmd.WaitDelay = subscriptionAgentCommandWaitDelayif err := cmd.Run(); err != nil {if ctx.Err() != nil {return nil, fmt.Errorf("%s subscription agent timed out: %w", name, ctx.Err())diff --git a/internal/ai/providers/subscription_agent_test.go b/internal/ai/providers/subscription_agent_test.goindex 9bb019d69a..94f91ababb 100644--- a/internal/ai/providers/subscription_agent_test.go+++ b/internal/ai/providers/subscription_agent_test.go@@ -64,14 +64,16 @@ exit 0t.Setenv("PATH", binDir+string(os.PathListSeparator)+os.Getenv("PATH"))client := NewSubscriptionAgentClient(SubscriptionAgentCodex, "gpt-5.6-luna", 3*time.Minute)+ idleTimeout := 50 * time.Millisecondstarted := time.Now()- _, err := client.Chat(context.Background(), ChatRequest{StreamIdleTimeout: 50 * time.Millisecond})+ _, err := client.Chat(context.Background(), ChatRequest{StreamIdleTimeout: idleTimeout})elapsed := time.Since(started)if err == nil || !strings.Contains(err.Error(), "context deadline exceeded") {t.Fatalf("buffered turn error = %v, want stream-idle deadline", err)}- if elapsed >= time.Second {- t.Fatalf("buffered turn ignored 50ms stream-idle deadline; elapsed=%s", elapsed)+ cleanupCeiling := idleTimeout + subscriptionAgentCommandWaitDelay + 700*time.Millisecond+ if elapsed >= cleanupCeiling {+ t.Fatalf("buffered turn exceeded stream-idle cleanup ceiling %s; elapsed=%s", cleanupCeiling, elapsed)}}diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.goindex 50711b11d1..43058cb01a 100644--- a/scripts/installtests/build_release_assets_test.go+++ b/scripts/installtests/build_release_assets_test.go@@ -656,6 +656,7 @@ func TestCurrentSupportPrereleasePacketTracksInstallMetadata(t *testing.T) {"Patrol now works from durable outcomes, scoped investigations","Read-only observers extend Patrol coverage between full model investigations","Action refusal telemetry now classifies target changes, prerequisites, contract failures",+ "Subscription-backed turns now complete their idle timeout promptly","The rollback target is `v"+previous+"`","The changes since `v"+previousCandidate+"` do not require a Pulse Mobile client change","preserve the existing mobile, Relay, onboarding, and mobile-facing API contracts",