singularity-forge/src
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
..
resources fix(metrics): deduplicate idle-watchdog entries and fix forensics false-positives (#1973) 2026-04-05 00:54:44 -04:00
tests docs: add provider setup guide for third-party LLM providers (#3294) 2026-04-05 00:48:19 -04:00
web fix: add windowsHide to all web-mode subprocess spawns (#2628) (#3046) 2026-03-30 14:50:13 -06:00
app-paths.js feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
app-paths.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
bundled-extension-paths.ts
bundled-resource-path.ts M001: The Minimal Machine — linear auto-loop, sole-authority state, sidecar queue, WorktreeResolver (#1419) 2026-03-19 14:56:00 -06:00
cli-web-branch.ts feat: add --host, --port, --allowed-origins flags for web mode (#1847) (#1873) 2026-03-21 15:22:01 -06:00
cli.ts fix(security): add configurable overrides for command allowlist and SSRF blocklist 2026-04-02 13:45:05 +02:00
extension-discovery.ts fix: apply pi manifest opt-out to extension-discovery.ts (#1545) 2026-03-20 08:11:51 -06:00
extension-registry.ts feat: add GSD_HOME env var to override global ~/.gsd directory (#1566) 2026-03-20 08:29:01 -06:00
headless-answers.ts
headless-context.ts
headless-events.ts fix(headless): match "completed" status from RPC v2 in exit code mapper 2026-03-27 17:04:31 -06:00
headless-query.ts fix: guard activeMilestone.id access in discuss and headless paths (#2776) 2026-03-26 20:05:19 -06:00
headless-types.ts test: Added --output-format text|json|stream-json flag, standardized ex… 2026-03-26 11:34:21 -06:00
headless-ui.ts feat: stream full text and thinking output in headless verbose mode (#2934) 2026-03-27 21:57:11 -06:00
headless.ts feat: stream full text and thinking output in headless verbose mode (#2934) 2026-03-27 21:57:11 -06:00
help-text.ts docs: add provider setup guide for third-party LLM providers (#3294) 2026-04-05 00:48:19 -04:00
loader.ts feat: managed RTK integration with opt-in preference and web UI toggle (#2620) 2026-03-26 09:33:07 -06:00
logo.ts
mcp-server.ts
models-resolver.ts
onboarding.ts docs: add provider setup guide for third-party LLM providers (#3294) 2026-04-05 00:48:19 -04:00
pi-migration.ts
project-sessions.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
remote-questions-config.ts chore: rename preferences.md to PREFERENCES.md for consistency (#2700) (#2738) 2026-03-26 16:09:59 -06:00
resource-loader.ts feat(extensions): wire up topological sort and unified registry filtering (#3152) 2026-03-31 11:54:48 -06:00
rtk.ts refactor(gsd): extract duplicated status guards and validation helpers (#2767) 2026-03-26 18:14:43 -06:00
security-overrides.ts fix(security): add configurable overrides for command allowlist and SSRF blocklist 2026-04-02 13:45:05 +02:00
startup-model-validation.ts fix: defer model validation until after extensions register (#3089) 2026-03-30 14:38:10 -06:00
startup-timings.ts Improve startup performance with lazy extension loading (#1336) 2026-03-19 07:38:50 -06:00
tool-bootstrap.ts M001: The Minimal Machine — linear auto-loop, sole-authority state, sidecar queue, WorktreeResolver (#1419) 2026-03-19 14:56:00 -06:00
update-check.ts
update-cmd.ts
web-mode.ts fix: add windowsHide to all web-mode subprocess spawns (#2628) (#3046) 2026-03-30 14:50:13 -06:00
welcome-screen.ts Merge pull request #2312 from jeremymcs/fix/tui-review 2026-04-01 16:38:31 -05:00
wizard.ts fix(remote-questions): empty-key entry in auth.json shadows valid Discord bot token (#2737) 2026-03-26 16:16:42 -06:00
worktree-cli.ts refactor: move GSD metadata from commit subject scopes to git trailers 2026-03-25 22:56:48 +00:00
worktree-name-gen.ts feat: add -w/--worktree CLI flag for isolated worktree sessions (#1247) 2026-03-18 14:57:25 -06:00