Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .aiox-core/core/memory/gotchas-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ class GotchasMemory extends EventEmitter {
errorPattern: errorData.message,
category: this._detectCategory(errorData.message + ' ' + (errorData.stack || '')),
};
} else if (now - tracking.lastSeen >= this.options.errorWindowMs) {
// Window expired — reset count so only errors within the rolling window
// contribute toward the auto-capture threshold (fixes #475)
tracking.count = 0;
tracking.firstSeen = now;
tracking.samples = [];

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the error window expires and tracking is reset, the errorPattern and category fields are lost but not reinitialized. These fields are used later in _autoCaptureGotcha (line 677). Consider preserving these fields when resetting the window, or ensure they're re-computed when needed. The current implementation will cause tracking.category to be undefined after a window reset, which could affect auto-captured gotchas.

Suggested change
tracking.samples = [];
tracking.samples = [];
// Ensure metadata used by _autoCaptureGotcha is up to date after reset
tracking.errorPattern = errorData.message;
tracking.category = this._detectCategory(errorData.message + ' ' + (errorData.stack || ''));

Copilot uses AI. Check for mistakes.
}

// Update tracking
Expand Down Expand Up @@ -311,10 +317,13 @@ class GotchasMemory extends EventEmitter {
gotchas = gotchas.filter((g) => !g.resolved);
}

// Sort by severity (critical first), then by last occurrence
// Sort by severity (critical first), then by last occurrence.
// Use ?? not || so that 0 (critical) is not treated as falsy (fixes #476)
const severityOrder = { critical: 0, warning: 1, info: 2 };
gotchas.sort((a, b) => {
const severityDiff = (severityOrder[a.severity] || 2) - (severityOrder[b.severity] || 2);
const aSev = severityOrder[a.severity] ?? 2;
const bSev = severityOrder[b.severity] ?? 2;
const severityDiff = aSev - bSev;
if (severityDiff !== 0) return severityDiff;
return new Date(b.source.lastSeen) - new Date(a.source.lastSeen);
});
Expand Down
6 changes: 3 additions & 3 deletions .aiox-core/install-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# - File types for categorization
#
version: 5.0.3
generated_at: "2026-03-11T15:04:09.395Z"
generated_at: "2026-03-13T00:47:14.973Z"
generator: scripts/generate-install-manifest.js
file_count: 1090
files:
Expand Down Expand Up @@ -789,9 +789,9 @@ files:
type: core
size: 8850
- path: core/memory/gotchas-memory.js
hash: sha256:0063eff42caf0dda759c0390ac323e7b102f5507f27b8beb7b0acc2fbec407c4
hash: sha256:cb666e318d1716c1cb8007cd216e5a97be8c8fbee1e802b8ce13a7b4e9ad2121
type: core
size: 33058
size: 33491
- path: core/migration/migration-config.yaml
hash: sha256:c251213b99ce86c9b15311d51a0b464b7fc25179455c4c6c107cae76cf49d1ab
type: core
Expand Down
Loading
Loading