← Back to PRs

#3392: fix(hooks): remove debug console.log statements from session-memory hook

by WinJayX open 2026-01-28 14:56 View on GitHub →
## Summary Remove development debug `console.log` statements from the session-memory hook handler. These debug statements were polluting the console output during normal operation. ## Changes - Remove 13 debug `console.log` statements that were logging internal state (sessionId, sessionFile, slug generation steps, etc.) - Add proper `SubsystemLogger` for trace-level logging of completion message - Keep `console.error` for actual failure cases (consistent with other bundled hooks like `command-logger`) - Remove unused `currentSessionId` variable that was only used for logging ## Why The session-memory hook contained numerous debug statements that were likely left over from development/debugging: ```typescript console.log("[session-memory] Hook triggered for /new command"); console.log("[session-memory] Current sessionId:", currentSessionId); console.log("[session-memory] Generated slug:", slug); // ... 10 more similar statements ``` These statements pollute the console during normal operation and don't follow the project's standard logging infrastructure. ## After The hook now uses `createSubsystemLogger("hooks:session-memory")` for any operational logging, which: - Can be enabled via log level configuration when debugging is needed - Follows the same pattern used by other parts of the codebase (e.g., `gmail-watcher`) - Keeps the console clean during normal operation ## Testing - [x] TypeScript compilation passes - [x] Lint check passes (0 warnings, 0 errors) - [x] All 9 session-memory hook tests pass <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR cleans up `src/hooks/bundled/session-memory/handler.ts` by removing leftover debug `console.log` statements and switching the “success/completion” message to the project’s `SubsystemLogger` (`createSubsystemLogger("hooks:session-memory")`) at `trace` level. The hook’s error reporting remains `console.error` in the catch block, keeping user-facing console output clean while still enabling opt-in operational logging via configured log levels/subsystem filtering. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - Changes are limited to removing noisy debug output and routing a completion message through the existing logging subsystem; no control flow or data handling is altered. The added logger usage follows established patterns in the repo and should not affect runtime unless trace logs are enabled. - No files require special attention <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs