PR #1332 — Unified Fix + Background Monitoring

v7.41.1 · 13 commits · Closes #1137 #1138 #1279 #1333 #1334 #1335

9Bug Fixes
4Security Alerts
2New Hooks
7588Tests Passing
172Total Hooks
Bug Fixes
Security
New Hooks
Review Findings

#1137 — 3 HIGH Memory Bugs

FixFileIssueResolution
Apattern-sync-push.ts:75Dedup .map(p=>p.text) puts undefined in Setfilter(Boolean) + require .text
Bsession-tracker.ts:631sanitizeForStorage recurses foreverDepth param, truncation marker at >10
Cdecision-processor.ts + user-intent-detector.tsRegex [^.,!?\n]+ truncates at comma[^.!?\n]+ across 48 patterns in 2 files

#1138 — 5 MEDIUM Memory Bugs

FixFileIssueResolution
Dworkflow-preference-learner.ts:252Mixed patterns skippedRecord for trend analysis
Epattern-extractor.ts:165Misses heredoc/--message= commitsReordered regex chain + new patterns
Fcode-style-learner.ts:137Type hints matched in commentsStrip comments/docstrings first
Gfeedback-loop.ts:318Math.random() ID collisioncrypto.randomUUID()
Hdecision-flow-tracker.ts:346OR instead of AND, div-by-zeroAND + guard + threshold 0.3→0.4

#1279 — Auto-Lint Revert Loop

FixFileIssueResolution
Iauto-lint.ts:106No git add after format → edit loopSHA-256 hash guard + git add if changed

4 Code Scanning Alerts Resolved

AlertScannerFileFix
#138/#139CodeQLpool-setup-template.py:221JSONResponse with sanitized output
#143Scorecardorchestkit-eval.yml:77nosemgrep annotation
#145Scorecardplugin-validation.yml:293Already annotated (verified)

#1333 — Agent Watchdog

SubagentStop async hook. On each agent completion, scans remaining active agents:

ElapsedAction
< 5 minSilent — no action
5–10 minsystemMessage WARNING
> 10 minsystemMessage CRITICAL + suggest Ctrl+F

#1334 — Cron Guard

PreToolUse hook on CronCreate. Blocks in CI/headless:

SignalAction
CLAUDE_CODE_DISABLE_CRON=1Block
CI=trueBlock
GITHUB_ACTIONS=trueBlock
GITLAB_CI=trueBlock
CODEBUILD_BUILD_IDBlock
Interactive sessionAllow

#1335 — ScheduleWakeup Reference

Cache-aware delay guidance: 270s (warm), never 300s, 1200s (idle). Decision tree vs CronCreate.

Self-Review Findings (Fixed)

SeverityFindingFix
SECsanitizeForStorage returned raw obj at depth >10Return {_truncated} marker
QAhashBefore outside try/catch → crash on deleted fileWrapped in try/catch + early return
QAextractRationale always undefined (g flag + .match()).exec() with lastIndex reset
QAComma test had conditional assertionexpect().toBeDefined()