Repository navigation
fix(telemetry): deduplicate session_started and model switch events #3499
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 1 commit
d55283c
88b4705
3d92150
002556c
280633d
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 |
|---|---|---|
|
|
@@ -543,12 +543,20 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { | |
| * section gates engine events the same way the v2 print runner gates them; | ||
| * the host keeps owning the client's lifecycle (flush / shutdown stay with | ||
| * the host, matching the v1 core's arrangement). | ||
| * | ||
| * The engine's own `session_started` is dropped here: `KimiHarness` emits | ||
| * that event for every session it opens (create / resume / reload / fork) | ||
| * with the richer client-attribution schema, so forwarding the engine's | ||
| * `{resumed, experimental_flags}` copy double-counted every open. Hosts | ||
| * without a harness (run-v2-print, kap-server) wire their own appenders and | ||
| * still get the engine's row. | ||
| */ | ||
| private installEngineTelemetry(client: TelemetryClient | undefined): void { | ||
| if (client === undefined) return; | ||
| const telemetry = this.app.accessor.get(ITelemetryService); | ||
| telemetry.addAppender({ | ||
| track: (record) => { | ||
| if (record.event === 'session_started') return; | ||
|
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.
When a consumer instantiates the exported AGENTS.md reference: AGENTS.md:L23-L23 Useful? React with 👍 / 👎. |
||
| client.track(record.event, record.properties); | ||
| }, | ||
| }); | ||
|
|
||
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.
In a session-less v2 TUI, the selector restores the editor and starts this function without awaiting it; if the user submits the first prompt while
setConfigor the config refresh is pending, the lazy session can become live afterhadSessionis captured.refreshConfigAfterLoginthen reachessession.setModel, causing the engine to emitmodel_switch, but the stalefalsesnapshot still causes the TUI to emit a duplicate. Coordinate withwaitForLazyCreationas the regular model-switch path does, or otherwise record whether activation actually reached a live session.Useful? React with 👍 / 👎.