singularity-forge/src/resources
Tom Boucher 3e7a8d8556 fix(metrics): deduplicate idle-watchdog entries and fix forensics false-positives (#1973)
* fix(metrics): deduplicate idle-watchdog entries on ledger load and fix forensics false-positives

The idle watchdog creates duplicate metrics entries with the same
(type, id, startedAt) triple, inflating reported cost by ~35% and
causing false-positive stuck-loop anomalies in forensics.

Add a deduplicateUnits() pass in loadLedger() that collapses entries
sharing the same (type, id, startedAt) key, keeping the one with the
highest finishedAt. The cleaned ledger is persisted back to disk so
duplicates do not re-accumulate across sessions.

Fix detectStuckLoops() in forensics.ts to count distinct startedAt
values per type/id instead of raw entry count, so idle-watchdog
snapshots of the same dispatch are not flagged as stuck loops.

Fixes #1943

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: export ForensicAnomaly type and use in test

The test declared a local ForensicAnomaly interface with `type: string`
which was incompatible with the real union literal type, causing CI
typecheck failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 00:54:44 -04:00
..
agents fix: replace web_search with search-the-web in prompts and agent frontmatter (#2920) (#3245) 2026-03-30 14:30:01 -06:00
extensions fix(metrics): deduplicate idle-watchdog entries and fix forensics false-positives (#1973) 2026-04-05 00:54:44 -04:00
skills Merge pull request #2287 from jeremymcs/worktree-btw-implementation 2026-04-03 15:18:03 -05:00
GSD-WORKFLOW.md feat: meaningful commit messages from task summaries (#803) 2026-03-16 23:30:33 -06:00