Problem
Two correctness issues:
-
Timer leak: IssueTracker.timer is invalidated in stop() but there's no deinit that calls stop(). If the IssueTracker is deallocated without explicit stop(), the timer leaks (weak self prevents crashes but the timer keeps firing).
-
Terminal readiness cleanup: When a session is deleted (SessionService.deleteSession), appState.terminalReadiness entries for that session's terminals are not cleaned up, leading to stale entries accumulating over time.
-
Hard-coded 5s shell readiness delay in TerminalManager.surfaceDidCreate() — a TODO in the code documents this should use actual readiness detection.
Proposed Improvement
- Add
deinit to IssueTracker that calls stop()
- Clean up
terminalReadiness and autoLaunchTerminals entries in deleteSession()
- (Lower priority) Replace 5s delay with a probe-based readiness check
Effort
Low (30 min for items 1–2; item 3 is a separate medium effort).
Files Affected
Sources/Crow/App/IssueTracker.swift (add deinit)
Sources/Crow/App/SessionService.swift (cleanup in deleteSession)
Packages/CrowTerminal/Sources/CrowTerminal/TerminalManager.swift (readiness probe — future)
Priority: 9/10
Problem
Two correctness issues:
Timer leak:
IssueTracker.timeris invalidated instop()but there's nodeinitthat callsstop(). If the IssueTracker is deallocated without explicitstop(), the timer leaks (weak self prevents crashes but the timer keeps firing).Terminal readiness cleanup: When a session is deleted (
SessionService.deleteSession),appState.terminalReadinessentries for that session's terminals are not cleaned up, leading to stale entries accumulating over time.Hard-coded 5s shell readiness delay in
TerminalManager.surfaceDidCreate()— a TODO in the code documents this should use actual readiness detection.Proposed Improvement
deinitto IssueTracker that callsstop()terminalReadinessandautoLaunchTerminalsentries indeleteSession()Effort
Low (30 min for items 1–2; item 3 is a separate medium effort).
Files Affected
Sources/Crow/App/IssueTracker.swift(add deinit)Sources/Crow/App/SessionService.swift(cleanup in deleteSession)Packages/CrowTerminal/Sources/CrowTerminal/TerminalManager.swift(readiness probe — future)Priority: 9/10