fix: Claude Code 2.1.1 compatibility + log-level audit + path validation fixes (#614)
* Refactor CLAUDE.md and related files for December 2025 updates - Updated CLAUDE.md in src/services/worker with new entries for December 2025, including changes to Search.ts, GeminiAgent.ts, SDKAgent.ts, and SessionManager.ts. - Revised CLAUDE.md in src/shared to reflect updates and new entries for December 2025, including paths.ts and worker-utils.ts. - Modified hook-constants.ts to clarify exit codes and their behaviors. - Added comprehensive hooks reference documentation for Claude Code, detailing usage, events, and examples. - Created initial CLAUDE.md files in various directories to track recent activity. * fix: Merge user-message-hook output into context-hook hookSpecificOutput - Add footer message to additionalContext in context-hook.ts - Remove user-message-hook from SessionStart hooks array - Fixes issue where stderr+exit(1) approach was silently discarded Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update logs and documentation for recent plugin and worker service changes - Added detailed logs for worker service activities from Dec 10, 2025 to Jan 7, 2026, including initialization patterns, cleanup confirmations, and diagnostic logging. - Updated plugin documentation with recent activities, including plugin synchronization and configuration changes from Dec 3, 2025 to Jan 7, 2026. - Enhanced the context hook and worker service logs to reflect improvements and fixes in the plugin architecture. - Documented the migration and verification processes for the Claude memory system and its integration with the marketplace. * Refactor hooks architecture and remove deprecated user-message-hook - Updated hook configurations in CLAUDE.md and hooks.json to reflect changes in session start behavior. - Removed user-message-hook functionality as it is no longer utilized in Claude Code 2.1.0; context is now injected silently. - Enhanced context-hook to handle session context injection without user-visible messages. - Cleaned up documentation across multiple files to align with the new hook structure and removed references to obsolete hooks. - Adjusted timing and command execution for hooks to improve performance and reliability. * fix: Address PR #610 review issues - Replace USER_MESSAGE_ONLY test with BLOCKING_ERROR test in hook-constants.test.ts - Standardize Claude Code 2.1.0 note wording across all three documentation files - Exclude deprecated user-message-hook.ts from logger-usage-standards test Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Remove hardcoded fake token counts from context injection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Address PR #610 review issues by fixing test files, standardizing documentation notes, and verifying code quality improvements. * fix: Add path validation to CLAUDE.md distribution to prevent invalid directory creation - Add isValidPathForClaudeMd() function to reject invalid paths: - Tilde paths (~) that Node.js doesn't expand - URLs (http://, https://) - Paths with spaces (likely command text or PR references) - Paths with # (GitHub issue/PR references) - Relative paths that escape project boundary - Integrate validation in updateFolderClaudeMdFiles loop - Add 6 unit tests for path validation - Update .gitignore to prevent accidental commit of malformed directories - Clean up existing invalid directories (~/, PR #610..., git diff..., https:) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: Implement path validation in CLAUDE.md generation to prevent invalid directory creation - Added `isValidPathForClaudeMd()` function to validate file paths in `src/utils/claude-md-utils.ts`. - Integrated path validation in `updateFolderClaudeMdFiles` to skip invalid paths. - Added 6 new unit tests in `tests/utils/claude-md-utils.test.ts` to cover various rejection cases. - Updated `.gitignore` to prevent tracking of invalid directories. - Cleaned up existing invalid directories in the repository. * feat: Promote critical WARN logs to ERROR level across codebase Comprehensive log-level audit promoting 38+ WARN messages to ERROR for improved debugging and incident response: - Parser: observation type errors, data contamination - SDK/Agents: empty init responses (Gemini, OpenRouter) - Worker/Queue: session recovery, auto-recovery failures - Chroma: sync failures, search failures (now treated as critical) - SQLite: search failures (primary data store) - Session/Generator: failures, missing context - Infrastructure: shutdown, process management failures - File Operations: CLAUDE.md updates, config reads - Branch Management: recovery checkout failures Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix: Address PR #614 review issues - Remove incorrectly tracked tilde-prefixed files from git - Fix absolute path validation to check projectRoot boundaries - Add test coverage for absolute path validation edge cases Closes review issues: - Issue 1: ~/ prefixed files removed from tracking - Issue 3: Absolute paths now validated against projectRoot - Issue 4: Added 3 new test cases for absolute path scenarios Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * build assets and context --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+11
-131
@@ -3,139 +3,19 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 22, 2025
|
||||
|
||||
**SDKAgent.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31951 | 8:17 PM | 🟣 | Mode System with Inheritance and Multilingual Support | ~776 |
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31891 | 7:17 PM | 🔴 | Migration des prompts de résumé vers les fichiers de modes pour le support multilingue | ~474 |
|
||||
| #31890 | " | 🔵 | Modifications en cours sur les fichiers de modes multilingues et le système de prompts | ~325 |
|
||||
| #31872 | 7:04 PM | 🔄 | Externalisation des prompts de résumé codés en dur | ~378 |
|
||||
| #31868 | 7:03 PM | 🔵 | サマリープロンプトのハードコーディング箇所の特定 | ~193 |
|
||||
| #31829 | 6:28 PM | 🔄 | Removed languageNote usage from continuation observation XML template | ~90 |
|
||||
| #31828 | " | 🔄 | Removed languageNote variable from buildContinuationPrompt | ~199 |
|
||||
| #31827 | " | 🔄 | Removed languageNote usage from summary XML template | ~79 |
|
||||
| #31826 | " | 🔄 | Removed unused languageNote variable from buildSummaryPrompt | ~198 |
|
||||
| #31825 | 6:26 PM | 🔄 | Removed unused languageNote variable from buildInitPrompt | ~278 |
|
||||
| #31820 | 6:20 PM | 🔵 | Prompts system architecture uses mode.prompts.format_examples field | ~305 |
|
||||
| #31816 | 6:10 PM | 🔄 | Extracted memory continuation header to mode configuration | ~236 |
|
||||
| #31815 | 6:09 PM | 🔄 | Extracted continuation instruction to mode configuration | ~252 |
|
||||
| #31814 | " | 🔄 | Extracted continuation greeting to mode configuration | ~306 |
|
||||
| #31813 | 6:08 PM | 🔄 | Removed hardcoded language instruction from buildSummaryPrompt | ~291 |
|
||||
| #31812 | " | 🔄 | Replaced all XML placeholder text with mode configuration variables | ~459 |
|
||||
| #31811 | " | 🔄 | Replaced hardcoded memory processing header with mode variable | ~252 |
|
||||
|
||||
**parser.test.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #31855 | 6:53 PM | ✅ | テストスイートの大規模削除とテスト分析レポートの追加 | ~197 |
|
||||
|
||||
### Dec 23, 2025
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32030 | 7:44 PM | 🔵 | SDK prompt building system uses mode configuration | ~330 |
|
||||
|
||||
**parser.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32029 | 7:40 PM | 🔵 | Parser Layer Has No Skip Logic - Always Saves Observations | ~342 |
|
||||
|
||||
### Dec 24, 2025
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32213 | 8:17 PM | 🔵 | Prompt Generation System Architecture | ~402 |
|
||||
| #32337 | 4:03 PM | ✅ | Enhanced observation prompt with granularity reminder | ~278 |
|
||||
|
||||
### Dec 25, 2025
|
||||
|
||||
**parser.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32701 | 9:00 PM | 🔵 | Test Coverage Report Generated | ~471 |
|
||||
| #32565 | 8:19 PM | 🔵 | Read parser.ts (first 150 lines) | ~146 |
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #32558 | 8:18 PM | 🔵 | Identified files containing 'summary' or 'Summary' | ~167 |
|
||||
|
||||
### Dec 27, 2025
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33131 | 7:52 PM | 🔵 | Session ID Propagation Flow Analysis with Architectural Vulnerabilities Identified | ~577 |
|
||||
| #33129 | " | 🔵 | Prompt Building Functions with Session ID Threading Documentation | ~483 |
|
||||
|
||||
### Dec 28, 2025
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #33438 | 10:15 PM | 🔄 | Bulk Rename Session ID Fields Across Entire Codebase | ~384 |
|
||||
| #33420 | 10:06 PM | 🔵 | Complete session ID flow analysis reveals missing SDK session capture mechanism | ~545 |
|
||||
| #33415 | 10:05 PM | 🔵 | Prompt building functions receive sessionId but only use it for context display | ~372 |
|
||||
| #33316 | 3:09 PM | 🔴 | Fixed Disconnected SDK Agent Sessions | ~350 |
|
||||
| #33296 | 3:08 PM | 🔵 | Session ID Propagation Flow Architecture Traced Through Codebase | ~720 |
|
||||
|
||||
### Dec 30, 2025
|
||||
|
||||
**parser.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34462 | 2:23 PM | 🔵 | Code Quality Review Identifies Critical V2 Migration Issues | ~418 |
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34398 | 1:53 PM | 🔵 | SDK Prompts Module Structure | ~361 |
|
||||
|
||||
### Jan 1, 2026
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35666 | 11:37 PM | ✅ | Staged error handling improvements across 10 files | ~261 |
|
||||
| #35641 | 11:27 PM | ✅ | Added APPROVED OVERRIDE comments for JSON parse error handling in SDK prompts | ~336 |
|
||||
|
||||
### Jan 2, 2026
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35901 | 2:49 PM | 🔵 | PR #525 File Changes Summary | ~376 |
|
||||
| #35770 | 1:23 PM | ✅ | Last User Message Field Removed Across 11 Files in Codebase | ~374 |
|
||||
| #35763 | 1:22 PM | 🔄 | Removed last_user_message from SDKSession interface | ~241 |
|
||||
| #35762 | 1:21 PM | 🔵 | SDKSession interface includes last_user_message field | ~221 |
|
||||
| #35742 | 1:15 PM | 🔵 | SDKSession interface defines both user_prompt and last_user_message fields | ~289 |
|
||||
| #35738 | 1:12 PM | 🔵 | Summary prompt uses last_assistant_message but not last_user_message | ~334 |
|
||||
| #35737 | " | 🔵 | Summary Prompt Interface Defines Optional last_user_message | ~253 |
|
||||
| #35736 | " | 🔵 | SDKSession Interface Defines Optional last_user_message Field | ~277 |
|
||||
| #35733 | 1:11 PM | 🔵 | Located last_user_message usage across codebase | ~333 |
|
||||
|
||||
### Jan 3, 2026
|
||||
|
||||
**parser.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36200 | 7:22 PM | 🔵 | Parser Module Analysis for Phase 2 Refactoring | ~562 |
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**prompts.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37613 | 5:31 PM | 🔵 | PR #558 Review Feedback Analysis | ~544 |
|
||||
| #37571 | 4:51 PM | ✅ | Phase 1 Anti-Pattern Check Complete - Clean Implementation | ~400 |
|
||||
| #37557 | 4:49 PM | 🔵 | Issue #545 Bug Location and Fix Pattern Documented | ~462 |
|
||||
| #37539 | 4:45 PM | 🔵 | SDK Defensive JSON Parsing Pattern Implementation | ~408 |
|
||||
| #37703 | 6:01 PM | 🔵 | ParsedObservation files_read and files_modified are string arrays parsed from XML | ~330 |
|
||||
| #37701 | " | 🔵 | Complete cwd data flow traced from hooks through observation processing | ~447 |
|
||||
|
||||
### Jan 7, 2026
|
||||
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38467 | 10:29 PM | ⚖️ | Log Level Audit Strategy: Tighten ERROR Messages for Runtime Issue Discovery | ~464 |
|
||||
| #38454 | 10:26 PM | 🔵 | happyPathError usage pattern in summary prompt generation | ~421 |
|
||||
| #38405 | 10:07 PM | ⚖️ | DEBUG Log Level Analysis - One Message Requires WARN Promotion | ~819 |
|
||||
| #38404 | 10:06 PM | ⚖️ | Log Level Audit Analysis - WARN to ERROR Promotion Criteria Established | ~769 |
|
||||
</claude-mem-context>
|
||||
+3
-3
@@ -63,10 +63,10 @@ export function parseObservations(text: string, correlationId?: string): ParsedO
|
||||
if (validTypes.includes(type.trim())) {
|
||||
finalType = type.trim();
|
||||
} else {
|
||||
logger.warn('PARSER', `Invalid observation type: ${type}, using "${fallbackType}"`, { correlationId });
|
||||
logger.error('PARSER', `Invalid observation type: ${type}, using "${fallbackType}"`, { correlationId });
|
||||
}
|
||||
} else {
|
||||
logger.warn('PARSER', `Observation missing type field, using "${fallbackType}"`, { correlationId });
|
||||
logger.error('PARSER', `Observation missing type field, using "${fallbackType}"`, { correlationId });
|
||||
}
|
||||
|
||||
// All other fields are optional - save whatever we have
|
||||
@@ -75,7 +75,7 @@ export function parseObservations(text: string, correlationId?: string): ParsedO
|
||||
const cleanedConcepts = concepts.filter(c => c !== finalType);
|
||||
|
||||
if (cleanedConcepts.length !== concepts.length) {
|
||||
logger.warn('PARSER', 'Removed observation type from concepts array', {
|
||||
logger.error('PARSER', 'Removed observation type from concepts array', {
|
||||
correlationId,
|
||||
type: finalType,
|
||||
originalConcepts: concepts,
|
||||
|
||||
+6
-7
@@ -123,13 +123,12 @@ export function buildObservationPrompt(obs: Observation): string {
|
||||
* Build prompt to generate progress summary
|
||||
*/
|
||||
export function buildSummaryPrompt(session: SDKSession, mode: ModeConfig): string {
|
||||
const lastAssistantMessage = session.last_assistant_message || logger.happyPathError(
|
||||
'SDK',
|
||||
'Missing last_assistant_message in session for summary prompt',
|
||||
{ sessionId: session.id },
|
||||
undefined,
|
||||
''
|
||||
);
|
||||
const lastAssistantMessage = session.last_assistant_message || (() => {
|
||||
logger.error('SDK', 'Missing last_assistant_message in session for summary prompt', {
|
||||
sessionId: session.id
|
||||
});
|
||||
return '';
|
||||
})();
|
||||
|
||||
return `${mode.prompts.header_summary_checkpoint}
|
||||
${mode.prompts.summary_instruction}
|
||||
|
||||
Reference in New Issue
Block a user