Skip to content

Fix memory pressure detection, dashboard formatting, and auth log leak - #111

Merged
scobru merged 1 commit into
mainfrom
claude/linda-relay-bugs-graphics-k8fucl
Jul 6, 2026
Merged

Fix memory pressure detection, dashboard formatting, and auth log leak#111
scobru merged 1 commit into
mainfrom
claude/linda-relay-bugs-graphics-k8fucl

Conversation

@scobru

@scobru scobru commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Bug fixes found while auditing the relay used by Linda.

  • Memory pressure detection was broken: memory-utils assumed a 4096 MB heap limit whenever NODE_OPTIONS didn't set --max-old-space-size. On a small container (e.g. 512 MB) pressure would never be detected before OOM; on bigger machines it over-reported. It now reads the real limit from v8.getHeapStatistics().heap_size_limit (with the old env parse as fallback).
  • Tests were environment-dependent: memory-utils.test.ts hardcoded the 4096 MB assumption and failed on any machine where NODE_OPTIONS sets a different heap size (3 failures on a stock 8 GB config). The heap limit is now mocked, making the suite deterministic. All 50 tests pass.
  • Dashboard: formatBytes(0) rendered NaN undefined in Charts (Math.log(0)-Infinity); the unit index is also clamped in Charts and Files so sizes above GB don't render undefined.
  • Auth logging: hasValidToken logged [object Object] on success and dumped raw message headers — which can contain attempted auth tokens — on failure. It now logs only whether a token was present.

Testing

  • npm test: 50/50 pass (was 47/50 in this environment).
  • npm run lint (--max-warnings 0): clean.
  • tsc --noEmit: clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Zi9DBXdzCep7XRgmm9wuu


Generated by Claude Code

…g leak

- memory-utils: use the real V8 heap limit (v8.getHeapStatistics) instead of
  assuming 4096 MB when NODE_OPTIONS is unset; pressure checks now work on
  small containers and stop mis-reporting on larger ones. Tests now mock the
  heap limit so they no longer depend on the host's NODE_OPTIONS.
- dashboard Charts: formatBytes(0) rendered 'NaN undefined' (Math.log(0));
  clamp the unit index in Files too so >GB sizes don't render 'undefined'.
- hasValidToken: stop logging raw message headers (could contain attempted
  auth tokens) and fix the '[object Object]' interpolation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Zi9DBXdzCep7XRgmm9wuu
@scobru
scobru marked this pull request as ready for review July 6, 2026 17:10
@scobru
scobru merged commit 0a0bf23 into main Jul 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants