Skip to content

feat(admin): add DO & reconcile events card to kiloclaw instance detail#1392

Merged
pandemicsyn merged 2 commits intomainfrom
florian/chore/event-log
Mar 23, 2026
Merged

feat(admin): add DO & reconcile events card to kiloclaw instance detail#1392
pandemicsyn merged 2 commits intomainfrom
florian/chore/event-log

Conversation

@pandemicsyn
Copy link
Contributor

Summary

Add a "DO & Reconcile Events" card to the KiloClaw admin instance detail page that queries Cloudflare Analytics Engine for the 20 most recent do and reconcile delivery events for a given instance.

  • New API route (/admin/api/kiloclaw-analytics) queries the kiloclaw_events AE dataset, reusing existing R2_ACCOUNT_ID and CF_ANALYTICS_ENGINE_TOKEN credentials (same as gastown-analytics).
  • New React Query hook (useKiloclawInstanceEvents) auto-refreshes every 60s.
  • The card renders a table with Time, Event, Delivery (color-coded badge), Status, Label, Duration, and Error columns. Placed after the "Live Worker Status" card on the instance detail page.
  • sandboxId is validated against base64url charset before SQL interpolation to prevent injection.

Verification

  • pnpm typecheck — pass (root + all 29 workspace projects)
  • pnpm format — pass (oxfmt)
  • pnpm lint — pass (oxlint + eslint across all packages)
  • Pre-push hooks (format:check, lint, typecheck) — pass
  • Manual verification against live Analytics Engine data

Visual Changes

Before After
No events card on instance detail page New "DO & Reconcile Events" card with table between Live Worker Status and Machine Controls

Reviewer Notes

  • Follows the established gastown-analytics pattern (API route + hooks + component) exactly.
  • The query filters on blob8 (sandboxId) and blob3 IN ('do', 'reconcile') with LIMIT 20.
  • No new env vars needed — reuses the existing CF Analytics Engine credentials.

Query Cloudflare Analytics Engine for recent do/reconcile events
per instance and display them in a table on the admin detail page.
@pandemicsyn pandemicsyn marked this pull request as ready for review March 23, 2026 15:24
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 23, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • src/app/admin/api/kiloclaw-analytics/hooks.ts
  • src/app/admin/api/kiloclaw-analytics/route.ts
  • src/app/admin/components/KiloclawInstances/KiloclawInstanceDetail.tsx

Reviewed by gpt-5.4-20260305 · 425,327 tokens

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 23, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • src/app/admin/api/kiloclaw-analytics/hooks.ts
  • src/app/admin/api/kiloclaw-analytics/route.ts
  • src/app/admin/components/KiloclawInstances/KiloclawInstanceDetail.tsx

@pandemicsyn
Copy link
Contributor Author

pandemicsyn commented Mar 23, 2026

No AE in dev, but can at least prove that if this off line it does not take the whole instance page down with it:

Uploading SCR-20260323-kggx.png…

@pandemicsyn pandemicsyn merged commit d82f719 into main Mar 23, 2026
18 checks passed
@pandemicsyn pandemicsyn deleted the florian/chore/event-log branch March 23, 2026 16:27
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