Skip to content

refactor(kiloclaw): move volume usage from DO state to Analytics Engine#2301

Merged
evanjacobson merged 8 commits intomainfrom
improvement/kiloclaw-volume-usage-via-ae
Apr 13, 2026
Merged

refactor(kiloclaw): move volume usage from DO state to Analytics Engine#2301
evanjacobson merged 8 commits intomainfrom
improvement/kiloclaw-volume-usage-via-ae

Conversation

@evanjacobson
Copy link
Copy Markdown
Contributor

@evanjacobson evanjacobson commented Apr 10, 2026

Summary

This PR moves volume usage to Analytics Engine, which already receives controller telemetry. The admin UI now reads disk usage directly from AE via a dedicated query, and the DO storage fields are removed entirely.

Details

  • diskUsedBytes / diskTotalBytes are appended to the existing KILOCLAW_CONTROLLER_AE writeDataPoint as double7 / double8.

  • A new admin route and React Query hook (kiloclaw-controller-telemetry) query the AE dataset, following the same pattern as the existing kiloclaw-analytics route/hooks.

  • recordDiskStats(), its DO method, and the diskUsedBytes / diskTotalBytes fields are removed from the persisted state schema, mutable state, types, and worker status response.

  • AE write failures in the checkin route are caught so they never affect the 204 response — matching the best-effort semantics the old recordDiskStats call had.

Verification

  • pnpm typecheck
  • pnpm test -- services/kiloclaw/src/routes/controller.test.ts

Visual Changes

N/A — the admin instance detail page shows the same Volume Usage field; only the data source changed.

Reviewer Notes

  • This is a direct cutover with no fallback to DO state

@evanjacobson evanjacobson changed the title Improvement/kiloclaw volume usage via ae refactor(kiloclaw): move volume usage from DO state to Analytics Engine Apr 10, 2026
Cut over disk usage from DO storage to controller telemetry AE dataset:

- Append double7/double8 to KILOCLAW_CONTROLLER_AE writeDataPoint for diskUsedBytes/diskTotalBytes
- Add dedicated admin route and React Query hook for controller telemetry disk usage
- Switch admin instance detail Volume Usage to AE-only reads (sentinel -1 = missing)
- Remove recordDiskStats() from checkin route and DO state fields

Direct AE-only cutover with no fallback, matching the admin-only scope.
@evanjacobson evanjacobson force-pushed the improvement/kiloclaw-volume-usage-via-ae branch from 5444a6f to 2165066 Compare April 10, 2026 20:36
@evanjacobson evanjacobson marked this pull request as ready for review April 10, 2026 20:58
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Apr 10, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
apps/web/src/app/admin/components/KiloclawInstances/KiloclawInstanceDetail.tsx 1205 Zero-byte disk usage is converted to null, so empty volumes render as instead of 0 B / ... (0%).
Other Observations (not in diff)

None.

Files Reviewed (10 files)
  • apps/web/src/app/admin/api/kiloclaw-controller-telemetry/hooks.ts - 0 issues
  • apps/web/src/app/admin/api/kiloclaw-controller-telemetry/route.ts - 0 issues
  • apps/web/src/app/admin/components/KiloclawInstances/KiloclawInstanceDetail.tsx - 1 issue
  • apps/web/src/lib/kiloclaw/types.ts - 0 issues
  • services/kiloclaw/src/durable-objects/kiloclaw-instance/index.ts - 0 issues
  • services/kiloclaw/src/durable-objects/kiloclaw-instance/state.ts - 0 issues
  • services/kiloclaw/src/durable-objects/kiloclaw-instance/types.ts - 0 issues
  • services/kiloclaw/src/routes/controller.test.ts - 0 issues
  • services/kiloclaw/src/routes/controller.ts - 0 issues
  • services/kiloclaw/src/schemas/instance-config.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.4-20260305 · 713,528 tokens

Copy link
Copy Markdown
Contributor

@pandemicsyn pandemicsyn left a comment

Choose a reason for hiding this comment

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

lgtm

@evanjacobson evanjacobson merged commit 38f1417 into main Apr 13, 2026
15 checks passed
@evanjacobson evanjacobson deleted the improvement/kiloclaw-volume-usage-via-ae branch April 13, 2026 16:04
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