Repository navigation
fix(compression): analytics reports lite again when lite runs as a scoped stacked step #19012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
76832bc
beab29c
7430dfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - **fix(compression): analytics reports lite again when lite runs as a scoped stacked step**: since #18818 the lossy-request policy runs a configured `lite` as a one-step stacked pipeline. Compression analytics then recorded `stacked` as both mode and engine, so the dashboard's mode and engine breakdowns no longer showed lite. The plan now carries `reportedMode: "lite"`, and the analytics row records that; dispatch is unchanged. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,10 @@ type WriteOpts = { | |
| effectiveServiceTier: string | undefined; | ||
| comboName: string | null | undefined; | ||
| mode: string; | ||
| /** The mode the user configured, when the dispatched plan wraps it (lite run as a one-step | ||
| * stacked pipeline by the lossy-request policy). Recorded as mode and engine so analytics | ||
| * keeps reporting what was configured, not the wrapper. */ | ||
| reportedMode?: string; | ||
| compressionComboId: string | null | undefined; | ||
| skillRequestId: string; | ||
| cavemanOutputModeApplied: boolean; | ||
|
|
@@ -66,8 +70,8 @@ function buildAnalyticsRow( | |
| timestamp: new Date().toISOString(), | ||
| combo_id: opts.comboName ?? null, | ||
| provider: opts.provider ?? null, | ||
| mode: opts.mode, | ||
| engine: stats.engine ?? opts.mode, | ||
| mode: opts.reportedMode ?? opts.mode, | ||
| engine: opts.reportedMode ?? stats.engine ?? opts.mode, | ||
| compression_combo_id: stats.compressionComboId ?? opts.compressionComboId ?? null, | ||
| original_tokens: stats.originalTokens, | ||
| compressed_tokens: stats.compressedTokens, | ||
|
|
@@ -110,8 +114,8 @@ export function writeCompressionSkip(opts: WriteOpts, skipReason: string): Promi | |
| timestamp: new Date().toISOString(), | ||
| combo_id: opts.comboName ?? null, | ||
| provider: opts.provider ?? null, | ||
| mode: opts.mode, | ||
| engine: stats.engine ?? opts.mode, | ||
| mode: opts.reportedMode ?? opts.mode, | ||
| engine: opts.reportedMode ?? stats.engine ?? opts.mode, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| compression_combo_id: stats.compressionComboId ?? opts.compressionComboId ?? null, | ||
| original_tokens: stats.originalTokens, | ||
| compressed_tokens: stats.compressedTokens, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: cheaper-inference/OmniRoute
Length of output: 41981
Script executed:
Repository: cheaper-inference/OmniRoute
Length of output: 7029
Keep the dispatched engine in analytics when the default combo replaces a lite plan.
A configured
liteplan is wrapped withreportedMode: "lite". When the seeded default combo runs instead, the dispatched pipeline can containsession-dedupandlite. The analytics writer then setsenginetolitein the summary row, so the row does not name the engine that ran. The per-engine breakdown still lists each step.Keep the configured mode in
mode. Setenginefrom the dispatched pipeline. Use thereportedModelabel forengineonly when the single lite wrapper step runs. Apply the same rule to the skip record path. The secondenginefallback incompressionAnalyticsWrite.ts(around lines 74 and 118) needs this change. Add a test for the default-combo case.