Skip to content

fix: add memory safety caps and file watcher filtering (#259)#495

Merged
bradygaster merged 1 commit intodevfrom
squad/259-vscode-crash-investigation
Mar 22, 2026
Merged

fix: add memory safety caps and file watcher filtering (#259)#495
bradygaster merged 1 commit intodevfrom
squad/259-vscode-crash-investigation

Conversation

@bradygaster
Copy link
Copy Markdown
Owner

Summary

Investigates and mitigates resource-pressure patterns that could contribute to VS Code crashes during Squad execution.

Origin: Issue #259 (reported in Discussion #174 by @diberry)

Audit findings

Vector Risk Status
Unbounded usageData array in StreamingPipeline Medium Fixed - capped at 1,000 events (FIFO)
Unbounded telemetry queue in TelemetryCollector Medium Fixed - capped at 500 events (FIFO)
File watcher (SquadObserver) with no ignore filter Medium Fixed - filters orchestration-log/ and .git/
Stream buffer accumulation Low Already mitigated (1MB cap in MemoryManager)
Process spawning Low All processes properly tracked and cleaned up
Terminal output rate Low Ink framework batches renders
Synchronous I/O Low Startup-only, not in hot paths

Changes

  • streaming.ts: Add MAX_USAGE_EVENTS = 1000 cap with FIFO eviction
  • telemetry.ts: Add MAX_QUEUE_SIZE = 500 cap with FIFO eviction
  • squad-observer.ts: Filter orchestration-log/ and .git/ from watcher events
  • vscode-troubleshooting.md: New reference doc with root cause analysis and user-facing troubleshooting steps

Conclusion

The VS Code crash is most likely a VS Code Nightly renderer issue amplified by resource pressure from long-running Squad sessions. The fixes here reduce Squad memory and watcher footprint. The troubleshooting doc provides users with actionable mitigations.

Working as EECOM (Core Dev)

Closes #259

Audit and mitigate resource-pressure patterns that could contribute to
VS Code crashes during Squad execution (Issue #259, Discussion #174).

Changes:
- StreamingPipeline: cap usageData array at 1000 events (FIFO eviction)
- TelemetryCollector: cap event queue at 500 events (FIFO eviction)
- SquadObserver: filter orchestration-log/ and .git/ from fs.watch events
- Add docs/reference/vscode-troubleshooting.md with root cause analysis,
  mitigations, and user-facing troubleshooting steps

Closes #259

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster bradygaster merged commit cbabc5a into dev Mar 22, 2026
1 of 2 checks passed
chrislomonico pushed a commit to clomonico/squad that referenced this pull request Mar 26, 2026
Session: 2026-02-24T07-30-00Z-wave-d-batch1-impl
Requested by: Coordinator

Changes:
- Logged orchestration for Cheritto (bradygaster#488, PR bradygaster#495): Unified Status Display
- Logged orchestration for Fortier (bradygaster#493, PR bradygaster#494): StreamBuffer Cleanup on Error
- Logged orchestration for Kovash (bradygaster#491, PR bradygaster#496): Message History Cap
- Session log: Wave D batch 1 implementation summary
- Decision inbox: empty (no new decisions to merge)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate: VS Code crash during Squad execution

1 participant