From b5bde4ec209748c1248f47b5007c33a5111d2d16 Mon Sep 17 00:00:00 2001 From: sol Date: Sat, 7 Mar 2026 18:41:23 +0000 Subject: [PATCH] fix: pin status posts, staleness filter, correct transcript parsing - Auto-pin status posts on creation, unpin on session completion - Skip stale sessions (>5min since last transcript write) - Parse OpenClaw JSONL format (type:message with nested role/content) - Handle timestamp-prefixed transcript filenames --- src/status-box.js | 9 +++++++++ src/watcher-manager.js | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/status-box.js b/src/status-box.js index 26eb1e4..b1dc86e 100644 --- a/src/status-box.js +++ b/src/status-box.js @@ -90,6 +90,15 @@ class StatusBox { const post = await this._apiCall('POST', '/api/v4/posts', body); if (this.logger) this.logger.debug({ postId: post.id, channelId }, 'Created status post'); this.metrics.updatesSent++; + + // Pin the status post so it's always visible + try { + await this._apiCall('POST', `/api/v4/posts/${post.id}/pin`, null); + if (this.logger) this.logger.debug({ postId: post.id }, 'Status post pinned'); + } catch (pinErr) { + if (this.logger) this.logger.warn({ postId: post.id, err: pinErr }, 'Failed to pin status post'); + } + return post.id; } diff --git a/src/watcher-manager.js b/src/watcher-manager.js index f129011..b5a86e0 100644 --- a/src/watcher-manager.js +++ b/src/watcher-manager.js @@ -331,6 +331,14 @@ async function startDaemon() { logger.error({ sessionKey, err }, 'Failed to update final status'); } + // Unpin the status post when session is done + try { + await sharedStatusBox._apiCall('POST', `/api/v4/posts/${box.postId}/unpin`, null); + logger.debug({ sessionKey, postId: box.postId }, 'Status post unpinned'); + } catch (unpinErr) { + logger.warn({ sessionKey, err: unpinErr }, 'Failed to unpin status post'); + } + // Clean up activeBoxes.delete(sessionKey); watcher.removeSession(sessionKey);