Skip to content

chore: sync OpenAPI contract#3

Merged
JasonLovesDoggo merged 1 commit intomainfrom
contract-sync/472e2bf1
Apr 17, 2026
Merged

chore: sync OpenAPI contract#3
JasonLovesDoggo merged 1 commit intomainfrom
contract-sync/472e2bf1

Conversation

@JasonLovesDoggo
Copy link
Copy Markdown
Member

Automated sync of `contract/openapi.yaml` from the monorepo.

Source commit: trylitmus/litmus@472e2bf1b2ee3469407923dd498a51b08312638b

Review the diff, then merge. If the SDK has codegen (e.g. `pnpm generate`),
run it after merging to update generated types.

Source commit: trylitmus/litmus@472e2bf1b2ee3469407923dd498a51b08312638b
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 17, 2026

Greptile Summary

This PR syncs the OpenAPI contract from the monorepo, adding the $sessionend event type with clear documentation distinguishing it from $abandon, and extending the Event schema with optional LLM telemetry fields (model, provider, input_tokens, output_tokens, total_tokens, duration_ms, ttft_ms, cost). All new fields are optional, making this a fully backwards-compatible change.

Confidence Score: 5/5

Safe to merge — purely additive, backwards-compatible OpenAPI contract changes with no breaking modifications.

All new fields are optional and all changes are additive. The single finding is a P2 style suggestion about potential token-count inconsistency with no immediate correctness risk.

No files require special attention.

Important Files Changed

Filename Overview
contract/openapi.yaml Adds $sessionend event type and optional LLM telemetry fields to the Event schema; all changes are backwards-compatible and well-documented.

Entity Relationship Diagram

%%{init: {'theme': 'neutral'}}%%
erDiagram
    Event {
        string id PK
        string session_id
        EventType type
        string project_id
        string prompt_id
        string prompt_version
        string generation_id
        string user_id
        string model
        string provider
        integer input_tokens
        integer output_tokens
        integer total_tokens
        integer duration_ms
        integer ttft_ms
        number cost
        object metadata
        string timestamp
    }

    EventType {
        string value
    }

    IngestRequest {
        array events
    }

    IngestResponse {
        integer accepted
    }

    IngestRequest ||--|{ Event : "contains"
    Event }o--|| EventType : "has"
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: contract/openapi.yaml
Line: 152-155

Comment:
**`total_tokens` is derivable but not constrained**

The schema accepts `input_tokens`, `output_tokens`, and `total_tokens` as independent optional integers. A client could submit values where `total_tokens != input_tokens + output_tokens` with no schema-level warning. Since this is an ingest API that stores what it receives, inconsistent token totals would silently pollute analytics. Consider adding a note in the description (or a server-side validation rule) that `total_tokens` is expected to equal `input_tokens + output_tokens` when all three are present.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "chore: sync OpenAPI contract from monore..." | Re-trigger Greptile

Comment thread contract/openapi.yaml
Comment on lines +152 to +155
total_tokens:
type: integer
minimum: 0
description: Total tokens (input + output).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 total_tokens is derivable but not constrained

The schema accepts input_tokens, output_tokens, and total_tokens as independent optional integers. A client could submit values where total_tokens != input_tokens + output_tokens with no schema-level warning. Since this is an ingest API that stores what it receives, inconsistent token totals would silently pollute analytics. Consider adding a note in the description (or a server-side validation rule) that total_tokens is expected to equal input_tokens + output_tokens when all three are present.

Prompt To Fix With AI
This is a comment left during a code review.
Path: contract/openapi.yaml
Line: 152-155

Comment:
**`total_tokens` is derivable but not constrained**

The schema accepts `input_tokens`, `output_tokens`, and `total_tokens` as independent optional integers. A client could submit values where `total_tokens != input_tokens + output_tokens` with no schema-level warning. Since this is an ingest API that stores what it receives, inconsistent token totals would silently pollute analytics. Consider adding a note in the description (or a server-side validation rule) that `total_tokens` is expected to equal `input_tokens + output_tokens` when all three are present.

How can I resolve this? If you propose a fix, please make it concise.

@JasonLovesDoggo JasonLovesDoggo merged commit c0cdd86 into main Apr 17, 2026
3 checks passed
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