feat(lifecycle): ResourceLifecycleRegistry — unified disposal + tool circuit breaker + memory breaker + retention cleanup - #1
Open
hernandez42 wants to merge 1 commit into
Conversation
…emoryCircuitBreaker, RetentionPolicy Phase 1-5 of resource lifecycle management: - ResourceLifecycleRegistry: unified disposable interface with priority-ordered disposeAll, getOpenHandles() smoke test, 3s per-resource timeout - ToolCallCircuitBreaker: after 3x same (toolName+validationError) failures, breaker opens with exponential backoff (60s→480s capped) - MemoryCircuitBreaker: APEX-MEM circuit breaker with half-open probe, read-only health check (SQLite integrity, memories/FTS count alignment, BM25 max_doc alignment) - RetentionPolicy: TTL-based cleanup for .pilotdeck-always-on/ (7d), .agi-output/ (30d), .cci-output/ (30d); count-based for always-on dirs Files: src/lifecycle/disposable/ResourceLifecycleRegistry.ts src/lifecycle/disposable/index.ts src/lifecycle/retention/RetentionPolicy.ts src/lifecycle/retention/index.ts src/tool/protocol/circuitBreaker.ts src/memory/health/CircuitBreakerHealthCheck.ts src/memory/health/index.ts Fixes: P0 resource orphans (Playwright/MCP/background tasks), P1 tool loop spinning, P2 directory accumulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resource Lifecycle / 资源泄露修复方案
PilotDeck has no unified resource lifecycle management. This PR adds the core primitives:
Files added
Key APIs
Next steps
ΔG improvement estimate: +330