Skip to content

feat(worker): surface memory stats in run log and fix log-level colors#91

Merged
albanm merged 1 commit into
masterfrom
feat-better-memory-display
May 27, 2026
Merged

feat(worker): surface memory stats in run log and fix log-level colors#91
albanm merged 1 commit into
masterfrom
feat-better-memory-display

Conversation

@albanm
Copy link
Copy Markdown
Member

@albanm albanm commented May 27, 2026

Make the per-task memory debug logs added in #90 actually useful in the
run log UI, and fix two stale color choices in the run-log component.

Why: the new memory-reporter was pushing debug('memory', formatMem(...))
into run.log, but run-logs-list.vue only renders log.msg — the
actual rss=… heapUsed=… … payload (stored in extra) was silently
dropped. There were also no startup / exit entries to anchor the
periodic samples in time.

What changed:

  • worker/src/task/memory-reporter.ts — when processing.debug, emit a
    unified Task process memory stats - rss=… heapTotal=… heapUsed=… …
    debug entry at startup, on every sample interval, and at stop. Payload
    is now in msg (visible in the UI) rather than extra.
  • worker/src/task/task.ts — capture the reporter handle and
    await memReporter.stop() in finally, so the closing entry lands
    after the final success/error log.
  • ui/src/components/run/run-logs-list.vuewarning entries now use
    text-warning (were text-info), and debug entries use
    text-medium-emphasis so they're visually distinct from info.

Regression risks:

  • The run-log color change applies to every existing warning /
    debug entry across all runs, not only the new memory lines.
  • MemoryReporterHandle.stop() is now async; the single in-tree caller
    was updated to await it.
  • The exit memory entry is pushed via log.debug (mongo write + ws
    emit). If mongo stalls on shutdown, the task child waits on it — same
    pattern as the existing final success/error log.

Memory samples now emit a single debug log line per phase (startup, each
sample interval, and stop) when processing.debug is on, formatted as
`Task process memory stats - rss=… heapTotal=… …` so the payload is
visible in the run UI (which only renders log.msg). The reporter handle
is now awaited in task.ts:finally so the closing sample lands after the
final success/error log.

Run log UI: `warning` entries now use `text-warning` (were styled with
`text-info`), and `debug` entries use `text-medium-emphasis` so they're
visually distinct from `info`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@albanm albanm merged commit 178204b into master May 27, 2026
3 checks passed
@albanm albanm deleted the feat-better-memory-display branch May 27, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant