Skip to content

feat(usage): add structured Ask Usage results#4270

Open
alex-alecu wants to merge 27 commits into
mainfrom
feat/kilo-usage-ai-cloud-only
Open

feat(usage): add structured Ask Usage results#4270
alex-alecu wants to merge 27 commits into
mainfrom
feat/kilo-usage-ai-cloud-only

Conversation

@alex-alecu

Copy link
Copy Markdown
Contributor

Summary

  • Add the native MCP dataset stats/cost plumbing and gateway auth pieces needed for Ask Usage.
  • Add the Ask Usage admin experience, routers, dataset contracts/query modules, and structured tool-result rendering.
  • Update Cloud Agent session contracts, test fixtures, and fake-LLM harness coverage so structured tool results survive ingestion and rendering instead of leaking as assistant body text.

Verification

No manual browser verification performed; local UI services were not started for this branch.

Visual Changes

Not captured.

Reviewer Notes

  • This branch was split from feat/kilo-usage-ai-mvp and intentionally excludes local-only dev routing work plus dirty local worktree edits.
  • The newest remote-only cloud commit was cherry-picked as a full commit, not as individual file changes.
  • Review focus: MCP tool result contracts, Ask Usage rendering boundaries, Cloud Agent payload preservation, and the included database/GDPR updates.

Make the usage-cost convenience tool strict-compatible for common total-cost prompts so GPT can complete with one handler call. Route advanced cost shapes through query_kilo_dataset and cover real MCP schema serialization.
…nto feat/kilo-usage-ai-mvp

# Conflicts:
#	apps/web/src/lib/kilo-datasets/contracts.ts

const input = toolPart.state.input;
return (
input.server_name === ASK_USAGE_MCP_SERVER_NAME && input.tool_name === ASK_USAGE_MCP_TOOL_NAME

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: Streaming MCP updates can crash Ask Usage rendering

renderToolPart now runs before hasRequiredInput(), but this helper assumes toolPart.state.input is already an object. Early mcp updates can arrive before the full input envelope is present, so input.server_name throws here and takes down the whole message bubble instead of falling back to the loading placeholder. Guard input with isRecord() and return false until the server/tool identity fields exist.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • apps/web/src/modules/ask-usage/client/rendering/dataset-tool-view.test.ts
  • apps/web/src/modules/ask-usage/client/rendering/dataset-tool-view.ts
Previous Review Summaries (2 snapshots, latest commit 37a3fac)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 37a3fac)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • apps/web/.env.development.local.example
  • apps/web/src/app/mcp/route.test.ts
  • apps/web/src/modules/ask-usage/server/start-ask-usage-session.test.ts
  • apps/web/src/modules/ask-usage/server/start-ask-usage-session.ts

Previous review (commit ea29b49)

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/modules/ask-usage/client/rendering/dataset-tool-view.ts 47 Streaming MCP updates can crash Ask Usage rendering

Reviewed by gpt-5.4-20260305 · Input: 83.4K · Output: 10.1K · Cached: 989.2K

Review guidance: REVIEW.md from base branch main

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.

1 participant