Skip to content

feat(kiloclaw) briefing chat summary - #3352

Merged
St0rmz1 merged 6 commits into
mainfrom
feat/kiloclaw-briefing-chat-summary
May 20, 2026
Merged

St0rmz1 merged 6 commits into
mainfrom
feat/kiloclaw-briefing-chat-summary

Conversation

@St0rmz1

@St0rmz1 St0rmz1 commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a Kilo Chat activity section to the morning briefing. Each briefing now includes two new sections built from the Kilo Chat controller: one summarizing yesterday's activity and one covering today so far. The summary reports message counts, active conversation counts, and a split between user messages and Kilo replies. Deleted messages are tracked separately and excluded from content counts.

The new chat-summary-client paginates conversations and messages from the controller via the gateway, stopping early when activity falls outside the target window. The new chat-summary-utils builds time windows in the configured briefing timezone, decodes ULIDs to message timestamps, and renders the markdown lines. The briefing pipeline now treats Kilo Chat as a configured source alongside Calendar, GitHub, Linear, Local News, and Web Search.

If OPENCLAW_GATEWAY_TOKEN is not set, the chat section is skipped gracefully and the rest of the briefing continues to render.

Verification

  • Ran the briefing locally with the gateway token configured and confirmed both Yesterday in Chat and So Far Today in Chat sections render with accurate counts.
  • Ran the briefing locally without the gateway token and confirmed the briefing still generates with chat reported as not configured.
  • Ran pnpm run format:check, pnpm run lint, and pnpm run typecheck at the workspace root.

Visual Changes

N/A

Reviewer Notes

  • The client paginates with hard caps (MAX_CONVERSATION_PAGES, MAX_MESSAGE_PAGES_PER_CONVERSATION) to bound worst case API load when the controller returns many stale conversations.
  • ULID decoding in ulidToTimestampMs is used to filter messages without relying on a server side timestamp. Worth a sanity check on the Crockford base32 implementation.
  • The briefing pipeline previously called new Date() in multiple places. It now shares a single generatedAt so all sections, the markdown header, and the stored status agree on one timestamp.

Comment thread services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-client.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The new sandboxId/kiloChatBaseUrl guard checks validate two env vars as required but both variables are dead code — neither is used after the guard, so operators in environments missing these vars will silently get chat reported as unconfigured even though the controller proxy path functions without them.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-client.ts 202 sandboxId and kiloChatBaseUrl are validated as required but never used in URL construction or any downstream logic — either the substitution into request URLs was not wired in, or the guards are premature
Resolved Issues
File Line Issue Status
services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-client.ts 163 Early-stop pagination now checks for ascending-order violations before stopping ✅ Fixed
services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-client.ts 54 parseObject renamed to asObject, eliminating DRY violation ✅ Fixed
services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-utils.ts N/A DST transition offsets sampled at wrong instant — replaced with iterative wall-clock convergence loop ✅ Fixed
Files Reviewed (incremental diff since 0fdad49)
  • services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-client.ts — 1 issue
  • services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-client.test.ts — no issues
  • services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-utils.ts — no issues
  • services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-utils.test.ts — no issues

Fix these issues in Kilo Cloud


Reviewed by claude-4.6-sonnet-20260217 · 861,043 tokens

Review guidance: REVIEW.md from base branch main

@St0rmz1 St0rmz1 changed the title Feat/kiloclaw briefing chat summary feat(kiloclaw) briefing chat summary May 20, 2026

@jeanduplessis jeanduplessis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with two warnings worth addressing:

  • chat day-window construction can shift by an hour on DST transition days
  • summary configuration currently keys off gateway token even when controller Kilo Chat routes are not registered

Main feature shape, pagination hardening, and briefing integration otherwise look sound.

Comment thread services/kiloclaw/plugins/kiloclaw-morning-briefing/src/chat-summary-utils.ts Outdated
};
}

const sandboxId = options.sandboxId ?? process.env.KILOCLAW_SANDBOX_ID;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: sandboxId and kiloChatBaseUrl are validated as required but never used

Both variables are extracted and guard-checked (lines 202–218), but neither is referenced anywhere in the rest of createKiloChatSummaryClient. All request URLs are built from baseUrl (the controller proxy URL). The linter will flag these as unused variables.

This is either:

  1. Incomplete implementation — kiloChatBaseUrl was intended to be used in the /_kilo/kilo-chat/… URL construction instead of routing through the controller proxy, but the substitution was not wired in; or
  2. Premature guards — these env vars are not yet needed and the validation should be removed until the code that uses them is added.

As-is, you are requiring operators to set two env vars (KILOCLAW_SANDBOX_ID, KILOCHAT_BASE_URL) that the runtime silently ignores, which will cause the morning briefing to silently report chat as unconfigured in environments that have not set these vars — even though the controller proxy path works fine without them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false positive

  • The bot claims "the linter will flag these as unused variables" — that's wrong. Both sandboxId (used at line 203) and kiloChatBaseUrl (used at line 212) are referenced in their own if (!...) guard checks. ESLint no-unused-vars will not flag them.

  • The bot's deeper point ("requiring env vars the runtime ignores") misses context: those guards are the fix for jeanduplessis's warning AppBuilder - Fix model selector not showing saved model on reload #4. The controller only registers /_kilo/kilo-chat/* when those exact two vars are present, so the briefing plugin checks the same two vars to decide whether the routes exist. They're an intentional availability gate, not URL inputs. Removing them would re-introduce finding AppBuilder - Fix model selector not showing saved model on reload #4 — the human reviewer's explicit concern.

@St0rmz1
St0rmz1 merged commit 0531dca into main May 20, 2026
14 checks passed
@St0rmz1
St0rmz1 deleted the feat/kiloclaw-briefing-chat-summary branch May 20, 2026 15:00
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