[PR #57] [MERGED] fix: live activity feed ordering + timezone normalization #57

Closed
opened 2026-09-03 07:34:39 +02:00 by zaph0d · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/niels-emmer/nanoclaw-dashboard/pull/57
Author: @niels-emmer
Created: 9/2/2026
Status: Merged
Merged: 9/2/2026
Merged by: @niels-emmer

Base: mainHead: fix/live-activity-scroll


📝 Commits (2)

  • d0f7787 feat: enrich API discoverability for agents + fix WS rejection close code
  • 949e7f2 fix: live activity feed ordering + timezone normalization

📊 Changes

11 files changed (+320 additions, -9 deletions)

View changed files

API.md (+109 -0)
📝 README.md (+1 -0)
📝 backend/app/events.py (+3 -1)
📝 backend/app/main.py (+47 -1)
📝 backend/app/telemetry/nanoclaw.py (+28 -5)
📝 backend/tests/test_app.py (+50 -0)
📝 backend/tests/test_telemetry.py (+26 -0)
📝 docs/ARCHITECTURE.md (+1 -1)
📝 docs/decision-log.md (+23 -0)
📝 frontend/src/lib/activityFeed.test.ts (+18 -0)
📝 frontend/src/lib/activityFeed.ts (+14 -1)

📄 Description

Summary

Fixes the Live activity feed (right column) on the main dashboard.

Problem

  • A few entries sat pinned at the top and did not scroll down as new messages arrived.
  • Those entries' timestamps were often in the future.

Root causes

  1. Feed ordering — the feed was ordered by arrival order, not timestamp. The backend emits bursts per poll cycle, so display order was inconsistent with the displayed times.
  2. Timezone — nanoclaw stores timestamps as naive local time in several tables (messages_out, delivered_at, status_changed, created_at), which the dashboard treated as UTC, shifting them into the future.

Fix

  • Frontend (activityFeed.ts): sort the feed newest-first by timestamp so every entry lands on top and scrolls down as newer messages arrive.
  • Backend (nanoclaw.py): add _normalize_timestamp() and apply it to all row-sourced timestamps — naive values are interpreted as host-local and converted to UTC; already-UTC ISO values are preserved.

Tests

  • Backend: 14 passed (3 new for _normalize_timestamp).
  • Frontend: 55 passed (2 new for feed sorting), lint clean, build clean.

Docs

  • ADR 0020 added to docs/decision-log.md.

Note: this branch was created from local main which carried an unrelated unpushed commit (d0f7787). That commit is intentionally not part of this PR's scope and will be inspected separately before any push to main.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/niels-emmer/nanoclaw-dashboard/pull/57 **Author:** [@niels-emmer](https://github.com/niels-emmer) **Created:** 9/2/2026 **Status:** ✅ Merged **Merged:** 9/2/2026 **Merged by:** [@niels-emmer](https://github.com/niels-emmer) **Base:** `main` ← **Head:** `fix/live-activity-scroll` --- ### 📝 Commits (2) - [`d0f7787`](https://github.com/niels-emmer/nanoclaw-dashboard/commit/d0f77876efc1b4d268218faebb96b2176b7df900) feat: enrich API discoverability for agents + fix WS rejection close code - [`949e7f2`](https://github.com/niels-emmer/nanoclaw-dashboard/commit/949e7f25d22dda31d2555f638b0f4205034c4f09) fix: live activity feed ordering + timezone normalization ### 📊 Changes **11 files changed** (+320 additions, -9 deletions) <details> <summary>View changed files</summary> ➕ `API.md` (+109 -0) 📝 `README.md` (+1 -0) 📝 `backend/app/events.py` (+3 -1) 📝 `backend/app/main.py` (+47 -1) 📝 `backend/app/telemetry/nanoclaw.py` (+28 -5) 📝 `backend/tests/test_app.py` (+50 -0) 📝 `backend/tests/test_telemetry.py` (+26 -0) 📝 `docs/ARCHITECTURE.md` (+1 -1) 📝 `docs/decision-log.md` (+23 -0) 📝 `frontend/src/lib/activityFeed.test.ts` (+18 -0) 📝 `frontend/src/lib/activityFeed.ts` (+14 -1) </details> ### 📄 Description ## Summary Fixes the **Live activity** feed (right column) on the main dashboard. ### Problem - A few entries sat pinned at the top and did not scroll down as new messages arrived. - Those entries' timestamps were often **in the future**. ### Root causes 1. **Feed ordering** — the feed was ordered by *arrival order*, not timestamp. The backend emits bursts per poll cycle, so display order was inconsistent with the displayed times. 2. **Timezone** — nanoclaw stores timestamps as *naive local time* in several tables (`messages_out`, `delivered_at`, `status_changed`, `created_at`), which the dashboard treated as UTC, shifting them into the future. ### Fix - **Frontend** (`activityFeed.ts`): sort the feed newest-first by timestamp so every entry lands on top and scrolls down as newer messages arrive. - **Backend** (`nanoclaw.py`): add `_normalize_timestamp()` and apply it to all row-sourced timestamps — naive values are interpreted as host-local and converted to UTC; already-UTC ISO values are preserved. ### Tests - Backend: 14 passed (3 new for `_normalize_timestamp`). - Frontend: 55 passed (2 new for feed sorting), lint clean, build clean. ### Docs - ADR 0020 added to `docs/decision-log.md`. > Note: this branch was created from local `main` which carried an unrelated unpushed commit (`d0f7787`). That commit is intentionally **not** part of this PR's scope and will be inspected separately before any push to `main`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zaph0d 2026-09-03 07:34:39 +02:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
github-mirrors/nanoclaw-dashboard#57
No description provided.